From b7e10592272d61e90ca7c129109fa3576225aaba Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Wed, 14 Nov 2001 17:35:18 +0000 Subject: [PATCH] initial checkin [SVN r11679] --- include/boost/python/detail/void_adaptor.hpp | 39 ++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 include/boost/python/detail/void_adaptor.hpp 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 +