mixin template can't contain statements: workaround?

Timothee Cour via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Mar 14 18:20:47 PDT 2015


Why can't we allow mixin templates to contain statements, as is the case
for regular mixins?
Is there a workaround?

here's a dummy example:

template mixin Foo{
 //some statement, eg: 'return;'
}

void fun(){
  mixin Foo;
}

Note that I can do this with a regular mixin, but template mixins are
cleaner (esp in more complex examples).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20150314/487c5479/attachment.html>


More information about the Digitalmars-d-learn mailing list