How to test templates for equality?

Peter Alexander via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jun 30 22:51:16 PDT 2014


template Foo(T...) {}
template Bar(T...) {}

template isFoo(alias F)
{
	enum isFoo = __traits(isSame, F, Foo);
}

pragma(msg, isFoo!Foo); // true
pragma(msg, isFoo!Bar); // false


More information about the Digitalmars-d-learn mailing list