reflective enums

Kevin Bealer kevinbealer at gmail.com
Fri Feb 16 09:14:55 PST 2007


== Quote from janderson (askme at me.com)'s article
> Kevin Bealer wrote:
> > int main(char[][] args)
> > {
> >     alias Enum!("start, middle, end=10, ps, pps") PState;
> >
> >     int p = PState.middle;
> >
> >     writefln("p is %s, with name %s\n", p, PState.getString(p));
> >
> >     PState P;
> >     foreach(v; P) {
> >         writefln("Enum %s has name=%s", v, PState.getString(v));
> >     }
> >
> >     return 0;
> > }
> Nice one man!
> -Joel

Thanks!  I should say as a formality, I release all this into the public domain etc.

Kevin



More information about the Digitalmars-d mailing list