On Wed, 27 Mar 2013 14:09:07 -0400, Nick Sabalausky <[email protected]> wrote:

On Wed, 27 Mar 2013 14:07:27 -0400
Nick Sabalausky <[email protected]> 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


Hah, I have not yet downloaded 2.062. It did not work in 2.061, not sure if that was a bug or it's a new feature.

anyway, that is good to know!

-Steve

Reply via email to