Get name of enum val at compile-time?

Nick Sabalausky a at a.a
Sun Jan 15 00:53:09 PST 2012

Is there a way to get the name of an enum value at compile-time?

For instance:

import std.stdio;
enum Foo { hello }
void main()

That prints "hello". But what I need is to get "hello" into a string at 

Of course, I could just manually write a ctfe-able "fooToString()", or 
implement something like std.typecons.defineEnum (which appears to be 
deprecated now). But I'm wondering if I'm overlooking a better solution.

More information about the Digitalmars-d-learn mailing list