How to check whether a struct is templated?

Andre Pany via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jun 13 02:00:02 PDT 2017


Hi,

I loop through a structure during compile time and want to check 
whether a field of the structure is of type Nullable.

Therefore I use the TemplateOf traits which works for Nullable 
fields but raises an error for fields which are structures and 
not templated.

static if(is(T == struct) && __traits(isSame, TemplateOf!T, 
Nullable)){}
>> template std.traits.TemplateOf does not match any template 
>> declaration

I can not find a traits "isTemplateOf". Is there are workaround?

Kind regards
André


More information about the Digitalmars-d-learn mailing list