Referring to alias parameters in a mixin template

anonymous via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Dec 16 18:12:52 PST 2014


On Wednesday, 17 December 2014 at 01:49:14 UTC, aldanor wrote:
> Wonder if this is doable within a single mixin template without 
> using makeUnnamedProperty?

Sure, straight forward:

       mixin template makeProperty(T, string name, alias func) {
           mixin("T %s() @property { return func();
}".format(name));
       }


More information about the Digitalmars-d-learn mailing list