Looping over all enum values

Mark Isaacson via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed May 28 13:19:44 PDT 2014


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.

I was able to loop over the underlying type when my enum was
integer-based, but I can't do that if the values are strings
(also that solution is quite hacky).

Perhaps there's a pattern involving __traits?


More information about the Digitalmars-d-learn mailing list