int main()
{
std::vector<int> vec;
vector<int>::iterator iter;
for (int i = 0 ; i < 5 ; i++)
{
vec.push_back(i+10);
}
for (iter = vec.begin() ; iter != vec.end(); iter++)
{
if (*iter == 12 || *iter == 13)
{
vec.erase(iter);
}
}
for (iter = vec.begin() ; iter != vec.end(); iter++)
{
printf("%d", *iter);
}
return 0;
}
What happens to the iterator when it is incrementedin loop, after erasing 12?
Actually i want to understand the behaviour of the iterator when the element it is pointing to is deleted.