enum editing

Simen Kjaeraas simen.kjaras at gmail.com
Tue Jun 11 13:00:08 PDT 2013


On 2013-06-11, 21:52, Seany wrote:

> Hello
>
> i read here that enums, once initialized, are constants :
> http://ddili.org/ders/d.en/enum.html
>
> However, i need a method, if possible, to dynamically (cexecution time)  
> definition of enums, and updating them.
>
> anyidea how that can be done? using const and/or inout, and passing an  
> array / tuple to a function?

So you're saying you need something like this?

struct MyEnum {
     int value;
     static MyEnum a(0);
     static MyEnum b(1);
}

void foo( ) {
    MyEnum.b = MyEnum(4);
}

-- 
Simen


More information about the Digitalmars-d mailing list