os/ossrv/ossrv_pub/boost_apis/boost/python/detail/target.hpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 #if !defined(BOOST_PP_IS_ITERATING)
     2 
     3 // Copyright David Abrahams 2002.
     4 // Distributed under the Boost Software License, Version 1.0. (See
     5 // accompanying file LICENSE_1_0.txt or copy at
     6 // http://www.boost.org/LICENSE_1_0.txt)
     7 
     8 # ifndef TARGET_DWA2002521_HPP
     9 #  define TARGET_DWA2002521_HPP
    10 
    11 #  include <boost/python/detail/preprocessor.hpp>
    12 
    13 #  include <boost/type.hpp>
    14 
    15 #  include <boost/preprocessor/comma_if.hpp>
    16 #  include <boost/preprocessor/if.hpp>
    17 #  include <boost/preprocessor/iterate.hpp>
    18 #  include <boost/preprocessor/debug/line.hpp>
    19 #  include <boost/preprocessor/enum_params.hpp>
    20 #  include <boost/preprocessor/repetition/enum_trailing_params.hpp>
    21 
    22 namespace boost { namespace python { namespace detail {
    23 
    24 #  define BOOST_PP_ITERATION_PARAMS_1                                                                   \
    25     (4, (0, BOOST_PYTHON_MAX_ARITY, <boost/python/detail/target.hpp>, BOOST_PYTHON_FUNCTION_POINTER))
    26 #  include BOOST_PP_ITERATE()
    27 
    28 #  define BOOST_PP_ITERATION_PARAMS_1                                                                    \
    29     (4, (0, BOOST_PYTHON_CV_COUNT - 1, <boost/python/detail/target.hpp>, BOOST_PYTHON_POINTER_TO_MEMBER))
    30 #  include BOOST_PP_ITERATE()
    31 
    32 template <class R, class T>
    33 T& (* target(R (T::*)) )() { return 0; }
    34 
    35 }}} // namespace boost::python::detail
    36 
    37 # endif // TARGET_DWA2002521_HPP
    38 
    39 /* --------------- function pointers --------------- */
    40 #elif BOOST_PP_ITERATION_DEPTH() == 1 && BOOST_PP_ITERATION_FLAGS() == BOOST_PYTHON_FUNCTION_POINTER
    41 # if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100)                      \
    42         && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201)))
    43 #  line BOOST_PP_LINE(__LINE__, target.hpp(function_pointers))
    44 # endif 
    45 
    46 # define N BOOST_PP_ITERATION()
    47 
    48 template <class R BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, class A)>
    49 BOOST_PP_IF(N, A0, void)(* target(R (*)(BOOST_PP_ENUM_PARAMS_Z(1, N, A))) )()
    50 {
    51     return 0;
    52 }
    53 
    54 # undef N
    55 
    56 /* --------------- pointers-to-members --------------- */
    57 #elif BOOST_PP_ITERATION_DEPTH() == 1 && BOOST_PP_ITERATION_FLAGS() == BOOST_PYTHON_POINTER_TO_MEMBER
    58 // Outer over cv-qualifiers
    59 
    60 # define BOOST_PP_ITERATION_PARAMS_2 (3, (0, BOOST_PYTHON_MAX_ARITY, <boost/python/detail/target.hpp>))
    61 # include BOOST_PP_ITERATE()
    62 
    63 #elif BOOST_PP_ITERATION_DEPTH() == 2
    64 # if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100)                      \
    65         && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201)))
    66 #  line BOOST_PP_LINE(__LINE__, target.hpp(pointers-to-members))
    67 # endif 
    68 // Inner over arities
    69 
    70 # define N BOOST_PP_ITERATION()
    71 # define Q BOOST_PYTHON_CV_QUALIFIER(BOOST_PP_RELATIVE_ITERATION(1))
    72 
    73 template <class R, class T BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, class A)>
    74 T& (* target(R (T::*)(BOOST_PP_ENUM_PARAMS_Z(1, N, A)) Q) )()
    75 {
    76     return 0;
    77 }
    78 
    79 # undef N
    80 # undef Q
    81 
    82 #endif