Referring to alias parameters in a mixin template
aldanor via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Dec 16 17:49:12 PST 2014
On Wednesday, 17 December 2014 at 01:39:07 UTC, anonymous wrote:
> But if you want to avoid `p`, just do the substitution:
>
> mixin template makeProperty(T, string name, alias func) {
> mixin("enum %s = makeUnnamedProperty!(T,
> func);".format(name)); // or alias
> }
Thanks, that looks exactly like what I need -- I figured
something like this would compile, but I guess it's slightly
counterintuitive that you can access "T" and 'func" this way.
Wonder if this is doable within a single mixin template without
using makeUnnamedProperty?
More information about the Digitalmars-d-learn
mailing list