Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/python/detail/result.hpp @ 16:2665513ce2d3
Add boost headers
author | Chris Cannam |
---|---|
date | Tue, 05 Aug 2014 11:11:38 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
15:663ca0da4350 | 16:2665513ce2d3 |
---|---|
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 RESULT_DWA2002521_HPP | |
9 # define RESULT_DWA2002521_HPP | |
10 | |
11 # include <boost/type.hpp> | |
12 | |
13 # include <boost/python/detail/preprocessor.hpp> | |
14 | |
15 # include <boost/type_traits/object_traits.hpp> | |
16 # include <boost/mpl/if.hpp> | |
17 | |
18 # include <boost/preprocessor/comma_if.hpp> | |
19 # include <boost/preprocessor/iterate.hpp> | |
20 # include <boost/preprocessor/debug/line.hpp> | |
21 # include <boost/preprocessor/enum_params.hpp> | |
22 # include <boost/preprocessor/repetition/enum_trailing_params.hpp> | |
23 | |
24 namespace boost { namespace python { namespace detail { | |
25 | |
26 // Defines a family of overloaded function which, given x, a function | |
27 // pointer, member [function] pointer, or an AdaptableFunction object, | |
28 // returns a pointer to type<R>*, where R is the result type of | |
29 // invoking the result of bind(x). | |
30 // | |
31 // In order to work around bugs in deficient compilers, if x might be | |
32 // an AdaptableFunction object, you must pass OL as a second argument | |
33 // to get this to work portably. | |
34 | |
35 # define BOOST_PP_ITERATION_PARAMS_1 \ | |
36 (4, (0, BOOST_PYTHON_MAX_ARITY, <boost/python/detail/result.hpp>, BOOST_PYTHON_FUNCTION_POINTER)) | |
37 # include BOOST_PP_ITERATE() | |
38 | |
39 # define BOOST_PP_ITERATION_PARAMS_1 \ | |
40 (4, (0, BOOST_PYTHON_CV_COUNT - 1, <boost/python/detail/result.hpp>, BOOST_PYTHON_POINTER_TO_MEMBER)) | |
41 # include BOOST_PP_ITERATE() | |
42 | |
43 template <class R, class T> | |
44 boost::type<R>* result(R (T::*), int = 0) { return 0; } | |
45 | |
46 # if (defined(BOOST_MSVC) && _MSC_FULL_VER <= 13102140) \ | |
47 || (defined(__GNUC__) && __GNUC__ < 3) \ | |
48 || (defined(__MWERKS__) && __MWERKS__ < 0x3000) | |
49 // This code actually works on all implementations, but why use it when we don't have to? | |
50 template <class T> | |
51 struct get_result_type | |
52 { | |
53 typedef boost::type<typename T::result_type> type; | |
54 }; | |
55 | |
56 struct void_type | |
57 { | |
58 typedef void type; | |
59 }; | |
60 | |
61 template <class T> | |
62 struct result_result | |
63 { | |
64 typedef typename mpl::if_c< | |
65 is_class<T>::value | |
66 , get_result_type<T> | |
67 , void_type | |
68 >::type t1; | |
69 | |
70 typedef typename t1::type* type; | |
71 }; | |
72 | |
73 template <class X> | |
74 typename result_result<X>::type | |
75 result(X const&, short) { return 0; } | |
76 | |
77 # else // Simpler code for more-capable compilers | |
78 template <class X> | |
79 boost::type<typename X::result_type>* | |
80 result(X const&, short = 0) { return 0; } | |
81 | |
82 # endif | |
83 | |
84 }}} // namespace boost::python::detail | |
85 | |
86 # endif // RESULT_DWA2002521_HPP | |
87 | |
88 /* --------------- function pointers --------------- */ | |
89 // For gcc 4.4 compatability, we must include the | |
90 // BOOST_PP_ITERATION_DEPTH test inside an #else clause. | |
91 #else // BOOST_PP_IS_ITERATING | |
92 #if BOOST_PP_ITERATION_DEPTH() == 1 && BOOST_PP_ITERATION_FLAGS() == BOOST_PYTHON_FUNCTION_POINTER | |
93 # if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \ | |
94 && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201))) | |
95 # line BOOST_PP_LINE(__LINE__, result.hpp(function pointers)) | |
96 # endif | |
97 | |
98 # define N BOOST_PP_ITERATION() | |
99 | |
100 template <class R BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, class A)> | |
101 boost::type<R>* result(R (*)(BOOST_PP_ENUM_PARAMS_Z(1, N, A)), int = 0) | |
102 { | |
103 return 0; | |
104 } | |
105 | |
106 # undef N | |
107 | |
108 /* --------------- pointers-to-members --------------- */ | |
109 #elif BOOST_PP_ITERATION_DEPTH() == 1 && BOOST_PP_ITERATION_FLAGS() == BOOST_PYTHON_POINTER_TO_MEMBER | |
110 // Outer over cv-qualifiers | |
111 | |
112 # define BOOST_PP_ITERATION_PARAMS_2 (3, (0, BOOST_PYTHON_MAX_ARITY, <boost/python/detail/result.hpp>)) | |
113 # include BOOST_PP_ITERATE() | |
114 | |
115 #elif BOOST_PP_ITERATION_DEPTH() == 2 | |
116 # if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \ | |
117 && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201))) | |
118 # line BOOST_PP_LINE(__LINE__, result.hpp(pointers-to-members)) | |
119 # endif | |
120 // Inner over arities | |
121 | |
122 # define N BOOST_PP_ITERATION() | |
123 # define Q BOOST_PYTHON_CV_QUALIFIER(BOOST_PP_RELATIVE_ITERATION(1)) | |
124 | |
125 template <class R, class T BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, class A)> | |
126 boost::type<R>* result(R (T::*)(BOOST_PP_ENUM_PARAMS_Z(1, N, A)) Q, int = 0) | |
127 { | |
128 return 0; | |
129 } | |
130 | |
131 # undef N | |
132 # undef Q | |
133 | |
134 #endif // BOOST_PP_ITERATION_DEPTH() | |
135 #endif |