c++types

Does C++ have a bijective map type?


Does C++ have anything which behaves like std::map<T1, T2>, but permitting not only looking for a T1 value to find its associated T2 value, but also to look for a particular T2 value to find its associated T1 value? (Which would mean values on both sides need to be unique.)


Solution

  • boost::bimap is a data structure that behaves exactly the way you describe.