I'm looking for a hacky kind of solution to the following problem: GCC 4.4+ accepts the following c++0x code:
enum class my_enum
{
value1,
value2
};
Which allows the use like this:
my_enum e = my_enum::value1;
with all the bells and whistles this brings. I would like to make this code compatible with MSVC 2010, to the effect that the usage syntax does not change. I already pondered on this before here, and the accepted answer works, but the need for the two different names fo the enum and the enum values is killing the compatibility of the two approaches. This makes it of course unusable to replace the C++0x code as is. I wondered if some #undef
and #define
trickery could work around this, allowing me to use enum class
-like syntax (perhaps without the strict type safety etc.), but at least the same syntax. Thanks!