Consider the following:
I would like to write something like this in the Foo function:Code:struct SColors { enum enColors { red, green,blue }; }; void Foo(SColors::enColor Color) { switch(Color) { case SColors::red: /*...*/ break; case SColors::green: /*...*/ break; case SColors::blue: /*...*/ break; default: assert(false); break; } }
I know that I can apply "using" to each distinct enumeration value, but I'm too lazy to do that. So is there a way to apply "using" to all enumeration values with a single statement (although it may not be good practice)?Code:void Foo(SColors::enColor Color) { using SColors::enColors; // Want to "use" all color enumeration values! switch(Color) { case red: /*...*/ break; case green: /*...*/ break; case blue: /*...*/ break; default: assert(false); break; } }




Reply With Quote