sl@0: #if !defined(BOOST_PP_IS_ITERATING) sl@0: sl@0: // Copyright David Abrahams 2002. sl@0: // Distributed under the Boost Software License, Version 1.0. (See sl@0: // accompanying file LICENSE_1_0.txt or copy at sl@0: // http://www.boost.org/LICENSE_1_0.txt) sl@0: sl@0: # ifndef RESULT_DWA2002521_HPP sl@0: # define RESULT_DWA2002521_HPP sl@0: sl@0: # include sl@0: sl@0: # include sl@0: sl@0: # include sl@0: # include sl@0: sl@0: # include sl@0: # include sl@0: # include sl@0: # include sl@0: # include sl@0: sl@0: namespace boost { namespace python { namespace detail { sl@0: sl@0: // Defines a family of overloaded function which, given x, a function sl@0: // pointer, member [function] pointer, or an AdaptableFunction object, sl@0: // returns a pointer to type*, where R is the result type of sl@0: // invoking the result of bind(x). sl@0: // sl@0: // In order to work around bugs in deficient compilers, if x might be sl@0: // an AdaptableFunction object, you must pass OL as a second argument sl@0: // to get this to work portably. sl@0: sl@0: # define BOOST_PP_ITERATION_PARAMS_1 \ sl@0: (4, (0, BOOST_PYTHON_MAX_ARITY, , BOOST_PYTHON_FUNCTION_POINTER)) sl@0: # include BOOST_PP_ITERATE() sl@0: sl@0: # define BOOST_PP_ITERATION_PARAMS_1 \ sl@0: (4, (0, BOOST_PYTHON_CV_COUNT - 1, , BOOST_PYTHON_POINTER_TO_MEMBER)) sl@0: # include BOOST_PP_ITERATE() sl@0: sl@0: template sl@0: boost::type* result(R (T::*), int = 0) { return 0; } sl@0: sl@0: # if (defined(BOOST_MSVC) && _MSC_FULL_VER <= 13102140) \ sl@0: || (defined(__GNUC__) && __GNUC__ < 3) \ sl@0: || (defined(__MWERKS__) && __MWERKS__ < 0x3000) sl@0: // This code actually works on all implementations, but why use it when we don't have to? sl@0: template sl@0: struct get_result_type sl@0: { sl@0: typedef boost::type type; sl@0: }; sl@0: sl@0: struct void_type sl@0: { sl@0: typedef void type; sl@0: }; sl@0: sl@0: template sl@0: struct result_result sl@0: { sl@0: typedef typename mpl::if_c< sl@0: is_class::value sl@0: , get_result_type sl@0: , void_type sl@0: >::type t1; sl@0: sl@0: typedef typename t1::type* type; sl@0: }; sl@0: sl@0: template sl@0: typename result_result::type sl@0: result(X const&, short) { return 0; } sl@0: sl@0: # else // Simpler code for more-capable compilers sl@0: template sl@0: boost::type* sl@0: result(X const&, short = 0) { return 0; } sl@0: sl@0: # endif sl@0: sl@0: }}} // namespace boost::python::detail sl@0: sl@0: # endif // RESULT_DWA2002521_HPP sl@0: sl@0: /* --------------- function pointers --------------- */ sl@0: #elif BOOST_PP_ITERATION_DEPTH() == 1 && BOOST_PP_ITERATION_FLAGS() == BOOST_PYTHON_FUNCTION_POINTER sl@0: # if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \ sl@0: && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201))) sl@0: # line BOOST_PP_LINE(__LINE__, result.hpp(function pointers)) sl@0: # endif sl@0: sl@0: # define N BOOST_PP_ITERATION() sl@0: sl@0: template sl@0: boost::type* result(R (*pf)(BOOST_PP_ENUM_PARAMS_Z(1, N, A)), int = 0) sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: # undef N sl@0: sl@0: /* --------------- pointers-to-members --------------- */ sl@0: #elif BOOST_PP_ITERATION_DEPTH() == 1 && BOOST_PP_ITERATION_FLAGS() == BOOST_PYTHON_POINTER_TO_MEMBER sl@0: // Outer over cv-qualifiers sl@0: sl@0: # define BOOST_PP_ITERATION_PARAMS_2 (3, (0, BOOST_PYTHON_MAX_ARITY, )) sl@0: # include BOOST_PP_ITERATE() sl@0: sl@0: #elif BOOST_PP_ITERATION_DEPTH() == 2 sl@0: # if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \ sl@0: && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201))) sl@0: # line BOOST_PP_LINE(__LINE__, result.hpp(pointers-to-members)) sl@0: # endif sl@0: // Inner over arities sl@0: sl@0: # define N BOOST_PP_ITERATION() sl@0: # define Q BOOST_PYTHON_CV_QUALIFIER(BOOST_PP_RELATIVE_ITERATION(1)) sl@0: sl@0: template sl@0: boost::type* result(R (T::*pmf)(BOOST_PP_ENUM_PARAMS_Z(1, N, A)) Q, int = 0) sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: # undef N sl@0: # undef Q sl@0: sl@0: #endif