Templated structs / variant values

Marek Janukowicz marek at janukowicz.net
Tue Aug 20 04:24:07 PDT 2013


Dicebot 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...))

This is not enough for me - I have many instantiations of Setting struct 
template and I need all of them, regardless of parameters they were 
instantiated with.

-- 
Marek Janukowicz


More information about the Digitalmars-d-learn mailing list