iterator vs reverse_iterator

前端 未结 6 1567
暗喜
暗喜 2021-01-05 05:52

I\'m using std::map to store a lot of elements (pairs of elements) and I have a \"little\" doubt. What is more efficient to iterate all elements over my

6条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-05 06:18

    Does it really matter? these are the types of the micro optimizations you must try to avoid IMHO. Also, even if the iteration time changes for very large number of elements in the map, the fact that you are trying to iterate through all the elements of such a big map means that most probably you have chosen a wrong data structure.

提交回复
热议问题