Request: nested enums
JS
js.mdnq at gmail.com
Mon Jul 15 06:47:20 PDT 2013
Here is a better example that can actually be implemented but not
pretty:
final immutable struct Msg
{
immutable int Foo = 0;
immutable int Bar = 1;
final immutable struct Type
{
immutable int Error = 10000;
immutable int Ok = 10001;
}
}
Here type is not necessarily a logical subtype of Msg but better
stated as Msg.Type.Error rather than MsgType.Error.
If a flag distribution was used, we could do Msg.Foo ||
Msg.Type.Error.
In any case generating such a structure is a bit of a pain
compared to a normal enum.
More information about the Digitalmars-d
mailing list