From 8b611322e523afdbabcca2bc751f1f5404ee01b2 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Mon, 8 Jul 2002 17:14:26 +0000 Subject: [PATCH] Use new void_return mechanism [SVN r14352] --- include/boost/python/call.hpp | 3 +- include/boost/python/call_method.hpp | 3 +- include/boost/python/detail/void_return.hpp | 41 +++++++++++++++++++ include/boost/python/preprocessed/call.hpp | 32 +++++++-------- .../boost/python/preprocessed/call_method.hpp | 32 +++++++-------- 5 files changed, 77 insertions(+), 34 deletions(-) create mode 100644 include/boost/python/detail/void_return.hpp diff --git a/include/boost/python/call.hpp b/include/boost/python/call.hpp index 92661a68..e8c97038 100644 --- a/include/boost/python/call.hpp +++ b/include/boost/python/call.hpp @@ -14,6 +14,7 @@ # include # include # include +# include # include namespace boost { namespace python { @@ -27,7 +28,7 @@ template < class R \ BOOST_PP_COMMA_IF(nargs) BOOST_PP_ENUM_PARAMS(nargs, class A) \ > \ -typename converter::return_from_python::result_type \ +typename detail::returnable::type \ call(PyObject* callable \ BOOST_PP_COMMA_IF(nargs) BOOST_PYTHON_ENUM_PARAMS2(nargs, (A,const& a)) \ , boost::type* = 0 \ diff --git a/include/boost/python/call_method.hpp b/include/boost/python/call_method.hpp index 9bd07375..08e9eb68 100644 --- a/include/boost/python/call_method.hpp +++ b/include/boost/python/call_method.hpp @@ -14,6 +14,7 @@ # include # include # include +# include # include namespace boost { namespace python { @@ -27,7 +28,7 @@ template < class R \ BOOST_PP_COMMA_IF(nargs) BOOST_PP_ENUM_PARAMS(nargs, class A) \ > \ -typename converter::return_from_python::result_type \ +typename detail::returnable::type \ call_method(PyObject* self, char const* name \ BOOST_PP_COMMA_IF(nargs) BOOST_PYTHON_ENUM_PARAMS2(nargs, (A,const& a)) \ , boost::type* = 0 \ diff --git a/include/boost/python/detail/void_return.hpp b/include/boost/python/detail/void_return.hpp new file mode 100644 index 00000000..28e919d7 --- /dev/null +++ b/include/boost/python/detail/void_return.hpp @@ -0,0 +1,41 @@ +// 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 VOID_RETURN_DWA200274_HPP +# define VOID_RETURN_DWA200274_HPP + +namespace boost { namespace python { namespace detail { + +struct void_return +{ + void_return() {} + private: + void operator=(void_return const&); +}; + +template +struct returnable +{ + typedef T type; +}; + +# ifdef BOOST_NO_VOID_RETURNS +template <> +struct returnable +{ + typedef void_return type; +}; + +# ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +template <> struct returnable : returnable {}; +template <> struct returnable : returnable {}; +template <> struct returnable : returnable {}; +# endif + +# endif // BOOST_NO_VOID_RETURNS + +}}} // namespace boost::python::detail + +#endif // VOID_RETURN_DWA200274_HPP diff --git a/include/boost/python/preprocessed/call.hpp b/include/boost/python/preprocessed/call.hpp index 8280cd93..97ee70dd 100644 --- a/include/boost/python/preprocessed/call.hpp +++ b/include/boost/python/preprocessed/call.hpp @@ -11,7 +11,7 @@ // (replace-string "PyEval_CallFunction(" "\nPyEval_CallFunction(\n") template -typename converter::return_from_python::result_type +typename detail::returnable::type call(PyObject*callable,boost::type* =0) { converter::return_from_pythonconverter; @@ -20,7 +20,7 @@ call(PyObject*callable,boost::type* =0) callable,const_cast("(" ")"))); } template -typename converter::return_from_python::result_type +typename detail::returnable::type call(PyObject*callable,A0 const&a0,boost::type* =0) { converter::return_from_pythonconverter; @@ -30,7 +30,7 @@ call(PyObject*callable,A0 const&a0,boost::type* =0) ,converter::arg_to_python(a0).get())); } template -typename converter::return_from_python::result_type +typename detail::returnable::type call(PyObject*callable,A0 const&a0,A1 const&a1,boost::type* =0) { converter::return_from_pythonconverter; @@ -41,7 +41,7 @@ call(PyObject*callable,A0 const&a0,A1 const&a1,boost::type* =0) ,converter::arg_to_python(a1).get())); } template -typename converter::return_from_python::result_type +typename detail::returnable::type call(PyObject*callable,A0 const&a0,A1 const&a1,A2 const&a2,boost::type* =0) { converter::return_from_pythonconverter; @@ -53,7 +53,7 @@ call(PyObject*callable,A0 const&a0,A1 const&a1,A2 const&a2,boost::type* =0) ,converter::arg_to_python(a2).get())); } template -typename converter::return_from_python::result_type +typename detail::returnable::type call(PyObject*callable,A0 const&a0,A1 const&a1,A2 const&a2,A3 const&a3,boost::type* =0) { converter::return_from_pythonconverter; @@ -66,7 +66,7 @@ call(PyObject*callable,A0 const&a0,A1 const&a1,A2 const&a2,A3 const&a3,boost::ty ,converter::arg_to_python(a3).get())); } template -typename converter::return_from_python::result_type +typename detail::returnable::type call(PyObject*callable,A0 const&a0,A1 const&a1,A2 const&a2,A3 const&a3,A4 const&a4,boost::type* =0) { converter::return_from_pythonconverter; @@ -80,7 +80,7 @@ call(PyObject*callable,A0 const&a0,A1 const&a1,A2 const&a2,A3 const&a3,A4 const& ,converter::arg_to_python(a4).get())); } template -typename converter::return_from_python::result_type +typename detail::returnable::type call(PyObject*callable,A0 const&a0,A1 const&a1,A2 const&a2,A3 const&a3,A4 const&a4,A5 const&a5,boost::type* =0) { converter::return_from_pythonconverter; @@ -95,7 +95,7 @@ call(PyObject*callable,A0 const&a0,A1 const&a1,A2 const&a2,A3 const&a3,A4 const& ,converter::arg_to_python(a5).get())); } template -typename converter::return_from_python::result_type +typename detail::returnable::type call(PyObject*callable,A0 const&a0,A1 const&a1,A2 const&a2,A3 const&a3,A4 const&a4,A5 const&a5,A6 const&a6,boost::type* =0) { converter::return_from_pythonconverter; @@ -111,7 +111,7 @@ call(PyObject*callable,A0 const&a0,A1 const&a1,A2 const&a2,A3 const&a3,A4 const& ,converter::arg_to_python(a6).get())); } template -typename converter::return_from_python::result_type +typename detail::returnable::type call(PyObject*callable,A0 const&a0,A1 const&a1,A2 const&a2,A3 const&a3,A4 const&a4,A5 const&a5,A6 const&a6,A7 const&a7,boost::type* =0) { converter::return_from_pythonconverter; @@ -128,7 +128,7 @@ call(PyObject*callable,A0 const&a0,A1 const&a1,A2 const&a2,A3 const&a3,A4 const& ,converter::arg_to_python(a7).get())); } template -typename converter::return_from_python::result_type +typename detail::returnable::type call(PyObject*callable,A0 const&a0,A1 const&a1,A2 const&a2,A3 const&a3,A4 const&a4,A5 const&a5,A6 const&a6,A7 const&a7,A8 const&a8,boost::type* =0) { converter::return_from_pythonconverter; @@ -146,7 +146,7 @@ call(PyObject*callable,A0 const&a0,A1 const&a1,A2 const&a2,A3 const&a3,A4 const& ,converter::arg_to_python(a8).get())); } template -typename converter::return_from_python::result_type +typename detail::returnable::type call(PyObject*callable,A0 const&a0,A1 const&a1,A2 const&a2,A3 const&a3,A4 const&a4,A5 const&a5,A6 const&a6,A7 const&a7,A8 const&a8,A9 const&a9,boost::type* =0) { converter::return_from_pythonconverter; @@ -165,7 +165,7 @@ call(PyObject*callable,A0 const&a0,A1 const&a1,A2 const&a2,A3 const&a3,A4 const& ,converter::arg_to_python(a9).get())); } template -typename converter::return_from_python::result_type +typename detail::returnable::type call(PyObject*callable,A0 const&a0,A1 const&a1,A2 const&a2,A3 const&a3,A4 const&a4,A5 const&a5,A6 const&a6,A7 const&a7,A8 const&a8,A9 const&a9,A10 const&a10,boost::type* =0) { converter::return_from_pythonconverter; @@ -185,7 +185,7 @@ call(PyObject*callable,A0 const&a0,A1 const&a1,A2 const&a2,A3 const&a3,A4 const& ,converter::arg_to_python(a10).get())); } template -typename converter::return_from_python::result_type +typename detail::returnable::type call(PyObject*callable,A0 const&a0,A1 const&a1,A2 const&a2,A3 const&a3,A4 const&a4,A5 const&a5,A6 const&a6,A7 const&a7,A8 const&a8,A9 const&a9,A10 const&a10,A11 const&a11,boost::type* =0) { converter::return_from_pythonconverter; @@ -206,7 +206,7 @@ call(PyObject*callable,A0 const&a0,A1 const&a1,A2 const&a2,A3 const&a3,A4 const& ,converter::arg_to_python(a11).get())); } template -typename converter::return_from_python::result_type +typename detail::returnable::type call(PyObject*callable,A0 const&a0,A1 const&a1,A2 const&a2,A3 const&a3,A4 const&a4,A5 const&a5,A6 const&a6,A7 const&a7,A8 const&a8,A9 const&a9,A10 const&a10,A11 const&a11,A12 const&a12,boost::type* =0) { converter::return_from_pythonconverter; @@ -228,7 +228,7 @@ call(PyObject*callable,A0 const&a0,A1 const&a1,A2 const&a2,A3 const&a3,A4 const& ,converter::arg_to_python(a12).get())); } template -typename converter::return_from_python::result_type +typename detail::returnable::type call(PyObject*callable,A0 const&a0,A1 const&a1,A2 const&a2,A3 const&a3,A4 const&a4,A5 const&a5,A6 const&a6,A7 const&a7,A8 const&a8,A9 const&a9,A10 const&a10,A11 const&a11,A12 const&a12,A13 const&a13,boost::type* =0) { converter::return_from_pythonconverter; @@ -251,7 +251,7 @@ call(PyObject*callable,A0 const&a0,A1 const&a1,A2 const&a2,A3 const&a3,A4 const& ,converter::arg_to_python(a13).get())); } template -typename converter::return_from_python::result_type +typename detail::returnable::type call(PyObject*callable,A0 const&a0,A1 const&a1,A2 const&a2,A3 const&a3,A4 const&a4,A5 const&a5,A6 const&a6,A7 const&a7,A8 const&a8,A9 const&a9,A10 const&a10,A11 const&a11,A12 const&a12,A13 const&a13,A14 const&a14,boost::type* =0) { converter::return_from_pythonconverter; diff --git a/include/boost/python/preprocessed/call_method.hpp b/include/boost/python/preprocessed/call_method.hpp index 6ce1ecfb..a0783402 100644 --- a/include/boost/python/preprocessed/call_method.hpp +++ b/include/boost/python/preprocessed/call_method.hpp @@ -11,7 +11,7 @@ // (replace-string "PyEval_CallMethod(" "\nPyEval_CallMethod(\n") template -typename converter::return_from_python::result_type +typename detail::returnable::type call_method(PyObject*self,char const*name,boost::type* =0) { converter::return_from_pythonconverter; @@ -20,7 +20,7 @@ call_method(PyObject*self,char const*name,boost::type* =0) self,const_cast(name),const_cast("(" ")"))); } template -typename converter::return_from_python::result_type +typename detail::returnable::type call_method(PyObject*self,char const*name,A0 const&a0,boost::type* =0) { converter::return_from_pythonconverter; @@ -30,7 +30,7 @@ call_method(PyObject*self,char const*name,A0 const&a0,boost::type* =0) ,converter::arg_to_python(a0).get())); } template -typename converter::return_from_python::result_type +typename detail::returnable::type call_method(PyObject*self,char const*name,A0 const&a0,A1 const&a1,boost::type* =0) { converter::return_from_pythonconverter; @@ -41,7 +41,7 @@ call_method(PyObject*self,char const*name,A0 const&a0,A1 const&a1,boost::type ,converter::arg_to_python(a1).get())); } template -typename converter::return_from_python::result_type +typename detail::returnable::type call_method(PyObject*self,char const*name,A0 const&a0,A1 const&a1,A2 const&a2,boost::type* =0) { converter::return_from_pythonconverter; @@ -53,7 +53,7 @@ call_method(PyObject*self,char const*name,A0 const&a0,A1 const&a1,A2 const&a2,bo ,converter::arg_to_python(a2).get())); } template -typename converter::return_from_python::result_type +typename detail::returnable::type call_method(PyObject*self,char const*name,A0 const&a0,A1 const&a1,A2 const&a2,A3 const&a3,boost::type* =0) { converter::return_from_pythonconverter; @@ -66,7 +66,7 @@ call_method(PyObject*self,char const*name,A0 const&a0,A1 const&a1,A2 const&a2,A3 ,converter::arg_to_python(a3).get())); } template -typename converter::return_from_python::result_type +typename detail::returnable::type call_method(PyObject*self,char const*name,A0 const&a0,A1 const&a1,A2 const&a2,A3 const&a3,A4 const&a4,boost::type* =0) { converter::return_from_pythonconverter; @@ -80,7 +80,7 @@ call_method(PyObject*self,char const*name,A0 const&a0,A1 const&a1,A2 const&a2,A3 ,converter::arg_to_python(a4).get())); } template -typename converter::return_from_python::result_type +typename detail::returnable::type call_method(PyObject*self,char const*name,A0 const&a0,A1 const&a1,A2 const&a2,A3 const&a3,A4 const&a4,A5 const&a5,boost::type* =0) { converter::return_from_pythonconverter; @@ -95,7 +95,7 @@ call_method(PyObject*self,char const*name,A0 const&a0,A1 const&a1,A2 const&a2,A3 ,converter::arg_to_python(a5).get())); } template -typename converter::return_from_python::result_type +typename detail::returnable::type call_method(PyObject*self,char const*name,A0 const&a0,A1 const&a1,A2 const&a2,A3 const&a3,A4 const&a4,A5 const&a5,A6 const&a6,boost::type* =0) { converter::return_from_pythonconverter; @@ -111,7 +111,7 @@ call_method(PyObject*self,char const*name,A0 const&a0,A1 const&a1,A2 const&a2,A3 ,converter::arg_to_python(a6).get())); } template -typename converter::return_from_python::result_type +typename detail::returnable::type call_method(PyObject*self,char const*name,A0 const&a0,A1 const&a1,A2 const&a2,A3 const&a3,A4 const&a4,A5 const&a5,A6 const&a6,A7 const&a7,boost::type* =0) { converter::return_from_pythonconverter; @@ -128,7 +128,7 @@ call_method(PyObject*self,char const*name,A0 const&a0,A1 const&a1,A2 const&a2,A3 ,converter::arg_to_python(a7).get())); } template -typename converter::return_from_python::result_type +typename detail::returnable::type call_method(PyObject*self,char const*name,A0 const&a0,A1 const&a1,A2 const&a2,A3 const&a3,A4 const&a4,A5 const&a5,A6 const&a6,A7 const&a7,A8 const&a8,boost::type* =0) { converter::return_from_pythonconverter; @@ -146,7 +146,7 @@ call_method(PyObject*self,char const*name,A0 const&a0,A1 const&a1,A2 const&a2,A3 ,converter::arg_to_python(a8).get())); } template -typename converter::return_from_python::result_type +typename detail::returnable::type call_method(PyObject*self,char const*name,A0 const&a0,A1 const&a1,A2 const&a2,A3 const&a3,A4 const&a4,A5 const&a5,A6 const&a6,A7 const&a7,A8 const&a8,A9 const&a9,boost::type* =0) { converter::return_from_pythonconverter; @@ -165,7 +165,7 @@ call_method(PyObject*self,char const*name,A0 const&a0,A1 const&a1,A2 const&a2,A3 ,converter::arg_to_python(a9).get())); } template -typename converter::return_from_python::result_type +typename detail::returnable::type call_method(PyObject*self,char const*name,A0 const&a0,A1 const&a1,A2 const&a2,A3 const&a3,A4 const&a4,A5 const&a5,A6 const&a6,A7 const&a7,A8 const&a8,A9 const&a9,A10 const&a10,boost::type* =0) { converter::return_from_pythonconverter; @@ -185,7 +185,7 @@ call_method(PyObject*self,char const*name,A0 const&a0,A1 const&a1,A2 const&a2,A3 ,converter::arg_to_python(a10).get())); } template -typename converter::return_from_python::result_type +typename detail::returnable::type call_method(PyObject*self,char const*name,A0 const&a0,A1 const&a1,A2 const&a2,A3 const&a3,A4 const&a4,A5 const&a5,A6 const&a6,A7 const&a7,A8 const&a8,A9 const&a9,A10 const&a10,A11 const&a11,boost::type* =0) { converter::return_from_pythonconverter; @@ -206,7 +206,7 @@ call_method(PyObject*self,char const*name,A0 const&a0,A1 const&a1,A2 const&a2,A3 ,converter::arg_to_python(a11).get())); } template -typename converter::return_from_python::result_type +typename detail::returnable::type call_method(PyObject*self,char const*name,A0 const&a0,A1 const&a1,A2 const&a2,A3 const&a3,A4 const&a4,A5 const&a5,A6 const&a6,A7 const&a7,A8 const&a8,A9 const&a9,A10 const&a10,A11 const&a11,A12 const&a12,boost::type* =0) { converter::return_from_pythonconverter; @@ -228,7 +228,7 @@ call_method(PyObject*self,char const*name,A0 const&a0,A1 const&a1,A2 const&a2,A3 ,converter::arg_to_python(a12).get())); } template -typename converter::return_from_python::result_type +typename detail::returnable::type call_method(PyObject*self,char const*name,A0 const&a0,A1 const&a1,A2 const&a2,A3 const&a3,A4 const&a4,A5 const&a5,A6 const&a6,A7 const&a7,A8 const&a8,A9 const&a9,A10 const&a10,A11 const&a11,A12 const&a12,A13 const&a13,boost::type* =0) { converter::return_from_pythonconverter; @@ -251,7 +251,7 @@ call_method(PyObject*self,char const*name,A0 const&a0,A1 const&a1,A2 const&a2,A3 ,converter::arg_to_python(a13).get())); } template -typename converter::return_from_python::result_type +typename detail::returnable::type call_method(PyObject*self,char const*name,A0 const&a0,A1 const&a1,A2 const&a2,A3 const&a3,A4 const&a4,A5 const&a5,A6 const&a6,A7 const&a7,A8 const&a8,A9 const&a9,A10 const&a10,A11 const&a11,A12 const&a12,A13 const&a13,A14 const&a14,boost::type* =0) { converter::return_from_pythonconverter;