Looping over all enum values

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed May 28 13:20:36 PDT 2014


On Wednesday, 28 May 2014 at 20:19:45 UTC, Mark Isaacson wrote:
> Is there a mechanism that allows you to loop over all of an
> enum's values? I've wanted to do so a couple times now for
> CTFE/mixin templates.

__traits(allMembers) on the enum can do it or this can help too 
http://dlang.org/phobos/std_traits.html#EnumMembers


More information about the Digitalmars-d-learn mailing list