1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- #if !defined(BOOST_PP_IS_ITERATING)
- # ifndef INVOKE_DWA20021122_HPP
- # define INVOKE_DWA20021122_HPP
- # include <boost/python/detail/prefix.hpp>
- # include <boost/python/detail/preprocessor.hpp>
- # include <boost/python/detail/none.hpp>
- # include <boost/preprocessor/iterate.hpp>
- # include <boost/preprocessor/facilities/intercept.hpp>
- # include <boost/preprocessor/repetition/enum_trailing_params.hpp>
- # include <boost/preprocessor/repetition/enum_trailing_binary_params.hpp>
- # include <boost/preprocessor/repetition/enum_binary_params.hpp>
- # include <boost/python/to_python_value.hpp>
- namespace boost { namespace python { namespace detail {
- typedef int void_result_to_python;
- template <bool void_return, bool member>
- struct invoke_tag_ {};
- template <class R, class F>
- struct invoke_tag
- : invoke_tag_<
- is_same<R,void>::value
- , is_member_function_pointer<F>::value
- >
- {
- };
- # define BOOST_PP_ITERATION_PARAMS_1 \
- (3, (0, BOOST_PYTHON_MAX_ARITY, <boost/python/detail/invoke.hpp>))
- # include BOOST_PP_ITERATE()
- }}}
- # endif
- #else
- # define N BOOST_PP_ITERATION()
- template <class RC, class F BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, class AC)>
- inline PyObject* invoke(invoke_tag_<false,false>, RC const& rc, F& f BOOST_PP_ENUM_TRAILING_BINARY_PARAMS_Z(1, N, AC, & ac) )
- {
- return rc(f( BOOST_PP_ENUM_BINARY_PARAMS_Z(1, N, ac, () BOOST_PP_INTERCEPT) ));
- }
-
- template <class RC, class F BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, class AC)>
- inline PyObject* invoke(invoke_tag_<true,false>, RC const&, F& f BOOST_PP_ENUM_TRAILING_BINARY_PARAMS_Z(1, N, AC, & ac) )
- {
- f( BOOST_PP_ENUM_BINARY_PARAMS_Z(1, N, ac, () BOOST_PP_INTERCEPT) );
- return none();
- }
- template <class RC, class F, class TC BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, class AC)>
- 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) )
- {
- return rc( (tc().*f)(BOOST_PP_ENUM_BINARY_PARAMS_Z(1, N, ac, () BOOST_PP_INTERCEPT)) );
- }
-
- template <class RC, class F, class TC BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, class AC)>
- inline PyObject* invoke(invoke_tag_<true,true>, RC const&, F& f, TC& tc BOOST_PP_ENUM_TRAILING_BINARY_PARAMS_Z(1, N, AC, & ac) )
- {
- (tc().*f)(BOOST_PP_ENUM_BINARY_PARAMS_Z(1, N, ac, () BOOST_PP_INTERCEPT));
- return none();
- }
- # undef N
- #endif
|