I've been doing a lot of C# programming lately and now going back to C++ I am missing a few language features, though I am wondering if it would be possible to do something similar.
In C# elements of an enum are accessed using the name of the enum as a prefix, like this…
enum TypeA { one, two, three };
TypeA varA = TypeA.one;
In C++ that is not the case, the elements are accessed directly by its name, without prefix—which also leads to duplication problems, if enum elements have the same name.
I am wondering, however, if there's a way or trick to do the same thing in C++, to have code that looks somewhat like this…
typedef enum { one, two, three } TypeA;
TypeA varA = TypeA.one;
It would be really helpful for me to have the ability to really create enums that allow me to duplicate names and that are then accessed using the respective prefix.
Ideas, anyone?