"name" of enum members
bearophile
bearophileHUGS at lycos.com
Fri Feb 11 10:39:36 PST 2011
spir:
> To denote a member 'm' of an enum 'e', one needs to write "e.m". Is there a way
> to get back this "name"?
Is this good enough?
import std.stdio, std.conv;
enum TC { A, B, C }
void main() {
writeln(typeof(TC.A).stringof, ".", to!string(TC.A));
}
> A bit strange that '%s' does not produce the same string as to!string...
I agree, I have a bug report on this.
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list