Boost logo

Boost :

Subject: Re: [boost] Pimpl Again?
From: Peter Dimov (lists_at_[hidden])
Date: 2016-05-31 21:52:59


Howard Hinnant wrote:

> It has to be outlined, in the source.cpp:
>
> #include <memory>
>
> class Book
> {
> struct implementation;
> std::unique_ptr<implementation> impl_;
> public:
> ~Book();
> Book();
> };

You could probably do

// hpp

class Book
{
    struct implementation;
    std::unique_ptr<implementation, void(*)(implementation*)> impl_;

public:

    Book();
};

// cpp

Book::Book(): impl_( new implementation, checked_delete<implementation> ) {}


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