On Saturday, 13 October 2012 at 15:39:24 UTC, Tommi wrote:
enum MyEnum
{
    init = -123,
    first = 0,
    second = 1
}

void main()
{
    static assert(MyEnum.min == -123);

    MyEnum me;

    final switch (me)
    {
    case MyEnum.first:  break;
    case MyEnum.second: break;
    case MyEnum.init: // I'm forced to specify init case too
    }
}


Also, a quick question:

Why in case its need to write name of the enum?

     case first:  break;
     case second: break;
     case init: // I'm forced to specify init case too

looks better for me.

Reply via email to