Enums are annoying.
The last point is the most annoying one for me. The defined constants are embedded in the namespace which surrounds the enum. So, for instance
enum Operation1 {
//...
ERROR
};
enum Operation2 {
//..
ERROR
};
does not compile, because the two ERROR constants collide.
The same goes for a enum constant and a namespace:
namespace Plugin {
enum Id {
SomePlugin
};
// ...
namespace SomePlugin {
// implementation of SomePlugin
}
}
and similar constelations.
Another consequence is, that it is not possible to import all constants of an enum with one using statement. Instead you need somethine like this
namespace MyEnum {
enum MyEnum {
// constants...
};
}
to be able to import the constants with a single using MyEnum.
Replacing a enum by a namespace with constants has some disadvantages:
So, nothing helps. Enums are a C heritage, so no wonder that it sucks. But you nevertheless need them. *shrug*