UDAs on enum members

ketmar via Digitalmars-d digitalmars-d at puremagic.com
Wed Jul 13 05:54:19 PDT 2016


On Wednesday, 13 July 2016 at 12:40:50 UTC, Chris Wright wrote:
> Why not use a free function?

'cause OP wants enum ctor to be called like this:

MyEnum.create(somedata);


2OP: to create enum from string, you can use `std.conv.to`:
   enum E { A, B, C }
   E v = to!E("A");

still not a ctor, but i think that it looks clear enough.


More information about the Digitalmars-d mailing list