
UNCLASSIFIED Definitely it sounds a very worthwhile addition to me. Given that it does follow some proven patterns/concepts as in boost::serialize (for instance), it should take away a lot of guesses out of how it should/would work. I'd love to see it added, pls... Gabe Levy Senior Software Engineer, HiQ Systems Pty Ltd WSD, 201L, Edinburgh, SA
-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Allan Johns Sent: Tuesday, 25 October 2011 1:15 PM To: boost@lists.boost.org Subject: Re: [boost] Interest in boost.deepcopy
On Tue, Oct 25, 2011 at 1:29 PM, Julien Nitard <julien.nitard@m4tp.org>wrote:
Hi,
Consider an object hierarchy in which there may be multiple references to shared objects. A deep copy should give an identical, but entirely separate copy of the entire structure. Also consider eg std::map<std::string,T*>... the std::map copy constructor is not going to create new instances of T in the copy - this is a shallow copy.
If I understand properly, when you encounter a pointer you duplicate
the object pointed to. Is that right ?
Often but not always. Sometimes a type will want specific behaviour, such as sharing an internal reference with the original object because
there is some COW pattern implemented.
Does it work properly if (in your example above) T is a polymorphic class ? If yes, how ?
Yes, and in the same way boost.serialize works... each polymorphic class is registered beforehand.
Regards,
Julien
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
IMPORTANT: This email remains the property of the Department of Defence and is subject to the jurisdiction of section 70 of the Crimes Act 1914. If you have received this email in error, you are requested to contact the sender and delete the email.