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 ... }


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -