Boost logo

Boost :

Subject: Re: [boost] Pimpl Again?
From: Vladimir Batov (Vladimir.Batov_at_[hidden])
Date: 2016-05-29 20:43:57


On 05/30/2016 10:12 AM, Gavin Lambert wrote:
> On 29/05/2016 02:25, Chris Glover wrote:
>> One addition I would like to see is a version where the heap
>> allocation is
>> avoided by storing an internal buffer in the base class. Yes, this means
>> one needs to keep the size in sync between the impl and the header, but
>> this can be an important optimization sometimes.
>
> Ideally the header should store a max size / capacity -- construction
> succeeds as long as the "real" impl is equal to or smaller than this.
> This allows a bit of flexibility for different layouts used by
> different compilers, or for "expansion room" without breaking consumers.
>
> Though you don't want to leave too much wiggle room. Memory is cheap
> but cache is less so.

I am personally very open to that idea. Although I would probably
suggest using custom allocator instead. It can be (almost?) as quick,
easily fit to the current design and would not irritate pimpl purists
:-) ... Having said that I feel that discussing in depth another
pimpl::manager is somewhat premature... although I am hoping we'll bet
to that point. In that light I feel that our experience with
boost::convert was quite positive: 1) reviewed; 2) accepted in
principle; 3) extended, improved by a group of enthusiasts who knew that
their effort won't be wasted/dismissed -- that's important IMO as that's
the only reward we can offer.


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