$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: David Sankel (camior_at_[hidden])
Date: 2019-06-28 04:12:36
On Thu, Jun 27, 2019, 7:09 PM Gavin Lambert via Boost <boost_at_[hidden]>
wrote:
> On 28/06/2019 07:57, David Sankel wrote:
> >> If a class uses PIMPL and does a move, isn't that just a pointer swap
> >> which cannot throw? Or would that be implemented as another allocation
> >> in the moved-from class? I can't imagine why.
> >
> > Move assignment is fine. Move construction is where allocation would need
> > to happen so the "moved from" object stays in a valid state.
>
> I'm not sure why. Both unique_ptr and shared_ptr (one of which is
> usually used as the "guts" of pimpl, depending on whether you want it to
> be reference-semantics-copyable or not) do not need to allocate on move
> construction (and are noexcept) -- they just leave the moved-from object
> empty.
>
Many would prefer their PIMPL classes to not have an artificial
empty/partially formed state because of the increased semantic complexity
that implies.
>