From: David Sankel (camior_at_[hidden])
Date: 2019-06-28 17:40:21
On Fri, Jun 28, 2019 at 2:44 AM Alexander Grund via Boost <
> Am 28.06.19 um 06:40 schrieb Gavin Lambert via Boost:
> > On 28/06/2019 16:12, David Sankel wrote:
> >> Many would prefer their PIMPL classes to not have an artificial
> >> empty/partially formed state because of the increased semantic
> >> complexity
> >> that implies.
> > Maybe, but that seems a bit daft to me.
> Agreed. The increased complexity doesn't exist if you consider a
> moved-from object as invalid. You can either have a raw nullptr or an
> empty unique_ptr or an unchanged shared_ptr. Neither of them will even
> add a single additional check to the code base. At the very maximum you
> need 1 more check in the destructor if your PIMPL is some kind of
> interface handle-like which cannot be freed if it is "null" (whatever
> this means for that). Example would be INVALID_HANDLE for files and such.
I get this, but the whole motivation for the "never empty guarantee" in
variant types equally applies to PIMPL types. The approach of embracing
partially formed data structures is consistent and has performance
benefits, but the benefits of not having these states shouldn't be ignored
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk