enum to string
a at a.a
Tue Mar 10 18:54:32 PDT 2009
"MIURA Masahiro" <echochamber at gmail.com> wrote in message
news:gp730i$30e8$1 at digitalmars.com...
> In D2:
> enum Shape: string
> Square = "Square",
> Circle = "Circle",
> void main()
> assert(cast(string) Shape.Square == "Square");
So there's no built-in way to do this with compile-time reflection?
I suppose I could work around it by creating a mixin that automatically
generates both the enum and an enum->string routine.
More information about the Digitalmars-d-learn