diff --git a/include/boost/python/converter/shared_ptr_deleter.hpp b/include/boost/python/converter/shared_ptr_deleter.hpp new file mode 100644 index 00000000..eb02e18a --- /dev/null +++ b/include/boost/python/converter/shared_ptr_deleter.hpp @@ -0,0 +1,23 @@ +// Copyright David Abrahams 2002. Permission to copy, use, +// modify, sell and distribute this software is granted provided this +// copyright notice appears in all copies. This software is provided +// "as is" without express or implied warranty, and with no claim as +// to its suitability for any purpose. +#ifndef SHARED_PTR_DELETER_DWA2002121_HPP +# define SHARED_PTR_DELETER_DWA2002121_HPP + +namespace boost { namespace python { namespace converter { + +struct shared_ptr_deleter +{ + shared_ptr_deleter(handle<> owner) + : owner(owner) {} + + void operator()(void const*) { owner.reset(); } + + handle<> owner; +}; + +}}} // namespace boost::python::converter + +#endif // SHARED_PTR_DELETER_DWA2002121_HPP