T
toton
Hi,
I have some enum (enumeration ) defined in some namespace, not inside
class. How to use the enum constant's in some other namespace without
using the whole namespace.
To say in little detail, the enum is declared as,
namespace test{
enum MyEnum{
VALUE1,VALUE2
};
}
now in another namespace,
using test::MyEnum; //It gets myenum.
MyEnum e = VALUE1; //It doesnt get the value.
One solution is to have using test::VALUE1;
but as such enum const's are huge in number it is not possible to use
all of them seperately.
Other way is to have using namespace test; But the namespace has many
other things and I want to avoid such statement if possible.
It looks the enum constants are 'free' inside the namespace, not
guarded by the MyEnum.
Anyway to deal with it? Is it possible to enclose them inside a dummy
class and use them ?
I have some enum (enumeration ) defined in some namespace, not inside
class. How to use the enum constant's in some other namespace without
using the whole namespace.
To say in little detail, the enum is declared as,
namespace test{
enum MyEnum{
VALUE1,VALUE2
};
}
now in another namespace,
using test::MyEnum; //It gets myenum.
MyEnum e = VALUE1; //It doesnt get the value.
One solution is to have using test::VALUE1;
but as such enum const's are huge in number it is not possible to use
all of them seperately.
Other way is to have using namespace test; But the namespace has many
other things and I want to avoid such statement if possible.
It looks the enum constants are 'free' inside the namespace, not
guarded by the MyEnum.
Anyway to deal with it? Is it possible to enclose them inside a dummy
class and use them ?