After newVector.insert(iter, 5)
, iter
is not valid. That’s why insert
returns an iterator. Your code should be
iter = newVector.insert(iter, 5);
1
solved “Vector erase iterator outside range” error
After newVector.insert(iter, 5)
, iter
is not valid. That’s why insert
returns an iterator. Your code should be
iter = newVector.insert(iter, 5);
1
solved “Vector erase iterator outside range” error