On Friday, 4 April 2014 at 18:02:02 UTC, Walter Bright wrote:
Here's one:

  enum Index { A, B, C }
  T[Index.max] array; // Error: Index.max is not an int
  ...
  array[B] = t;   // Error: B is not an int


And another:

  array[A + 1] = t; // Error: incompatible types Index and int

And another:

  enum Mask { A=1,B=4 }

  Mask m = A | B;   // Error: incompatible operator | for enum

and on it goes. These are routine and normal uses of enums.

It's trivial to write an EnumMemberValue template that convert the enum member to its underlying value at compile time. Also, if I remember correctly, min and max are terribly broken for enums in the first place.

Reply via email to