File indexing completed on 2025-01-18 09:50:38
0001 #if !defined(BOOST_PP_IS_ITERATING)
0002
0003
0004
0005
0006
0007 # ifndef INVOKE_DWA20021122_HPP
0008 # define INVOKE_DWA20021122_HPP
0009
0010 # include <boost/python/detail/prefix.hpp>
0011 # include <boost/python/detail/preprocessor.hpp>
0012 # include <boost/python/detail/none.hpp>
0013
0014 # include <boost/preprocessor/iterate.hpp>
0015 # include <boost/preprocessor/facilities/intercept.hpp>
0016 # include <boost/preprocessor/repetition/enum_trailing_params.hpp>
0017 # include <boost/preprocessor/repetition/enum_trailing_binary_params.hpp>
0018 # include <boost/preprocessor/repetition/enum_binary_params.hpp>
0019 # include <boost/python/to_python_value.hpp>
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039 namespace boost { namespace python { namespace detail {
0040
0041
0042
0043 typedef int void_result_to_python;
0044
0045 template <bool void_return, bool member>
0046 struct invoke_tag_ {};
0047
0048
0049
0050 template <class R, class F>
0051 struct invoke_tag
0052 : invoke_tag_<
0053 is_same<R,void>::value
0054 , is_member_function_pointer<F>::value
0055 >
0056 {
0057 };
0058
0059 # define BOOST_PP_ITERATION_PARAMS_1 \
0060 (3, (0, BOOST_PYTHON_MAX_ARITY, <boost/python/detail/invoke.hpp>))
0061 # include BOOST_PP_ITERATE()
0062
0063 }}}
0064
0065 # endif
0066 #else
0067
0068 # define N BOOST_PP_ITERATION()
0069
0070 template <class RC, class F BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, class AC)>
0071 inline PyObject* invoke(invoke_tag_<false,false>, RC const& rc, F& f BOOST_PP_ENUM_TRAILING_BINARY_PARAMS_Z(1, N, AC, & ac) )
0072 {
0073 return rc(f( BOOST_PP_ENUM_BINARY_PARAMS_Z(1, N, ac, () BOOST_PP_INTERCEPT) ));
0074 }
0075
0076 template <class RC, class F BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, class AC)>
0077 inline PyObject* invoke(invoke_tag_<true,false>, RC const&, F& f BOOST_PP_ENUM_TRAILING_BINARY_PARAMS_Z(1, N, AC, & ac) )
0078 {
0079 f( BOOST_PP_ENUM_BINARY_PARAMS_Z(1, N, ac, () BOOST_PP_INTERCEPT) );
0080 return none();
0081 }
0082
0083 template <class RC, class F, class TC BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, class AC)>
0084 inline PyObject* invoke(invoke_tag_<false,true>, RC const& rc, F& f, TC& tc BOOST_PP_ENUM_TRAILING_BINARY_PARAMS_Z(1, N, AC, & ac) )
0085 {
0086 return rc( (tc().*f)(BOOST_PP_ENUM_BINARY_PARAMS_Z(1, N, ac, () BOOST_PP_INTERCEPT)) );
0087 }
0088
0089 template <class RC, class F, class TC BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, class AC)>
0090 inline PyObject* invoke(invoke_tag_<true,true>, RC const&, F& f, TC& tc BOOST_PP_ENUM_TRAILING_BINARY_PARAMS_Z(1, N, AC, & ac) )
0091 {
0092 (tc().*f)(BOOST_PP_ENUM_BINARY_PARAMS_Z(1, N, ac, () BOOST_PP_INTERCEPT));
0093 return none();
0094 }
0095
0096 # undef N
0097
0098 #endif