Fun with allMembers

Shin Fujishiro rsinfu at gmail.com
Thu May 14 12:38:53 PDT 2009


"Denis Koroskin" <2korden at gmail.com> wrote:
> Great, now the following is possible with your code:
> 
> string toString(Enum)(Enum e) if (is(Enum == enum))
> {
>     return enumToString(e);
> }
> 
> assert("RED" == toString(c));
> 
> // and, once implemented:
> assert("RED" == c.toString());
> 
> Although returning "Color.RED" might be better, but it's really not a problem.
> Is there any way your code could be contributed to Phobos?

Sure. I think it can be merged into std.conv.to.



More information about the Digitalmars-d mailing list