Boost logo

Boost :

Subject: Re: [boost] [pimpl] No documentation for pointer semantics
From: Rob Stewart (robertstewart_at_[hidden])
Date: 2014-06-06 10:35:31

On June 6, 2014 8:02:44 AM EDT, Vladimir Batov <vb.mail.247_at_[hidden]> wrote:
>Rob Stewart-6 wrote
>> ...
>> On June 6, 2014 4:59:47 AM EDT, Vladimir Batov &lt;
>> vb.mail.247@
>> &gt; wrote:
>>>... my offering of pimpl::pointer_semantics and
>>>pimpl::value_semantics seems to make sense.
>> That's the problem. It isn't the Pimpl Idiom anymore.
>Well, that was a few nervous hours when I felt my familiar Pimpl world
>crashing all around me... after looking closely it seems my "extended"
>interpretation of Pimpl to still be the Pimpl Idiom. :-) First, Pimpl
>== Handle/Body == Bridge.


> Now I open GoF pg. 151 -- the Bridge chapter.
>The Applicability section -- you want to share an implementation among
>multiple objects (perhaps using ref. counting).


>The Implementation section -- 3. Sharing implementors.
>In fact, the Implementation section goes as far as to call one-to-one
>relationship between Abstraction and Implementor a degenerate case of
>the Bridge pattern.
>I.e. Gof sees pimpl::pointer_semantics, a.k.a. "Bridge with Shared
>Implementation" to be the proper Bridge when pimpl::value_semantics to
>be a
>degenerate one... although I feel it's a "bridge" :-) to far.


If one accepts the assertion that the Pimpl Idiom is the Bridge Pattern, the conclusion is appropriate. I don't accept the assertion. That is, the Pimpl Idiom is the degenerate case, but it isn't the same as the Bridge Pattern.

>Do I get a cookie? :-)

If your proposed library is named Boost.Bridge, for example, both forms fit. I'd still provide a pimpl class template, however.


(Sent from my portable computation engine)

Boost list run by bdawes at, gregod at, cpdaniel at, john at