Template mixin identifier as template alias parameter

Jack Applegame japplegame at gmail.com
Sun Nov 11 03:49:54 PST 2012


On Sunday, 11 November 2012 at 10:36:42 UTC, Jacob Carlborg wrote:
> This won't work. The "node" template doesn't evaluate to a type 
> and you wouldn't use it as a mixin if it did.
>
But this is works! Why?

mixin template node() {
   alias int E;
   E prev, next;
}

struct list(alias N) {
   N.E head;
   N.E tail;
}

class A {
   mixin node L1;
   mixin node L2;
}

list!(A.L1) l1;
list!(A.L2) l2;




More information about the Digitalmars-d-learn mailing list