Boost logo

Boost :

Subject: Re: [boost] Interest in boost.deepcopy
From: GMan (gmannickg_at_[hidden])
Date: 2011-10-24 23:19:28


On Mon, Oct 24, 2011 at 7:42 PM, Allan Johns <allan.johns_at_[hidden]>wrote:

> Because I don't want to have to introduce a custom shared_ptr class across
> my whole codebase when a standard one will do?
>

Well apparently it's not doing since you'd need to write more utility code
anyway. :P If I understand correctly.

>
> > 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.
>

I'm not sure they do, I didn't quite understand your case. I feel like
either there's an existing and more orthodox approach, or that if this is
indeed the best approach it's quite situational at best.

-- 
GMan, Nick Gorski

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk