Is there a way to associate a string from a text file with an enum value?
The problem is: I have a few enum values stored as string in a text file which I read on
You can calculate the hash of the string and then use this:
template E map_hash(H const key, std::initializer_list> const il) { auto const i( std::find_if(il.begin(), il.end(), [key](auto& p) { return p.first == key; } ) ); assert(i != il.end()); return i->second; }