Is anything available implemented as a Loki AssocVector, but with Boost Bimap functionality?

I wonder if anyone knows about any library code that has the performance characteristics provided by Loki AssocVector (locality of element references, less element overhead for an element compared to a map), but with Boost BiMap functionality (the ability to request display from both aspect ratio)?

Or would you use the sorted std :: vector from std :: pairs and adding functionality to search for the vector using any element of the pair, since the key will be a way forward?

+4
source share
1 answer

It really depends on what you want to do quickly. Loki::AssocVector has O (n) insert and delete, and boost::bimap has O (1) when you use it with hash tables. If you can work with O (n) operations on one “representation” of your data structure and O (lg n) on another, your proposed solution will work fine and will not have a small memory. This can be very fast for small data sets if operations on one view dominate.

You can also use Boost.Intrusive or boost::bimap with specialized distributors.

+1
source

All Articles