For example, if I have:
enum SomeEnum { One, Two, Three };
and I want to be able to directly get the enumeration as an unsigned integer or a string, can I write a casting operator that would be capable of looking at the enumerated value and returning a suitable representation for it?
I know you can do this with classes, but I wasn’t sure if you could do it with enumerations.
Enumerations can be converted to an integer, you don’t even need a cast to do so. There’s no way to automatically convert it to a string however.
If you’re willing to do a string array in parallel you can easily index it with your enumeration; the only problem is that it can get out of sync if you’re not careful to modify both when you make a change.