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. Thanks, Micah -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130726/011a015f/attachment.html>
Sorry for the late reply. On Jul 26, 2013, at 3:26 PM, Micah Villmow <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 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/20130802/62c6759a/attachment.html>
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>
Seemingly Similar Threads
- [LLVMdev] Question about SparseMultiSet
- [LLVMdev] Null pointers with a non-0 representation
- [LLVMdev] Null pointers with a non-0 representation
- [LLVMdev] Can I add GlobalVariable in MachineFunctionPass ?
- [LLVMdev] Heads up, I've backed out significant amounts of the multiple address space conversion changes