Overriding to!string on enum types
"Nordlöw" via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Sep 2 05:54:53 PDT 2014
Is it possible to override the behaviour of to!string(x) when x
is an enum. I'm asking because this
enum CxxRefQualifier
{
none,
normalRef,
rvalueRef
}
string toString(CxxRefQualifier refQ) @safe pure nothrow
{
final switch (refQ)
{
case CxxRefQualifier.none: return "";
case CxxRefQualifier.normalRef: return "&";
case CxxRefQualifier.rvalueRef: return "&&";
}
}
doesn't affect behaviour of to!string(x) when x is an instance of
CxxRefQualifier.
More information about the Digitalmars-d-learn
mailing list