Can end() be a costly operation for stl containers

后端 未结 7 1955
囚心锁ツ
囚心锁ツ 2020-12-16 12:16

On https://doc-snapshots.qt.io/qtcreator-extending/coding-style.html it is recommended to write for loops like the following:

Container::iterator end = large         


        
7条回答
  •  無奈伤痛
    2020-12-16 12:28

    In fact, the end() method is inline. The 2nd not call it every time, I don't think end() gives any performance lag.

提交回复
热议问题