Boost logo

Boost Users :

From: David Gruener (gruenedd_at_[hidden])
Date: 2005-04-28 06:00:10


Russell Hind wrote:
> Only if you pass it to another object. It it is a private shared_ptr
> then it gets automatically deleted, but won't get shared around.

What i mean is, that if a class is implemented with a pimpl
structure using boost::shared_ptr this

A a;
A b(a);

would result in that changing private members of a changes
private members of b, which one doesn't want
in the default cases of pimpl.

> But what about scoped_ptr?

No, scoped_ptr is noncopyable. Whats needed is a
template with deepcopying the parameter struct (or cloning)
and no need of an complete type at the point of the declaration
of the pimpl.

--David


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net