Why is it better to use '!=" than '<' in a vector loop? (C++)

后端 未结 7 1392
没有蜡笔的小新
没有蜡笔的小新 2021-01-02 04:53

Why is it better to use \'!=\" than \'<\' in a vector loop? I just can\'t see the difference.

7条回答
  •  孤城傲影
    2021-01-02 05:33

    Because you're using iterators, and it'll make the loop look exactly the same as other containers, should you choose to switch to other container types, such as set, list, unordered_set, etc. where < has no meaning.

提交回复
热议问题