What is the purpose of anonymous enum
declarations such as:
enum { color = 1 };
Why not just declare int color = 1
One use of this is when you're doing template metaprogramming, because enum objects are not lvalues, while static const
members are. It also used to be a common workaround for compilers that didn't let you initialize static integral constants in the class definition. This is explained in another question.