Boost logo

Boost :

From: Alexander Grund (alexander.grund_at_[hidden])
Date: 2019-06-28 06:44:26


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.




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