Change the pos
iterator into an index instead, and use that.
size_t index = pos - begin();
// do resize
pos = begin() + index;
If you're worried about iterators invalidating in general, don't. It's unavoidable, at least in this style of dynamic array, and std::vector
works exactly the same.
Peter Alexander
2010-10-03 21:06:37