On Mon, Feb 04, 2002 at 02:36:47PM +1000, Allan Rae wrote:

> I won't have time to look at this before next week.  It is however
> related to the iterator usage in that function (as reported in
> Michael's Purify report).  We have a vector iterator, erase what that
> iterator pointed at and then expect it to point to the next item in
> the vector after the erase.  I don't think this is always valid so it

True.

> should probably just need something like:
>       iterator temp = iter->next();
>       iter->erase();
>       iter = temp;
> Maybe.  Maybe I need to reread how vector iterators are supposed to
> work?

This is not valid either.
A valid code is:

      int i = iter - vec.begin();
      iter->erase();
      iter = vec.begin() + i;

Reply via email to