In a c++ class Defs
I have a public enum like enum services {1st_drink = 101, 2nd_drink = 105, seafood_outside = 200,......}
. I have about 200 keywords and each one is with a value. Now in another class sometest
I need to get specific keyword value. The keyword is like a variable in my code and I can only know the keyword after some processing. So what I want to do is like:
.......
std::string keyword = string1 + "_" + string2;
unsigned int a = Defs::keyword;
.......
But now when I try to do this, I get error "error C2039: 'keyword': is not a member of 'Defs'"
and "error C2440: '=': cannot convert from 'std::string' to 'const unsigned int '"
.
Now I try to fix the problem. I noticed that somebody asked a similar question before Get enum value by name but I don't want to use that solution since I have too many keywords. Any good idea to do this?