aliases and templates

Trass3r mrmocool at gmx.de
Thu Jan 22 07:56:26 PST 2009


I already read about "Implicit Template Properties":
If a template has exactly one member in it, and the name of that member 
is the same as the template name, that member is assumed to be referred 
to in a template instantiation

I guess the following is something similar, but why are aliases used here?

template ParameterTypeTuple(dg)
{
     static if (is(dg P == function))
	alias P ParameterTypeTuple;
     else static if (is(dg P == delegate))
	alias ParameterTypeTuple!(P) ParameterTypeTuple;
     else static if (is(dg P == P*))
	alias ParameterTypeTuple!(P) ParameterTypeTuple;
     else
	static assert(0, "argument has no parameters");
}


More information about the Digitalmars-d-learn mailing list