boost::bimap for enum
问题 I'm trying to create a simple bi-directional lookup facility for enums in C++. I have one-way lookup working fine... enum MyEnum { One, Two, Three }; const boost::unordered_map<MyEnum,std::string> MyEnumMap = map_list_of (One, "One") (Two, "Two") (Three, "Three"); and then doing a look via MyEnumMap.at(One) That works but it only allows for lookups based on key. I'd like to use a bi-directional lookup container such as boost:bimap to allow for easy reverse lookups based on value as well as