On Thursday, 24 January 2013 at 22:49:33 UTC, Andrej Mitrovic
wrote:
On 1/24/13, Philippe Sigaud wrote:
IIRC, you can use __traits(getOverloads, mytype.__ctor) to get
all
constructor overloads.
See:
http://dlang.org/traits.html#getOverloads
I used this in conjunction with __traits(getMember,
On 1/24/13, Philippe Sigaud wrote:
> IIRC, you can use __traits(getOverloads, mytype.__ctor) to get all
> constructor overloads.
> See:
> http://dlang.org/traits.html#getOverloads
>
> I used this in conjunction with __traits(getMember, ...) to get the
> entire list of member, overloads included.
>
On Thu, Jan 24, 2013 at 10:34 PM, Rob T wrote:
> On Thursday, 24 January 2013 at 18:41:31 UTC, mist wrote:
>>
>> You can use "magic" functions __ctor and __dtor which actually serve as
>> constructor and destructor implementations behind the scene.
>>
>> Example and proof-of-concept: http://dpaste
On Thursday, 24 January 2013 at 18:41:31 UTC, mist wrote:
You can use "magic" functions __ctor and __dtor which actually
serve as constructor and destructor implementations behind the
scene.
Example and proof-of-concept: http://dpaste.1azy.net/fd924332
Have no idea if it is explicitly defined
You can use "magic" functions __ctor and __dtor which actually
serve as constructor and destructor implementations behind the
scene.
Example and proof-of-concept: http://dpaste.1azy.net/fd924332
Have no idea if it is explicitly defined by spec somewhere though.
There may be more than one "this", so you'll have to specify the
args for each specific constructor manually.
Disclaimer: Someone else may have a better solution as I'm not
that much of an expert in this area.
This sample may point you in the right direction ...
import std.typetuple;
struct
On 01/24/2013 06:14 PM, Andrej Mitrovic wrote:
On 1/24/13, Joseph Rushton Wakeling wrote:
ParameterTypeTuple!(A.this)
Use ParameterTypeTuple!(A.__ctor)
Brilliant. Thanks very much. :-)
On 1/24/13, Andrej Mitrovic wrote:
> On 1/24/13, Joseph Rushton Wakeling wrote:
>> ParameterTypeTuple!(A.this)
>
> Use ParameterTypeTuple!(A.__ctor)
>
If you have multiple constructors you can pick the parameters with a
helper template:
import std.traits, std.string;
struct A
{
th
Hello all,
Is there a way to construct a tuple of the types that need to be passed to a
struct or class's constructor?
I tried using ParameterTypeTuple either on the class or its constructor:
ParameterTypeTuple!A
or
ParameterTypeTuple!(A.this)
... but neither works: the former gene