tags:

views:

116

answers:

2

Possible Duplicate:
Is it possible to define enumalpha?

Is there any equivalent of Java Enum.valueOf(string) on C++?

+3  A: 

No, there isn't even the much simpler task of going the other way (enum to string), you'd need to write it yourself

Michael Mrozek
+2  A: 

There's no table of names generated by the compiler (unless you count debug information), but if you create one (or use e.g. doxygen which parses the source code and can output such lists in XML format) then you can use a dictionary of some type, such as std::map<string, int> to turn an identifier into its numeric value.

Ben Voigt