You could do this with boost::bimap from the boost library. Eg.
boost::bimap<int, std::string> map;
map.insert({1, "one"});
map.insert({2, "two"});
std::cout << map.left.at(1) << "\n"; // "one"
std::cout << map.right.at("two") << "\n"; // 2