How to deep copy the full object behind boost :: shared_ptr <T> to shared_ptr pointing to a new location?
3 answers
You need a copy constructor or operator=one that will perform a deep copy.
boost::shared_ptrcannot know your structure of objects to do this for you. The operation "memory cloning" also does not work.
Of course, this is only for objects that require an explicitly defined copy constructor / operator=, while "trivial" ones are small copies.
+1