Iterator access performance for STL map vs. vector?

前端 未结 6 1472
星月不相逢
星月不相逢 2021-02-05 17:15

What is the performance difference between using an iterator to loop through an STL map, versus a vector? I\'d like to use the map key for insertion, deletion, and some accesses

6条回答
  •  抹茶落季
    2021-02-05 17:39

    Use map if you need fast way of access by the key. Otherwise use vector all the time unless some performance issues will be discovered with profiler.

提交回复
热议问题