Is it safe to declare a class that accepts both unscoped enum and its underlying type as an explicit constructor?
enum category : int {
a, b
}
struct foo {
explicit foo(category c) {} // #1
explicit foo(int x) {} // #2
};
foo f1(3); // #2 is called
foo f2(a); // #1 is called
foo f3((a)); // #1 is called
I know that using scoped enum is preferred, but I just wonder that does the standard guarantees that the above is well-overloaded?