
On Tue, Oct 25, 2011 at 1:28 PM, GMan <gmannickg@gmail.com> wrote:
On Mon, Oct 24, 2011 at 7:22 PM, Allan Johns <allan.johns@drdstudios.com
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: http://lists.boost.org/mailman/listinfo.cgi/boost