c# - Enum Parse C++ Or Analog -
in c# use code: enum computer_name_format { computernamenetbios, computernamednshostname, computernamednsdomain, computernamednsfullyqualified, computernamephysicalnetbios, computernamephysicaldnshostname, computernamephysicaldnsdomain, computernamephysicaldnsfullyqualified } string format = "computernamednsfullyqualified"; (computer_name_format)enum.parse(typeof(computer_name_format), format) how use in c++ ? there no such function in c or c++. can make std::map<std::string, computer_name_format> m that. fill map doing m["computernamenetbios"] = computernamenetbios; etc. use auto f = m.find(format); if (f != m.end()) { ... value in f.second ... }