Assume I've code like this:
namespace foo {
enum bar
{
fooBarA,
fooBarB
};
}
struct baz
{
// TODO: map "bar" in this struct to make valid:
bar returnSomething() { return fooBarA; }
};
// and also this:
void doSomething()
{
baz myBaz;
if( baz::fooBarA == myBaz.returnSomething() )
{ /* ... */ }
}
What kind of code could I put at the TODO section to make the rest valid? Some using or typedef?
PS: To avoid questions about the "why": The namespace is living in it's own header file and might be used by a few different classes that should agree on the values of fooBarA and fooBarB but also hide that they are based on foo as that's irrelevant for the guys using baz.
PPS: C++11 is allowed. Would enum class help?
PPPS: Other questions like using declaration with enum? handle the case where the enum is in a class and not directly in a namespace.