Is there a way to use some kind of using directive to directly access members of an enum class type?
enum class Foo {
Foo1,
Foo2,
...
};
int main() {
auto foo = Foo::Foo1;
??? // magic command to make the lines below work
auto foo1 = Foo1;
auto foo2 = Foo2;
...
}
I know I can do it with namespaces, so an alternative would be to use a namespace and a traditional enum:
namespace Foo {
enum FooEnum {
Foo1,
Foo2,
...
};
}
int main() {
auto foo = Foo::Foo1;
using namespace Foo;
auto foo1 = Foo1;
auto foo2 = Foo2;
...
}
However, I would like to keep the advantages of the class enums (like type safety, etc).