28 Apr
2005
28 Apr
'05
11 a.m.
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