Subject: Re: [boost] Interest in boost.deepcopy
From: Allan Johns (allan.johns_at_[hidden])
Date: 2011-10-24 22:22:41
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
You could argue that I should write a custom smart pointer to perform a deep
copy in its copy constructor, but for multiple reasons I'd quite like to not
have to do this, and to use boost::shared_ptr as normal.
On Tue, Oct 25, 2011 at 1:13 PM, Steven Watanabe <watanabesj_at_[hidden]>wrote:
> On 10/24/2011 05:16 PM, Allan Johns wrote:
> > Just gauging initial interest in a boost.deepcopy library, analogous to
> > deepcopy in python. Each type would register deepcopy behaviour with the
> > library (there are similarities to boost.serialize).
> > Boost.deepcopy would supply out-of-the-box registration for pod types,
> > pointer types, arrays, stl containers and common boost containers.
> I'm not sure why I would want to use something
> like this. Normally, in C++, the copy
> constructor is expected to do a deep copy, when
> it exists.
> In Christ,
> Steven Watanabe
> Unsubscribe & other changes:
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk