diff --git a/include/boost/python/detail/void_adaptor.hpp b/include/boost/python/detail/void_adaptor.hpp new file mode 100644 index 00000000..c2ecc2b0 --- /dev/null +++ b/include/boost/python/detail/void_adaptor.hpp @@ -0,0 +1,39 @@ +// (C) Copyright David Abrahams 2001. 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 VOID_ADAPTOR_DWA20011112_HPP +# define VOID_ADAPTOR_DWA20011112_HPP + +namespace boost { namespace python { namespace detail { + + extern PyObject arbitrary_object; + + template + struct void_adaptor + { + typedef PyObject* result_type; + + void_adaptor(T const& f) + : m_f(f) + {} + + PyObject* operator()() const + { + m_f(); + return &arbitrary_object; + } + private: + T m_f; + }; + + template + void_adaptor make_void_adaptor(T const& f) + { + return void_adaptor(f); + } +}}} // namespace boost::python::detail + +#endif // VOID_ADAPTOR_DWA20011112_HPP +