什么是 prev(X)
如果X
是迭代器 S.begin()
对于一些订购的容器 S
,例如S
是 set
?我原以为它会变成 S.end()
,但这似乎不正确。
最佳答案
这会导致未定义的行为。 来自 cppreference.com :
The behavior is undefined if the specified sequence of increments or decrements would require that a non-incrementable iterator (such as the past-the-end iterator) is incremented, or that a non-decrementable iterator (such as the front iterator or the singular iterator) is decremented.
关于c++ - 如果 X 是某个有序容器 S 的迭代器 S.begin(),则 prev(X) 是什么,例如S是集合?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54956041/