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

前端 未结 6 1526
囚心锁ツ
囚心锁ツ 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:29

    If you can't find anything suitable, I would just wrap a std::vector to do sort() on insert, and implement find() using lower_bound(). It should be straight forward, and just as efficient as a custom solution.

提交回复
热议问题