How to check for instantiation of specific template?

Dicebot public at dicebot.lv
Fri Oct 11 06:24:11 PDT 2013


This is actually a very interesting question.

Usual approach is to use pattern matching on types but template 
instance symbol is not a type on its own, it is just a symbol. 
(with typeof == void)

My second guess was to check __traits(identifier, AliasParam) but 
it looks like for aliased instance (contrary to aliased template 
symbol) identifier is its mangled name.

I can't imagine really clean way to do it but comparing 
__traits(identifier) to that specific mangled name can be a 
reliable enough hack (better than stringof which has undefined 
format).


More information about the Digitalmars-d-learn mailing list