[LLVMdev] SmallPtrSet Iterator Behavior
Chris Lattner
sabre at nondot.org
Tue Dec 4 11:28:25 PST 2007
On Tue, 4 Dec 2007, David Greene wrote:
> What are the rules regarding iterator stability for SmallPtrSet?
> I'm running into a problem where erasing an element seems
> to invalidate iterators that are not pointing at the erased element.
Interesting question.
> 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?
-Chris
--
http://nondot.org/sabre/
http://llvm.org/
More information about the llvm-dev
mailing list