Hello,
It would be nice to have a refactoring option to convert an unscoped enumeration to a C++11 scoped enumeration, including all its referred enumerators.
As this is something that is done quite frequently in our code base, it would be a handy feature saving us from the tedious task to hunt down all referred enumerators and add their scope manually. A naive search-and-replace is too error prone.
enum Color { red, green, blue };
Color col = red;
switch(col)
{
case red : std::cout << "red\n"; break;
case green: std::cout << "green\n"; break;
case blue : std::cout << "blue\n"; break;
}
After refactoring becomes:
enum class Color { red, green, blue };
Color col = Color::red;
switch(col)
{
case Color::red : std::cout << "red\n"; break;
case Color::green: std::cout << "green\n"; break;
case Color::blue : std::cout << "blue\n"; break;
}