make shared_ptr not use delete

boost, c++

Solution

Or how about using the stl to provide the wrapper functor - Doug T. description but without the custom caller.

boost::shared_ptr<T> ptr( new T, std::mem_fun_ref(&T::deleteMe) );
boost::shared_ptr<S> ptr( new S, std::ptr_fun(lib_freeXYZ) );

Problem

in my code i would like boost::shared_ptr not to call delete but call ptr->deleteMe() instead. Also i have a few C styled functions that return a ptr. Can i make it call lib_freeXYZ(ptr); instead of trying to delete?

Original source