Boost logo

Boost :

From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2006-07-03 09:26:55


Matt Calabrese wrote:
> On 7/1/06, Kevin Spinar <spinarkm_at_[hidden]> wrote:
>
>>Is there interest in a clone_ptr class to supplement the current smart_ptr
>>library? A clone_ptr is a smart pointer which performs a deep copy of the
>>pointed-to object whenever the clone_ptr is copied.
>
>
>
> Yes, I would be interested. I prefer the idea of object oriented programming
> with value semantics, as this would easily allow for. It certainly makes
> working with polymorphic types much more consistent with the rest of the
> language.

As long as C++ does not have move-semantics, the semantics of clone_ptr
seems to be far too expensive to be useful: std::vector<clone_ptr<T>>
will have to re-clone all objects on buffer expansion, whereas
boost::ptr_vector<T> will not.

-Thorsten


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