Are const_iterators faster?

后端 未结 11 1863
挽巷
挽巷 2020-11-30 02:04

Our coding guidelines prefer const_iterator, because they are a little faster compared to a normal iterator. It seems like the compiler optimizes t

11条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-30 02:21

    Our coding guidelines say prefer const_iterator

    Have a look at this article by Scott Meyers here. He explains why one should prefer iterator over const_iterator.

提交回复
热议问题