Boost logo

Boost :

From: Rob Stewart (stewart_at_[hidden])
Date: 2005-10-04 10:25:15


From: Caleb Epstein <caleb.epstein_at_[hidden]>
> On 10/4/05, Asger Mangaard <tmb_at_[hidden]> wrote:
>
> My understanding is that the class that holds the pimpl (lets call it the
> Interface class) generally provides forwarding methods that invoke methods
> on an Implementation class (the class pointed to by m_pImpl). From what I
> can see of your implementation, if a user wants to invoke
> Implementation::foo, they will need to include Implementation.h, which
> effectively negates the benefit of pimpl in the first place.

For pimpl to work, the implementation class must be complete when
you try to use it. No library can eliminate that.

The pimple library automates the memory management, including
during copying and copy assignment, so you don't have to. Thus,
you declare a pimpl object and, in the process, forward declare
your impl type, and in exchange, you get automated memory
management. Where's the problem?

-- 
Rob Stewart                           stewart_at_[hidden]
Software Engineer                     http://www.sig.com
Susquehanna International Group, LLP  using std::disclaimer;

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