
25 Mar
2007
25 Mar
'07
8:11 p.m.
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.