I have a good understanding of how the C++ ‘using’ declaration and directive work. However, I’m stumped on this… Maybe it’s not possible? I want to avoid having to quality my enum variables:
namespace Foo {
class MyClass {
public:
enum MyEnum { X, Y, Z };
}
}
And now, from outside that namespace, I would like to be able to do things like:
using Foo::MyClass.MyEnum;
MyEnum letter = MyEnum::x;
But apparently that’s not the way to do it? I’m betting this is possible, but my notation is wrong… I also tried using Foo::MyClass::MyEnum, but then the compiler thinks Foo::MyClass is a namespace.
Added: As you can see, it becomes annoying having to fully declare everything…
Foo::MyClass::MyEnum value = Foo::MyClass::X;
C++03 does not support fully qualifying
enumtypes, but it’s an MSVC extension. C++0x will make this Standard, and I believe that you canusinganenumin C++0x. However, in C++03, I don’t believe that your problem can be solved.