Phobos' std.conv.to-conversion from enum to string doesn't scale beyond hundreds of enumerators

Timoses timosesu at gmail.com
Sun Jun 24 23:53:09 UTC 2018


On Sunday, 24 June 2018 at 23:34:49 UTC, Per Nordlöw wrote:
>
> Provided that
>
>     __traits(allMembers, E)
>
> is a cheap operation as it's called once for every enumerator. 
> I could get it out of the loop; if I do as
>
>     @property string toString() @safe pure nothrow @nogc
>     {
>         final switch (_enum)
>         {
>             enum members = __traits(allMembers, E);

enum members = [_traits(allMembers, E)];

seems to work



More information about the Digitalmars-d mailing list