How to test templates for equality?

Uranuz via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jul 5 22:55:04 PDT 2014


> template isMyInstanceOf(alias Templ, alias Inst)
> {
>     alias Args = ???; //I don't have idea how to get it
>
>     enum bool isMyInstanceOf = __traits(isSame, Templ!(Args), 
> Inst);
> }
>
> Do you have any idea how to solve this? May be standad library 
> could be improved with such type of test for template instance?

Is new compiler trait is needed for solving this like
alias Args = __traits(getTemplateArgumentList, Inst);

or it could be solved with existing tools?


More information about the Digitalmars-d-learn mailing list