Suppose we have some named enums:
enum MyEnum { FOO, BAR = 0x50 };
What I googled for is a script (any language) that scans all
#include #include #define IDMAP(x) (x,#x) std::map enToStr; class mapEnumtoString { public: mapEnumtoString(){ } mapEnumtoString& operator()(int i,std::string str) { enToStr[i] = str; return *this; } public: std::string operator [] (int i) { return enToStr[i]; } }; mapEnumtoString k; mapEnumtoString& init() { return k; } int main() { init() IDMAP(1) IDMAP(2) IDMAP(3) IDMAP(4) IDMAP(5); std::cout<