Hello,

To denote a member 'm' of an enum 'e', one needs to write "e.m". Is there a way to get back this "name"?
Here are my best trials:

unittest {
    enum TC : uint {i=1};
    writefln("%s   %s   %s", TC.i, TC.i.stringof, to!string(TC.i));
}
==>
1   cast(TC)1u   i

A bit strange that '%s' does not produce the same string as to!string... Anyway, the only solution seems to be parsing the result of stringof to get what's inside (), then compose it with the result of to!string: a bit too much of a burden, what do you think?
Hints welcome :-)

Thank you for reading,
Denis
--
_________________
vita es estrany
spir.wikidot.com

Reply via email to