Chris@16: // Copyright David Abrahams 2003. Chris@16: // Distributed under the Boost Software License, Version 1.0. (See Chris@16: // accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: #ifndef SHARED_PTR_TO_PYTHON_DWA2003224_HPP Chris@16: # define SHARED_PTR_TO_PYTHON_DWA2003224_HPP Chris@16: Chris@16: # include Chris@16: # include Chris@16: # include Chris@16: # include Chris@16: Chris@16: namespace boost { namespace python { namespace converter { Chris@16: Chris@16: template Chris@16: PyObject* shared_ptr_to_python(shared_ptr const& x) Chris@16: { Chris@16: if (!x) Chris@16: return python::detail::none(); Chris@16: else if (shared_ptr_deleter* d = boost::get_deleter(x)) Chris@16: return incref( get_pointer( d->owner ) ); Chris@16: else Chris@16: return converter::registered const&>::converters.to_python(&x); Chris@16: } Chris@16: Chris@16: }}} // namespace boost::python::converter Chris@16: Chris@16: #endif // SHARED_PTR_TO_PYTHON_DWA2003224_HPP