[LLVMdev] Question about SparseMultiSet

Micah Villmow micah.villmow at smachines.com
Sat Aug 3 21:09:03 PDT 2013


Thanks for the clarification.

Micah

From: Michael Ilseman [mailto:milseman at apple.com]
Sent: Friday, August 02, 2013 10:41 AM
To: Micah Villmow
Cc: llvmdev at cs.uiuc.edu
Subject: Re: [LLVMdev] Question about SparseMultiSet

Sorry for the late reply.

On Jul 26, 2013, at 3:26 PM, Micah Villmow <micah.villmow at smachines.com<mailto:micah.villmow at smachines.com>> wrote:


Does anyone know if an insertion invalidates the end() iterator? The documentation  in ADT/SparseMultiSet.h mentions that removal only invalidates the iterator of the object being removed, but nothing on insertion. My understanding from reading the code seems to me that it doesn't invalidate it, but I want to make sure as I'm not 100% sure here.

You are correct.

>From the documentation:
  The doubly linked list is implemented circular in Prev indices, and INVALID-terminated in Next indices.

Insertion will modify the Next index of the tail of the list for that key, and assigning it the index of the newly inserted entry.

Of course, if you had walked an iterator off the end of one of these lists (and thus, it's INVALID/equal to end()), that iterator will not be magically updated to point to the newly inserted value. This behavior is consistent with other set-like data structures.

Feel free to ask me if you have any questions.




Thanks,
Micah
_______________________________________________
LLVM Developers mailing list
LLVMdev at cs.uiuc.edu<mailto:LLVMdev at cs.uiuc.edu>         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130804/c6043ae2/attachment.html>


More information about the llvm-dev mailing list