This is part of my library of smart pointer types which is available on my website, like std::auto_ptr<> it manages ownership, but it has different semantics for copy construction and assignment.
When an std::auto_ptr<> is copied ownership is transferred.
These non-standard copy semantics cause problems in a number of areas. For example: in the current case they don’t give the compiler constructed copy constructor for Whole the correct behaviour.
body_part_ptr<> copies the object pointed to by the assigned pointer.
[There are also a few other differences that don’t concern us here…If appropriate the copy can be made using a make_clone() method with a little extra work from the user, and the effect of dereferencing a const pointer is a const reference.]
[For those that have read Kevlin’s “Coping with Copying in C++” article in Overload 33 arg::body_part_pointer<> is an implementation of Qualified Smart Pointer that incorporates the ideas mentioned in footnote 3.]