https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106392

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Benjamin Priour from comment #1)
> [[gnu::invalidate(swap)]] - Both containers should be invalidated. Name
> probably ill-chosen since swapping two lists invalidates nothing. 

Swapping doesn't invalidate iterators for any standard container.

I think the unordered containers might be too hard. I would start with
std::vector, as that will probably give the best return on investment of
effort.

> When invalidating a range, how to determine the "following" iterators, that
> should be invalidated, when we are not dealing with random iterators ?
> Is there even such a case in the standard library, where a method over a
> container without random iterators invalidates a range/ a subset of all
> iterators ?

erase(first, last) invalidates iterators in the erased range.

Reply via email to