Boost logo

Boost :

From: loufoque (mathias.gaunard_at_[hidden])
Date: 2006-07-08 22:25:51


Kevin Spinar wrote :

> Also, I've decided to give clone_ptr clone-on-write semantics instead of
> clone-on-copy. This should alleviate any concerns about performance when
> inserting into a std::vector or copying containers (copying clone_ptr would
> give similar performance to boost::shared_ptr).

I see clone_ptr<base> just like a base object but with the ability to
behave polymorphically.
Hence to me it would seem normal that when copying actual cloning is
done, and not refcounting which makes it more like shared_ptr which is
designed to handle multiple ownership.

In that case, std::vector<clone_ptr<base> > would be comparable in
performance with std::vector<base>.

When C++ supports proper move semantics, the containers will probably
avoid the extensive copying that is being done nowadays.

By the way, I think the boost smart pointers should be refactored to a
policy-based design, which would allow people to choose more custom
behaviours.


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