Subject: Re: [boost] Interest in boost.deepcopy
From: Dave Abrahams (dave_at_[hidden])
Date: 2011-10-25 19:17:43
on Tue Oct 25 2011, Allan Johns <allan.johns-AT-drdstudios.com> wrote:
> In my case I have several data types - tables, buffers, tuples, attributes
> etc. I need to be able to clone (ie deepcopy) any part of one of these
> hierarchical structures... there is no "entire structure", if you will.
> I understand what's being said about memory ownership, but in this case I
> have full control of my problem domain, and such a generic deep copy library
> would be useful and save time - otherwise I'm just going to have to
> implement deep copy behaviour inside of all my classes anyway (which is
> actually what I have at the moment). This pattern has come up several times
> before in my work, so it isn't a one-off, and the motivation is not to deal
> with cyclic dependencies (although that should probably be dealt with).
> Perhaps there should be a 'deep copy context' that you can create for your
> own code or share from other libraries, so for eg one library's idea of what
> "deep copying" an std::vector is, can differ from another library's. Would
> this address your concern over ambiguity of memory ownership?
> Given that this behaviour is implemented as a standard module in another
> language (python) I'm surprised it's being dismissed so easily?
Pickling is considered "evil" in the BuildBot project precisely because
you can't control the boundaries
though I realize it's sometimes convenient.
Seems to me that you could tackle this need by implementing a special
"cloning_archive" type for Boost.Serialization, and be done with it.
-- Dave Abrahams BoostPro Computing http://www.boostpro.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk