Passing a single tuple or multiple values

2016-07-18 Thread jmh530 via Digitalmars-d-learn
In the code below, is it possible to combine both bar functions into one function (I just put some random foo function to get it to work)? When I try to do it, I get errors that no property 'expand' for type '(Tuple!(int, int))' I think it has something to do with T... being considered a

Re: Variadic Tuple of Structs with Mixed Types

2016-07-18 Thread jmh530 via Digitalmars-d-learn
On Friday, 15 July 2016 at 19:24:12 UTC, jmh530 wrote: Have you considered recursive solutions? Will try that next. Thanks. I think this worked for me. A few tricks were that I had to have the fillAliasSeq template as global and also I couldn't disable the default constructor for what I

Re: Bug? somearrayofclassinstances.filter(...).array fails because of .init() method in class

2016-07-18 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/15/16 7:44 AM, ag0aep6g wrote: On 07/15/2016 12:54 PM, dom wrote: i just had a scenario like the one below. when calling .array on the filterresult dmd goes nuts because of the init() function in Players. Renaming to initialize() solved the problem. Solution: As .init is used for struct

Re: Iterate all visible symbols, even from imported modules

2016-07-18 Thread Lodovico Giaretta via Digitalmars-d-learn
On Monday, 18 July 2016 at 21:12:38 UTC, Meta wrote: On Monday, 18 July 2016 at 13:00:16 UTC, Lodovico Giaretta wrote: As per title, is it possible to iterate all visible symbols of the current module and of all imported modules and packages? My aim is to find everything in scope that has a

Re: Iterate all visible symbols, even from imported modules

2016-07-18 Thread Lodovico Giaretta via Digitalmars-d-learn
On Monday, 18 July 2016 at 18:21:41 UTC, ketmar wrote: short answer: no. there is still no way to write a reliable enumerator like this: too much things to hack around. as for module symbols, it is easy: they has no type. literally: `!is(typeof(...))`. `is(typeof(...))` is a necessary

Re: Iterate all visible symbols, even from imported modules

2016-07-18 Thread Meta via Digitalmars-d-learn
On Monday, 18 July 2016 at 13:00:16 UTC, Lodovico Giaretta wrote: As per title, is it possible to iterate all visible symbols of the current module and of all imported modules and packages? My aim is to find everything in scope that has a specific UDA. module foo; import std.stdio,

Re: Iterate all visible symbols, even from imported modules

2016-07-18 Thread BLM768 via Digitalmars-d-learn
On Monday, 18 July 2016 at 13:00:16 UTC, Lodovico Giaretta wrote: // how do I discover that "std" is a package? I've got a DMD pull request that adds __traits(isPackage, someSymbol), but it's stuck waiting for approval. If and when it gets merged, it could be useful for that.

Re: Convert delegate or function type to other.

2016-07-18 Thread John via Digitalmars-d-learn
On Monday, 18 July 2016 at 18:49:22 UTC, Rufus Smith wrote: Suppose I have the following: alias func = void function(int); Is there a way to convert it automatically to something the same type except of delegate: alias del = toDel(func) = void delegate(int);? import std.traits; alias del =

Re: Convert delegate or function type to other.

2016-07-18 Thread Rufus Smith via Digitalmars-d-learn
On Monday, 18 July 2016 at 18:51:29 UTC, Jacob Carlborg wrote: On 2016-07-18 20:49, Rufus Smith wrote: Suppose I have the following: alias func = void function(int); Is there a way to convert it automatically to something the same type except of delegate: alias del = toDel(func) = void

Convert delegate or function type to other.

2016-07-18 Thread Rufus Smith via Digitalmars-d-learn
Suppose I have the following: alias func = void function(int); Is there a way to convert it automatically to something the same type except of delegate: alias del = toDel(func) = void delegate(int);?

Re: Convert delegate or function type to other.

2016-07-18 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-07-18 20:49, Rufus Smith wrote: Suppose I have the following: alias func = void function(int); Is there a way to convert it automatically to something the same type except of delegate: alias del = toDel(func) = void delegate(int);?

Re: Iterate all visible symbols, even from imported modules

2016-07-18 Thread ketmar via Digitalmars-d-learn
short answer: no. there is still no way to write a reliable enumerator like this: too much things to hack around. as for module symbols, it is easy: they has no type. literally: `!is(typeof(...))`. `is(typeof(...))` is a necessary safeguard anyway if you are enumerating symbols in module,

Re: Is there a way to "see" source code generated by templates after a compile?

2016-07-18 Thread Stefan Koch via Digitalmars-d-learn
On Monday, 18 July 2016 at 17:35:29 UTC, Stefan Koch wrote: I did it for function templates just now. It will the instantiated bodys to std-out. Okay here is the frist really hacky draft patch In dtemplate.d line 6691 right at the end of semantic3 insert the following code : if

Re: Is there a way to "see" source code generated by templates after a compile?

2016-07-18 Thread Stefan Koch via Digitalmars-d-learn
On Sunday, 17 July 2016 at 16:30:38 UTC, Stefan Koch wrote: On Sunday, 17 July 2016 at 14:54:34 UTC, zabruk70 wrote: On Sunday, 17 July 2016 at 11:14:39 UTC, Stefan Koch wrote: If you want to see template expansions you have to wait a little longer. Wow! Is this really possible?! So long

Re: Some asm help for the 'thiscall' calling convention?

2016-07-18 Thread Kagamin via Digitalmars-d-learn
On Saturday, 16 July 2016 at 21:16:29 UTC, Andrew Godfrey wrote: COM is a model; in practice people pick the parts they need, and often still call it "COM". No need to rename what has a name: https://en.wikipedia.org/wiki/Interface-based_programming

Re: Some asm help for the 'thiscall' calling convention?

2016-07-18 Thread Kagamin via Digitalmars-d-learn
On Saturday, 16 July 2016 at 20:31:25 UTC, Adam Sansier wrote: Yet you are wrong. Regardless what the asio standard does right or wrong, it uses COM, correct? Is asio not well established? Yes it is. Hence it proves that not all COM is as you think it is. The component must comply with the

Re: Is there a way to "see" source code generated by templates after a compile?

2016-07-18 Thread WhatMeWorry via Digitalmars-d-learn
On Monday, 18 July 2016 at 07:37:27 UTC, lobo wrote: On Sunday, 17 July 2016 at 05:57:52 UTC, WhatMeWorry wrote: [snip] Now that I think about, was there even a way to look at c/c++ code after the pre-processor step? Does this do what you want? cl.exe /E gcc -E clang -E clang-cl /E i

Re: to auto or not to auto ( in foreach )

2016-07-18 Thread Johan Engelen via Digitalmars-d-learn
On Saturday, 16 July 2016 at 22:05:49 UTC, ketmar wrote: `foreach (v; rng)` looks like `foreach` is *reusing* *existing* *variable*. +1

Iterate all visible symbols, even from imported modules

2016-07-18 Thread Lodovico Giaretta via Digitalmars-d-learn
As per title, is it possible to iterate all visible symbols of the current module and of all imported modules and packages? My aim is to find everything in scope that has a specific UDA. module foo; import std.stdio, std.array, std.algorithm; void bar(){} struct S{} void main() { //

Re: How to group similar member functions from different classes?

2016-07-18 Thread Marc Schütz via Digitalmars-d-learn
On Friday, 15 July 2016 at 17:25:23 UTC, cy wrote: On Monday, 20 June 2016 at 16:39:54 UTC, Marc Schütz wrote: Untested: Seems to only work if A and B are both defined in the same file as Foos (defeating the purpose). Putting A and B in a.d and b.d respectively gives me these errors:

Re: Is there a way to "see" source code generated by templates after a compile?

2016-07-18 Thread Nicholas Wilson via Digitalmars-d-learn
On Sunday, 17 July 2016 at 16:30:38 UTC, Stefan Koch wrote: On Sunday, 17 July 2016 at 14:54:34 UTC, zabruk70 wrote: On Sunday, 17 July 2016 at 11:14:39 UTC, Stefan Koch wrote: If you want to see template expansions you have to wait a little longer. Wow! Is this really possible?! So long

Re: Is there a way to "see" source code generated by templates after a compile?

2016-07-18 Thread lobo via Digitalmars-d-learn
On Sunday, 17 July 2016 at 05:57:52 UTC, WhatMeWorry wrote: [snip] Now that I think about, was there even a way to look at c/c++ code after the pre-processor step? Does this do what you want? cl.exe /E gcc -E clang -E clang-cl /E

Re: build a subpackage in dub?

2016-07-18 Thread drug via Digitalmars-d-learn
16.07.2016 20:26, cy пишет: Say I have a package called "main" and a sub-package in a "complicatedexample" directory, and my dub.json in "main" looks sort of like: "subPackages": [ "./complicatedexample/" ], Let's say I do *not* have ":complicatedexample" in my dependencies for "main", but

Re: Fast MSB to LSB

2016-07-18 Thread Nicholas Wilson via Digitalmars-d-learn
On Monday, 18 July 2016 at 04:54:07 UTC, Rufus Smith wrote: Is there any MSB to LSB and vice versa in phobos? Or some tricks with templates that make it fast as possible? you mean endianness conversions? then yes. see std.bitmanip:swapendian and friends.