Search:
Forum
General C++ Programming
vector erase - invalidated iterator
vector erase - invalidated iterator
May 2, 2009 at 2:36pm UTC
danmar
(2)
I am confused by the text on the page:
http://www.cplusplus.com/reference/stl/vector/erase/
It says:
This invalidates all iterator and references to elements after position or first.
It says that iterators AFTER the erased iterator are invalidated.
So the erased iterator itself is not invalidated? That is confusing to me.
Can anybody confirm that erased iterators are still valid?
May 2, 2009 at 2:52pm UTC
Hammurabi
(399)
No, the erased iterator is not valid. It should say that it invalidates all iterators and references to position (or first) and after. It returns a valid iterator, though, which can possibly be the end iterator.
May 2, 2009 at 5:38pm UTC
danmar
(2)
Thank you!
Topic archived. No new replies allowed.
C++
Information
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs