Constructing an enum using the members of an AliasSeq as enumerator names
Nordlöw via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Apr 27 03:49:54 PDT 2016
What's the easiest way to create an `enum` using the symbol names
of an `AliasSeq` as enumerator names?
That is, given
alias Types = AliasSeq!(byte, short, int);
we need some compile-time type-constructor `makeEnum` called as
alias E = makeEnum!Types;
that should be equivalent to
enum E { _byte, _short, _int }
I guess a `mixin` is the way to go here, right?
More information about the Digitalmars-d-learn
mailing list