Subject: Re: [boost] Pimpl Again?
From: Rainer Deyke (rainerd_at_[hidden])
Date: 2016-06-09 08:19:04
On 08.06.2016 23:57, Emil Dotchevski wrote:
> On Wed, Jun 8, 2016 at 2:29 PM Rainer Deyke <rainerd_at_[hidden]> wrote:
>> 3. I want a class to have value semantics, but use a copy-on-write
>> implementation behind the scenes.
> Pimpl is not about semantics, it's about reducing physical coupling. It's
> not about the pointer pointing at the private implementation object (which,
> being private, is an implementation detail anyway), it's about the private
> implementation *type* being left incomplete.
Pimpl is a technique where the implementation of a class is moved to a
separate implementation class (the "impl"), to which the interface class
maintains a pointer (the "p"). One advantage of this technique is that
it decreases physical coupling. Another advantage of this technique is
that it allows the copy-on-write optimization (which is an
implementation detail of the interface class, but a potentially
Are arguing that my use of pimpl isn't true pimpl? If so, I disagree.
I use all aspects of the pimpl idiom. I receive all of the benefits of
the idiom and pay all of the costs. That I just happen to value what is
generally perceived as at best a secondary benefit (i.e. the possibility
of copy-on-write) over what is generally perceived as the primary
benefit (i.e. decreasing physical coupling) does not change that.
-- Rainer Deyke (rainerd_at_[hidden])
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk