我的应用程序中有一个 C++ STL 对象列表,它是在启动时构建的,此后从未更改过;指向同一列表节点的两个独立迭代器是否总是比较相等?
最佳答案
是的。前向迭代器的要求之一是:
C++11 22.4.5/6: If
a
andb
are both dereferenceable, thena == b
if and only if*a
and*b
are bound to the same object.
标准容器上的所有迭代器(至少)是前向迭代器。
关于c++ - 比较 C++ STL 列表迭代器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13417236/