How can i get the value from an enum when passed to a function? For example i have the following code:

import std.stdio;

enum E : string
{
        one = "1",
        two = "2",
}

void print(E e)
{
        writefln("%s", e);
}

void main(string[] args)
{
        print(E.one);
}

The output is 'one'. How can i get at the value '1' instead. I could change the print function to accept a string like this:

void print(string e)
{
        writefln("%s", e);
}

but i lose the constraint of using an enum for the values.

Reply via email to