Templated structs / variant values

Dicebot public at dicebot.lv
Tue Aug 20 03:43:39 PDT 2013


On Tuesday, 20 August 2013 at 06:42:47 UTC, Jacob Carlborg wrote:
> On 2013-08-20 01:51, Marek Janukowicz wrote:
>
>> Thanks, but how do I get the list of members that are of 
>> instantiated
>> Setting struct type? If I do it like this:
>>
>> alias type = typeof(__traits(getMember, this, s));
>>       if (is ( type == Setting))
>>
>> I get:
>>
>> Error: struct aa.Setting(T, string desc, T deflt) is used as a 
>> type
>
> That's a good question. There's probably some smart 
> template/is-expression syntax to strip out arguments and only 
> leaving Setting.

if(is(type == Setting!U, U...))


More information about the Digitalmars-d-learn mailing list