]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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 | // For gcc 4.4 compatability, we must include the | |
41 | // BOOST_PP_ITERATION_DEPTH test inside an #else clause. | |
42 | #else // BOOST_PP_IS_ITERATING | |
43 | #if BOOST_PP_ITERATION_DEPTH() == 1 && BOOST_PP_ITERATION_FLAGS() == BOOST_PYTHON_FUNCTION_POINTER | |
44 | # if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \ | |
45 | && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201))) | |
46 | # line BOOST_PP_LINE(__LINE__, target.hpp(function_pointers)) | |
47 | # endif | |
48 | ||
49 | # define N BOOST_PP_ITERATION() | |
50 | ||
51 | template <class R BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, class A)> | |
52 | BOOST_PP_IF(N, A0, void)(* target(R (*)(BOOST_PP_ENUM_PARAMS_Z(1, N, A))) )() | |
53 | { | |
54 | return 0; | |
55 | } | |
56 | ||
57 | # undef N | |
58 | ||
59 | /* --------------- pointers-to-members --------------- */ | |
60 | #elif BOOST_PP_ITERATION_DEPTH() == 1 && BOOST_PP_ITERATION_FLAGS() == BOOST_PYTHON_POINTER_TO_MEMBER | |
61 | // Outer over cv-qualifiers | |
62 | ||
63 | # define BOOST_PP_ITERATION_PARAMS_2 (3, (0, BOOST_PYTHON_MAX_ARITY, <boost/python/detail/target.hpp>)) | |
64 | # include BOOST_PP_ITERATE() | |
65 | ||
66 | #elif BOOST_PP_ITERATION_DEPTH() == 2 | |
67 | # if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \ | |
68 | && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201))) | |
69 | # line BOOST_PP_LINE(__LINE__, target.hpp(pointers-to-members)) | |
70 | # endif | |
71 | // Inner over arities | |
72 | ||
73 | # define N BOOST_PP_ITERATION() | |
74 | # define Q BOOST_PYTHON_CV_QUALIFIER(BOOST_PP_RELATIVE_ITERATION(1)) | |
75 | ||
76 | template <class R, class T BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, class A)> | |
77 | T& (* target(R (T::*)(BOOST_PP_ENUM_PARAMS_Z(1, N, A)) Q) )() | |
78 | { | |
79 | return 0; | |
80 | } | |
81 | ||
82 | # undef N | |
83 | # undef Q | |
84 | ||
85 | #endif // BOOST_PP_ITERATION_DEPTH() | |
86 | #endif |