My thoughts & experiences with D so far, as a novice D coder
Nick Sabalausky
SeeWebsiteToContactMe at semitwist.com
Wed Mar 27 11:09:07 PDT 2013
On Wed, 27 Mar 2013 14:07:27 -0400
Nick Sabalausky <SeeWebsiteToContactMe at semitwist.com> wrote:
> On Wed, 27 Mar 2013 13:08:19 -0400
> >
> > I just tested it, it works on enum *strings*, but not enum *values*
> >
> > For example:
> >
> > import std.conv;
> >
> > enum X {
> > i, j, k
> > }
> >
> > void main()
> > {
> > X x = to!X("i"); // works!
> > x = to!X(1); // fails!
> > }
> >
>
> Works for me on 2.063 Win. Keep in mind:
>
> assert(cast(int)X.i == 0);
> assert(cast(int)X.j == 1);
>
I meant of course 2.062
More information about the Digitalmars-d
mailing list