Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:50:38

0001 #if !defined(BOOST_PP_IS_ITERATING)
0002 
0003 // Copyright David Abrahams 2002.
0004 // Distributed under the Boost Software License, Version 1.0. (See
0005 // accompanying file LICENSE_1_0.txt or copy at
0006 // http://www.boost.org/LICENSE_1_0.txt)
0007 
0008 # ifndef RESULT_DWA2002521_HPP
0009 #  define RESULT_DWA2002521_HPP
0010 
0011 #  include <boost/type.hpp>
0012 
0013 #  include <boost/python/detail/preprocessor.hpp>
0014 #  include <boost/python/detail/type_traits.hpp>
0015 
0016 #  include <boost/mpl/if.hpp>
0017 
0018 #  include <boost/preprocessor/comma_if.hpp>
0019 #  include <boost/preprocessor/iterate.hpp>
0020 #  include <boost/preprocessor/debug/line.hpp>
0021 #  include <boost/preprocessor/enum_params.hpp>
0022 #  include <boost/preprocessor/repetition/enum_trailing_params.hpp>
0023 
0024 namespace boost { namespace python { namespace detail {
0025 
0026 // Defines a family of overloaded function which, given x, a function
0027 // pointer, member [function] pointer, or an AdaptableFunction object,
0028 // returns a pointer to type<R>*, where R is the result type of
0029 // invoking the result of bind(x).
0030 //
0031 // In order to work around bugs in deficient compilers, if x might be
0032 // an AdaptableFunction object, you must pass OL as a second argument
0033 // to get this to work portably.
0034 
0035 #  define BOOST_PP_ITERATION_PARAMS_1                                                                   \
0036     (4, (0, BOOST_PYTHON_MAX_ARITY, <boost/python/detail/result.hpp>, BOOST_PYTHON_FUNCTION_POINTER))
0037 #  include BOOST_PP_ITERATE()
0038 
0039 #  define BOOST_PP_ITERATION_PARAMS_1                                                                     \
0040     (4, (0, BOOST_PYTHON_CV_COUNT - 1, <boost/python/detail/result.hpp>, BOOST_PYTHON_POINTER_TO_MEMBER))
0041 #  include BOOST_PP_ITERATE()
0042 
0043 template <class R, class T>
0044 boost::type<R>* result(R (T::*), int = 0) { return 0; }
0045 
0046 #  if (defined(__MWERKS__) && __MWERKS__ < 0x3000)
0047 // This code actually works on all implementations, but why use it when we don't have to?
0048 template <class T>
0049 struct get_result_type
0050 {
0051     typedef boost::type<typename T::result_type> type;
0052 };
0053 
0054 struct void_type
0055 {
0056     typedef void type;
0057 };
0058 
0059 template <class T>
0060 struct result_result
0061 {
0062     typedef typename mpl::if_c<
0063         is_class<T>::value
0064         , get_result_type<T>
0065         , void_type
0066         >::type t1;
0067 
0068     typedef typename t1::type* type;
0069 };
0070 
0071 template <class X>
0072 typename result_result<X>::type
0073 result(X const&, short) { return 0; }
0074 
0075 #  else // Simpler code for more-capable compilers
0076 template <class X>
0077 boost::type<typename X::result_type>*
0078 result(X const&, short = 0) { return 0; }
0079 
0080 #  endif
0081 
0082 }}} // namespace boost::python::detail
0083 
0084 # endif // RESULT_DWA2002521_HPP
0085 
0086 /* --------------- function pointers --------------- */
0087 // For gcc 4.4 compatability, we must include the
0088 // BOOST_PP_ITERATION_DEPTH test inside an #else clause.
0089 #else // BOOST_PP_IS_ITERATING
0090 #if BOOST_PP_ITERATION_DEPTH() == 1 && BOOST_PP_ITERATION_FLAGS() == BOOST_PYTHON_FUNCTION_POINTER
0091 # if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100)                      \
0092         && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201)))
0093 #  line BOOST_PP_LINE(__LINE__, result.hpp(function pointers))
0094 # endif
0095 
0096 # define N BOOST_PP_ITERATION()
0097 
0098 template <class R BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, class A)>
0099 boost::type<R>* result(R (*)(BOOST_PP_ENUM_PARAMS_Z(1, N, A)), int = 0)
0100 {
0101     return 0;
0102 }
0103 
0104 # undef N
0105 
0106 /* --------------- pointers-to-members --------------- */
0107 #elif BOOST_PP_ITERATION_DEPTH() == 1 && BOOST_PP_ITERATION_FLAGS() == BOOST_PYTHON_POINTER_TO_MEMBER
0108 // Outer over cv-qualifiers
0109 
0110 # define BOOST_PP_ITERATION_PARAMS_2 (3, (0, BOOST_PYTHON_MAX_ARITY, <boost/python/detail/result.hpp>))
0111 # include BOOST_PP_ITERATE()
0112 
0113 #elif BOOST_PP_ITERATION_DEPTH() == 2
0114 # if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100)                      \
0115         && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201)))
0116 #  line BOOST_PP_LINE(__LINE__, result.hpp(pointers-to-members))
0117 # endif 
0118 // Inner over arities
0119 
0120 # define N BOOST_PP_ITERATION()
0121 # define Q BOOST_PYTHON_CV_QUALIFIER(BOOST_PP_RELATIVE_ITERATION(1))
0122 
0123 template <class R, class T BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, class A)>
0124 boost::type<R>* result(R (T::*)(BOOST_PP_ENUM_PARAMS_Z(1, N, A)) Q, int = 0)
0125 {
0126     return 0;
0127 }
0128 
0129 # undef N
0130 # undef Q
0131 
0132 #endif // BOOST_PP_ITERATION_DEPTH()
0133 #endif