C ++ Java equivalent Enum.valueOf ()

Possible duplicate:
Can enumalpha be identified?

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

+3
source share
2 answers

There is no table of names generated by the compiler (if you do not calculate debugging information), but if you create one (or use, for example, doxygen , which analyzes the source code and can output such lists in XML format ), then you can use a dictionary of some sort either type, for example std::map<string, int>, to turn an identifier into a numerical value.

+3
source

, ( ),

+3

Source: https://habr.com/ru/post/1741625/


All Articles