David Gruener wrote:
Jeff Flinn wrote:
A::A( const A::A& a ):mPimpl( new Impl( *a.mPimpl ) ){} and don't forget operator=; You get the deep copy semantics that your looking for don't you?
Then, whats the benefit here over using a plain pointer or std::auto_ptr? The goal of using a smart pointer with deep copy semantics is that you *dont* have to write those stuff by yourself.
Well, you don't have to worry about the destructor with shared_ptr or scoped_ptr. It's your call as to which to use so that you get the appropriate semantics.
I'd think scoped_ptr works above as well.
Again, scoped_ptr is noncopyable, and see above. :]
You're not copying the pointer, you're copying the pointee with deep copy semantics. Jeff Flinn Applied Dynamics, International