|
Boost : |
From: degski (degski_at_[hidden])
Date: 2019-06-27 07:40:50
On Thu, 27 Jun 2019 at 10:33, Gavin Lambert via Boost <boost_at_[hidden]>
wrote:
> On 27/06/2019 19:06, degski wrote:
> > Yes, but std::swap must also not invalidate any references, pointers,
> or
> > iterators referring to the elements of the containers being swapped,
> which
> > leaves the scope for throwing rather small [if at all possible].
>
> Are you sure about that?
>
> Perhaps it is a failure of my imagination (or I'm misunderstanding what
> you're saying), but that doesn't even seem possible.
>
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.
degski
-- @realdegski https://edition.cnn.com/interactive/2019/06/middleeast/saudi-teen-death-penalty-intl/ "Anyone who believes that exponential growth can go on forever in a finite world is either a madman or an economist" - Kenneth E. Boulding
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk