If an enumeration is defined inside a class, the best you can do is bring the class into its own scope and simply use class_name::value or define the typedef of the class. In C ++ 03, enum values are part of the scope (which in your case is a class). In C ++ 0x / 11, you can assign values with an enumeration name:
namespace first { namespace second { struct enclosing { enum the_enum { one_value, another }; } }} using first::second::enclosing; typedef first::second::enclosing the_enclosing; assert( enclosing::one_value != the_enclosing::another );
In the future, your use will be correct (C ++ 11):
typedef first::second::enclosing::the_enum my_enum; assert( my_enum::one_value != my_enum::another );
David Rodríguez - dribeas Jul 19 '10 at 21:19 2010-07-19 21:19
source share