Comparing default-constructed iterators with operator==

前端 未结 4 915
清歌不尽
清歌不尽 2021-01-02 03:21

Does the C++ Standard say I should be able to compare two default-constructed STL iterators for equality? Are default-constructed iterators equality-comparable?

I w

4条回答
  •  情话喂你
    2021-01-02 04:00

    This is going to change in C++14. [forward.iterators] 24.2.5p2 of N3936 says

    However, value-initialized iterators may be compared and shall compare equal to other value-initialized iterators of the same type.

提交回复
热议问题