Boost logo

Boost :

Subject: Re: [boost] Pimpl Again?
From: Josh Juran (jjuran_at_[hidden])
Date: 2016-05-31 17:56:29


On May 31, 2016, at 5:10 PM, Emil Dotchevski <emildotchevski_at_[hidden]> wrote:

> On Tue, May 31, 2016 at 12:09 PM, Chris Glover <c.d.glover_at_[hidden]> wrote:
>
>> I sometimes don't pimpl an entire object. This might be because I have
>> templates in the interface or because I need the functions to inline. Your
>> solution doesn't allow me to do that.
>>
>
> One possibility is to use inheritance in the cpp file:
>
> header:
>
> struct foo { int critical_; };
>
> cpp:
>
> namespace
> {
> struct foo_: foo
> {
> int not_so_critiral_;
> };
> }

Since this uses a derived class instead of a pointer, I've been calling this the "dimpl" idiom. :-)

Josh


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