Another version of Whole
class Whole {public: // ...Lots omitted... Whole& operator=(const Whole& rhs); void swap(Whole& that);private: arg::body_part_ptr<PartOne> p1; arg::body_part_ptr<PartTwo> p2;};
Notes:
Rewriting the example again using arg::body_part_ptr<>, we can allow the copy constructor to be generated by the compiler (unlike auto_ptr body_part_ptr “does the right thing”.
We do need to provide swap() and assignment operations...