As other answers explain: MyEnum::SomethingElse syntax is MyEnum::SomethingElse valid for regular C ++ 98 lists if your compiler does not support them through non-standard extensions.
I personally do not like the ad enum MyEnum {A, B}; because the type name is missing when using enum values. This can lead to a name conflict in the current namespace.
Thus, the user must refer to the type name for each value of the enumeration. Example to avoid declaring A twice:
enum MyEnum {MyEnum_A, MyEnum_B}; void A(void) { MyEnum enumInstance = MyEnum_A; }
I prefer to use a specific namespace or structure. This allows you to reference enum values ββwith the latest C ++ style:
namespace MyEnum { enum Value {A,B}; } void A(void) { MyEnum::Value enumInstance = MyEnum::A }
Jonathan Nov 06 '15 at 10:48 2015-11-06 10:48
source share