c++ - Anything available implemented like Loki's AssocVector but with the functionality of Boost's Bimap? -
i wonder if aware of library code has performance characteristics provided loki's assocvector (locality of reference of elements, lower per-element memory overhead compared map) boost's bimap functionality (able query map both sides of relation)?
or using sorted std::vector of std::pairs , adding functionality lookup vector using either element of pair key way forward?
it depends on want fast. loki::assocvector
has o(n) insert , delete, while boost::bimap
has o(1) when use hash tables. if can live o(n) operations on 1 "view" of data structure , o(lg n) on other, proposed solution work fine , take little memory. may fast small data sets, if operations on 1 view dominate.
you may consider using boost.intrusive or boost::bimap
specialized allocators.
Comments
Post a Comment