[LLVMdev] Iterator issue in BranchFolder::RemoveBlocksWithHash?
Stefanus Du Toit
sjdutoit at gmail.com
Tue May 27 15:00:21 PDT 2008
On 27-May-08, at 5:48 PM, Mike Stump wrote:
> 4 Effects: Invalidates iterators and references at or after the point
> of the erase.
>
>> In any event, I'm not arguing that this ought to work, just that the
>> (current) standard is badly worded.
>
> I think it was a bug in the original language standard. You can ask
> Howard, if you're curious.
There's a proposed resolution to fix this:
http://std.dkuug.dk/jtc1/sc22/wg21/docs/lwg-active.html#414
===
Proposed resolution:
In 23.2.4.3 [lib.vector.modifiers] paragraph 3, change "Invalidates
all the iterators and references after the point of the erase" to
"Invalidates iterators and references at or after the point of the
erase".
Rationale:
I believe this was essentially a typographical error, and that it was
taken for granted that erasing an element invalidates iterators that
point to it. The effects clause in question treats iterators and
references in parallel, and it would seem counterintuitive to say that
a reference to an erased value remains valid.
===
Stefanus
More information about the llvm-dev
mailing list