Searching in open-source projects (no-boost), I found a STL-like container bimap here where implements a bidirectional-map. And there is multimap in standard C++ libraries.
- But I want to know, Is there any effort to implement a “STL-like
Bidirectional Multimap” ? - Or, How can we combine existing containers to make that data
structure?
Note: A simple solution is using two multimap s in bidirectional way. But it has not good performance. Because, for each insert/remove/find operation we should perform them twice. In addition it allocates more memory.
Note II: The boost.bimap is a good suggest from HostileFork and KerrekSB, And I will use it if there is no way. But before it I need find a non-boost and small size class library.
Boost.bimap lets you customize the type of collection for both values; both can be non-unique.