Is there already some std::vector based set/map implementation?

前端 未结 6 1630
囚心锁ツ
囚心锁ツ 2021-02-08 07:43

For small sets or maps, it\'s usually much faster to just use a sorted vector, instead of the tree-based set/map - especially for something like 5-10 e

6条回答
  •  忘掉有多难
    2021-02-08 08:44

    I just stumbled upon your question, hope its not too late.

    I recommend a great (open source) library named Loki. It has a vector based implementation of an associative container that is a drop-in replacement for std::map, called AssocVector.

    It offers better performance for accessing elements (and worst performance for insertions/deletions).

    The library was written by Andrei Alexandrescu author of Modern C++ Design.

    It also contains some other really nifty stuff.

提交回复
热议问题