Boost logo

Boost :

From: Gavin Lambert (boost_at_[hidden])
Date: 2019-06-27 07:50:03


On 27/06/2019 19:40, degski wrote:
> I'm just reading (https://en.cppreference.com/w/cpp/container/list/list):
> "After container move construction (overload (6)), references, pointers,
> and iterators (other than the end iterator) to other remain valid, but
> refer to elements that are now in *this. The current standard makes this
> guarantee via the blanket statement in
> §23.2.1[container.requirements.general]/12, and a more direct guarantee is
> under consideration via LWG 2321
> <http://www.open-std.org/JTC1/SC22/WG21/docs/lwg-active.html#2321>."
>
> Possibly I'm reading it wrongly, please set me right in that case. LWG 2321
> <http://www.open-std.org/JTC1/SC22/WG21/docs/lwg-active.html#2321> goes on
> about std::swap as well.

Hmm. I read that the same way too. I wonder how that works with
checked/debug/safe iterators that contain a reference to the container
that they were from -- presumably after a swap they're now pointing at
the second container's elements, but still have a reference to the first
container? Unless it can somehow swap what container all the iterators
point at too, without touching each one individually.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk