Can you tell if an template alias parameter is of a specific template?

Hakan Aras hakan.aras at live.at
Fri Aug 3 19:10:45 UTC 2018


I don't think you can distinguish between entities evaluated 
through different templates. TemplateOf will paradoxically not 
work on pure templates of the form "template X() {}" only things 
like template functions and template structs. isSame, is, and 
isInstanceOf will only work on the fully evaluated type or alias 
(pred) not the template that was used to evaluate it.

If I understood your usecase correctly, you could do something 
like this though:

https://run.dlang.io/is/VwZoAx

That is use an enum as a template parameter instead of wrapping 
the predicate in a template.


More information about the Digitalmars-d-learn mailing list