|
Boost : |
From: Anand Shankar (anand.shankar.k_at_[hidden])
Date: 2007-03-25 16:11:09
Hi Sohail,
cloning_ptr<c_lib_struct>(new_c_lib_struct(..),copy_c_lib_struct,free_c_lib_struct);
This leads me to belive that in the case you mention, the cloning_ptr stores
function
pointers for cloning and object deletion.
Your example is interesting because it requires that the `delete mechanism'
be
supplied as a template policy parameter as well.
template<typename T, typename Clone_policy=Use_new, typename
Delete_policy=Use_delete>
class Cloned_ptr { ... };
Here Use_new, Use_delete help default to using new and copy constructor for
cloning and using
delete for object deletion.
I've had to write such a class and also something very similar to
Boost::ptr_vector in course
of my work.
Best regards,
Anand.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk