Enums in C++0x
This is good news for C++: Herb Sutter reports that in July the ISO C++ committee voted better enum support into the language.
It's all good, but the part that's affected me in the past is the scoping of enum values. Previously:
<p>class MyClass<br>{<br> enum BorderColor { Red, Green, Blue };<br>};</p>
The values Red, Green, and Blue were scoped to MyClass, not to BorderColor. So you couldn't say MyClass::BorderColor::Red, you had to say MyClass::Red. If your class has a lot of enums in it, they all get scoped to the class and this just gets messy.
Of course they can't just change the language without risking compatibility so the new syntax will look like:
<p>class MyClass<br>{<br> enum class BorderColor { Red, Green, Blue };<br>};</p>
I can live with that.
Check out the full details here.