About template template arguments syntax

bearophile bearophileHUGS at lycos.com
Sat Oct 1 19:20:36 PDT 2011


This little program is a reduction of code recently shown around here:


template Spam(T, alias P) { enum Spam = P!T; }
template Foo(T, Preds...) {
    enum bool Foo = Spam!(T, Preds[0]);
}
template Bar(T) { enum Bar = true; }
static assert(Foo!(int, Bar));
void main() {}


Do you know why the P argument of Spam needs "alias" before?
The type tuple Preds of Foo doesn't need an "alias" before.

Isn't it possible to remove the need to use such "alias" for template template arguments in D? (This is a question I've had to ask since a lot of time).

Bye and thank you,
bearophile


More information about the Digitalmars-d-learn mailing list