std::vector<int> ints;
// ... fill ints with random values
for(std::vector<int>::iterator it = ints.begin(); it != ints.end(); )
{
if(*it < 10)
{
*it = ints.back();
ints.pop_back();
continue;
}
it++;
}
This code is not working because when pop_back() is called, the it is invalidate. But I don't find any doc talking about invalidation of iterators in std::vector:pop_back().
Do you have some links about that?