[LLVMdev] SmallPtrSet Iterator Behavior

David Greene dag at cray.com
Tue Dec 4 11:17:07 PST 2007

On Tuesday 04 December 2007 13:28, Chris Lattner wrote:

> > Specifically, the set is in small mode, I advance an iterator to the last
> > element in the set (not end(), but one before) and then erase the
> > second-to-last element.  I understand that the last element will replace
> Right, deleting an element will invalidate any iterators past it, just
> like a vector.  I don't know of a good solution to this that doesn't break
> the efficiency properties of smallset.  Do you?

What I've done is code up a version of erase() that returns an iterator
to the next element.  There still seem to be some problems that I'm
looking into.  This interface has the side benefit of being standard-library
compatible and can be used with standard algorithms.

If I get something working I'll check it in if there's interest.


More information about the llvm-dev mailing list