How to Mixin a Type List?

Simen kjaeraas simen.kjaras at gmail.com
Tue Jan 25 13:33:16 PST 2011


Nick <nick at example.com> wrote:

> Instead of mixing in type by type, is there a way to mixin a Type Tuple?  
> Some foreach Type mixin;
>
> Otherwise, I guess recursive templated inheritance with a single mixin  
> at each level should to the trick?

That would be the way to do it, yes:

template chainedMixin( alias head, tail... ) {
     mixin head;
     mixin chainedMixin!tail;
}

template chainedMixin( alias head ) {
     mixin head;
}

-- 
Simen


More information about the Digitalmars-d-learn mailing list