Yeah, no simple way to have it.
But on the sunny side, you can overload operator<< for the enum
Code:
#include <iostream>
#include <cassert>
enum X { a, b };
std::ostream& operator<<(std::ostream& os, X x)
{
switch (x) {
case a: return os << "a";
case b: return os << "b";
}
assert(false && "wrong enum value");
}
int main()
{
X x = a;
std::cout << a;
}
Side question: doesn't the standard say that any two enum values ORed together are also valid values for the enum variable (e.g when used as bitfields)?