Boost logo

Boost :

Subject: Re: [boost] Interest in boost.deepcopy
From: Allan Johns (allan.johns_at_[hidden])
Date: 2011-10-24 22:42:53

On Tue, Oct 25, 2011 at 1:28 PM, GMan <gmannickg_at_[hidden]> wrote:

> On Mon, Oct 24, 2011 at 7:22 PM, Allan Johns <allan.johns_at_[hidden]
> >wrote:
> > 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
> >
> Why?

Because I don't want to have to introduce a custom shared_ptr class across
my whole codebase when a standard one will do?
Because I'm boost.python binding my library and I don't want to have to
write a bunch of code to deal with a custom ptr storage type.

> That's the standard solution. You can use T instead of T*, or
> std::unique_ptr<T>, or a boost::ptr_map.

How do either of these suggestions deal with avoidance of duplicating shared
objects within a hierarchy?
Furthermore a ptr_map won't cut it, my keys also need to be deep-copied as
they are a non-trivial type.

> GMan, Nick Gorski
> _______________________________________________
> Unsubscribe & other changes:

Boost list run by bdawes at, gregod at, cpdaniel at, john at