On Wed, 10 Dec 2014 14:32:12 +0000 Lemonfiend via Digitalmars-d-learn <[email protected]> wrote:
> > mixin template S(alias fld) if (is(typeof(fld) == enum))
> > {
> > import std.conv : to;
> > enum s = to!string(fld); // "BAR"
> > // or this:
> > //import std.traits : fullyQualifiedName;
> > //enum s = to!string(fullyQualifiedName!(fld)); //
> > "test.Foo.BAR"
> > }
> >
> > enum Foo { BAR, }
> >
> > void main()
> > {
> > mixin S!(Foo.BAR);
> > }
>
> Perfect, thanks.
p.s. be careful with imports, as they will go to the same scope as `s`.
this may or may not be important.
signature.asc
Description: PGP signature
