Boost logo

Boost :

From: Sohail Somani (s.somani_at_[hidden])
Date: 2007-03-24 23:06:35


I've found a use for (2) but a better name for that use case would be cloning_ptr or something. Essentially the point was to avoid manually writing copy constructors/assignment/destructors when I needed to hold POD types by pointer. so something like:

struct c_lib_struct;
c_lib_struct * new_c_lib_struct(..);
c_lib_struct * copy_c_lib_struct(c_lib_struct *);

cloning_ptr<c_lib_struct>(new_c_lib_struct(..),copy_c_lib_struct,free_c_lib_struct);

Though not quite - took a couple of shortcuts ;-)

-----Original Message-----
From: boost-bounces_at_[hidden] on behalf of Anand Shankar
Sent: Sat 3/24/2007 2:03 PM
To: boost_at_[hidden]
Subject: [boost] smart_ptr: Helper to ease handling objects from a classheirarchy
 

2) The assignment operator doesn't transfer the ownership rights, but
clones the object using the Clone_polcy. This allows using the
copy constructor or a virtual clone function in the class heirarchy.


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