Reputation: 375
enum class A
{
ORANGE,
APPLE
};
...
{// workspace brackets
if(B == ORANGE){...} // use it like this
}// end of workspace
instead of keep using B==A::ORANGE
, what can I do to make it like B==ORANGE
within my workspace such as using namespace std
?
Upvotes: 0
Views: 48
Reputation: 4727
You can only do this in c++ 20 onwards with
using enum A
enum class foo {
a,
b,
c
};
int main() {
{
using enum foo;
foo f = b;
}
{
//foo f = b; // does not compile
}
}
Upvotes: 2