Chris@16
|
1
|
Chris@16
|
2 #if !defined(BOOST_PP_IS_ITERATING)
|
Chris@16
|
3
|
Chris@16
|
4 ///// header body
|
Chris@16
|
5
|
Chris@16
|
6 #ifndef BOOST_MPL_APPLY_WRAP_HPP_INCLUDED
|
Chris@16
|
7 #define BOOST_MPL_APPLY_WRAP_HPP_INCLUDED
|
Chris@16
|
8
|
Chris@16
|
9 // Copyright Aleksey Gurtovoy 2000-2008
|
Chris@16
|
10 //
|
Chris@16
|
11 // Distributed under the Boost Software License, Version 1.0.
|
Chris@16
|
12 // (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
13 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
14 //
|
Chris@16
|
15 // See http://www.boost.org/libs/mpl for documentation.
|
Chris@16
|
16
|
Chris@101
|
17 // $Id$
|
Chris@101
|
18 // $Date$
|
Chris@101
|
19 // $Revision$
|
Chris@16
|
20
|
Chris@16
|
21 #if !defined(BOOST_MPL_PREPROCESSING_MODE)
|
Chris@16
|
22 # include <boost/mpl/aux_/arity.hpp>
|
Chris@16
|
23 # include <boost/mpl/aux_/has_apply.hpp>
|
Chris@16
|
24 # include <boost/mpl/aux_/na.hpp>
|
Chris@16
|
25 # include <boost/mpl/aux_/msvc_never_true.hpp>
|
Chris@16
|
26 #endif
|
Chris@16
|
27
|
Chris@16
|
28 #include <boost/mpl/aux_/config/use_preprocessed.hpp>
|
Chris@16
|
29
|
Chris@16
|
30 #if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \
|
Chris@16
|
31 && !defined(BOOST_MPL_PREPROCESSING_MODE)
|
Chris@16
|
32
|
Chris@16
|
33 # define BOOST_MPL_PREPROCESSED_HEADER apply_wrap.hpp
|
Chris@16
|
34 # include <boost/mpl/aux_/include_preprocessed.hpp>
|
Chris@16
|
35
|
Chris@16
|
36 #else
|
Chris@16
|
37
|
Chris@16
|
38 # include <boost/mpl/limits/arity.hpp>
|
Chris@16
|
39 # include <boost/mpl/aux_/preprocessor/params.hpp>
|
Chris@16
|
40 # include <boost/mpl/aux_/preprocessor/enum.hpp>
|
Chris@16
|
41 # include <boost/mpl/aux_/preprocessor/add.hpp>
|
Chris@16
|
42 # include <boost/mpl/aux_/config/bcc.hpp>
|
Chris@16
|
43 # include <boost/mpl/aux_/config/ctps.hpp>
|
Chris@16
|
44 # include <boost/mpl/aux_/config/dtp.hpp>
|
Chris@16
|
45 # include <boost/mpl/aux_/config/eti.hpp>
|
Chris@16
|
46 # include <boost/mpl/aux_/config/msvc.hpp>
|
Chris@16
|
47 # include <boost/mpl/aux_/config/workaround.hpp>
|
Chris@16
|
48
|
Chris@16
|
49 # include <boost/preprocessor/comma_if.hpp>
|
Chris@16
|
50 # include <boost/preprocessor/logical/and.hpp>
|
Chris@16
|
51 # include <boost/preprocessor/inc.hpp>
|
Chris@16
|
52 # include <boost/preprocessor/iterate.hpp>
|
Chris@16
|
53
|
Chris@16
|
54
|
Chris@16
|
55 namespace boost { namespace mpl {
|
Chris@16
|
56
|
Chris@16
|
57 // local macros, #undef-ined at the end of the header
|
Chris@16
|
58 # define AUX778076_APPLY_WRAP_PARAMS(n, param) \
|
Chris@16
|
59 BOOST_MPL_PP_PARAMS(n, param) \
|
Chris@16
|
60 /**/
|
Chris@16
|
61
|
Chris@16
|
62 # define AUX778076_APPLY_WRAP_SPEC_PARAMS(n, param) \
|
Chris@16
|
63 BOOST_MPL_PP_ENUM(BOOST_PP_INC(n), param) \
|
Chris@16
|
64 /**/
|
Chris@16
|
65
|
Chris@16
|
66
|
Chris@16
|
67 #define BOOST_PP_ITERATION_PARAMS_1 \
|
Chris@16
|
68 (3,(0, BOOST_MPL_LIMIT_METAFUNCTION_ARITY, <boost/mpl/apply_wrap.hpp>))
|
Chris@16
|
69 #include BOOST_PP_ITERATE()
|
Chris@16
|
70
|
Chris@16
|
71
|
Chris@16
|
72 # undef AUX778076_APPLY_WRAP_SPEC_PARAMS
|
Chris@16
|
73 # undef AUX778076_APPLY_WRAP_PARAMS
|
Chris@16
|
74
|
Chris@16
|
75 }}
|
Chris@16
|
76
|
Chris@16
|
77 #endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
|
Chris@16
|
78 #endif // BOOST_MPL_APPLY_WRAP_HPP_INCLUDED
|
Chris@16
|
79
|
Chris@16
|
80 ///// iteration, depth == 1
|
Chris@16
|
81
|
Chris@16
|
82 // For gcc 4.4 compatability, we must include the
|
Chris@16
|
83 // BOOST_PP_ITERATION_DEPTH test inside an #else clause.
|
Chris@16
|
84 #else // BOOST_PP_IS_ITERATING
|
Chris@16
|
85 #if BOOST_PP_ITERATION_DEPTH() == 1
|
Chris@16
|
86
|
Chris@16
|
87 # define i_ BOOST_PP_FRAME_ITERATION(1)
|
Chris@16
|
88
|
Chris@16
|
89 # if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
Chris@16
|
90 // MSVC version
|
Chris@16
|
91
|
Chris@16
|
92 #define AUX778076_MSVC_DTW_NAME BOOST_PP_CAT(msvc_apply,i_)
|
Chris@16
|
93 #define AUX778076_MSVC_DTW_ORIGINAL_NAME apply
|
Chris@16
|
94 #define AUX778076_MSVC_DTW_ARITY i_
|
Chris@16
|
95 #include <boost/mpl/aux_/msvc_dtw.hpp>
|
Chris@16
|
96
|
Chris@16
|
97 template<
|
Chris@16
|
98 typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T)
|
Chris@16
|
99 >
|
Chris@16
|
100 struct BOOST_PP_CAT(apply_wrap,i_)
|
Chris@16
|
101 {
|
Chris@16
|
102 // Metafunction forwarding confuses vc6
|
Chris@16
|
103 typedef typename BOOST_PP_CAT(msvc_apply,i_)<F>::template result_<
|
Chris@16
|
104 AUX778076_APPLY_WRAP_PARAMS(i_, T)
|
Chris@16
|
105 >::type type;
|
Chris@16
|
106 };
|
Chris@16
|
107
|
Chris@16
|
108 # elif defined(BOOST_MPL_CFG_BROKEN_DEFAULT_PARAMETERS_IN_NESTED_TEMPLATES)
|
Chris@16
|
109 // MWCW/Borland version
|
Chris@16
|
110
|
Chris@16
|
111 template<
|
Chris@16
|
112 int N, typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T)
|
Chris@16
|
113 >
|
Chris@16
|
114 struct BOOST_PP_CAT(apply_wrap_impl,i_);
|
Chris@16
|
115
|
Chris@16
|
116 #define BOOST_PP_ITERATION_PARAMS_2 \
|
Chris@16
|
117 (3,(0, BOOST_MPL_LIMIT_METAFUNCTION_ARITY - i_, <boost/mpl/apply_wrap.hpp>))
|
Chris@16
|
118 #include BOOST_PP_ITERATE()
|
Chris@16
|
119
|
Chris@16
|
120 template<
|
Chris@16
|
121 typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T)
|
Chris@16
|
122 >
|
Chris@16
|
123 struct BOOST_PP_CAT(apply_wrap,i_)
|
Chris@16
|
124 : BOOST_PP_CAT(apply_wrap_impl,i_)<
|
Chris@16
|
125 ::boost::mpl::aux::arity<F,i_>::value
|
Chris@16
|
126 , F
|
Chris@16
|
127 BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, T)
|
Chris@16
|
128 >::type
|
Chris@16
|
129 {
|
Chris@16
|
130 };
|
Chris@16
|
131
|
Chris@16
|
132 # else
|
Chris@16
|
133 // ISO98 C++, with minor concession to vc7
|
Chris@16
|
134
|
Chris@16
|
135 template<
|
Chris@16
|
136 typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T)
|
Chris@16
|
137 #if i_ == 0
|
Chris@16
|
138 , typename has_apply_ = typename aux::has_apply<F>::type
|
Chris@16
|
139 #endif
|
Chris@16
|
140 >
|
Chris@16
|
141 struct BOOST_PP_CAT(apply_wrap,i_)
|
Chris@16
|
142 // metafunction forwarding confuses MSVC 7.0
|
Chris@16
|
143 #if !BOOST_WORKAROUND(BOOST_MSVC, == 1300)
|
Chris@16
|
144 : F::template apply< AUX778076_APPLY_WRAP_PARAMS(i_, T) >
|
Chris@16
|
145 {
|
Chris@16
|
146 #else
|
Chris@16
|
147 {
|
Chris@16
|
148 typedef typename F::template apply<
|
Chris@16
|
149 AUX778076_APPLY_WRAP_PARAMS(i_, T)
|
Chris@16
|
150 >::type type;
|
Chris@16
|
151 #endif
|
Chris@16
|
152 };
|
Chris@16
|
153
|
Chris@16
|
154 #if i_ == 0 && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
Chris@16
|
155 template< typename F >
|
Chris@16
|
156 struct BOOST_PP_CAT(apply_wrap,i_)<F,true_>
|
Chris@16
|
157 : F::apply
|
Chris@16
|
158 {
|
Chris@16
|
159 };
|
Chris@16
|
160 #endif
|
Chris@16
|
161
|
Chris@16
|
162 # endif // workarounds
|
Chris@16
|
163
|
Chris@16
|
164 #if defined(BOOST_MPL_CFG_MSVC_ETI_BUG)
|
Chris@16
|
165 /// workaround for ETI bug
|
Chris@16
|
166 template<>
|
Chris@16
|
167 struct BOOST_PP_CAT(apply_wrap,i_)<AUX778076_APPLY_WRAP_SPEC_PARAMS(i_, int)>
|
Chris@16
|
168 {
|
Chris@16
|
169 typedef int type;
|
Chris@16
|
170 };
|
Chris@16
|
171 #endif
|
Chris@16
|
172
|
Chris@16
|
173 # undef i_
|
Chris@16
|
174
|
Chris@16
|
175 ///// iteration, depth == 2
|
Chris@16
|
176
|
Chris@16
|
177 #elif BOOST_PP_ITERATION_DEPTH() == 2
|
Chris@16
|
178
|
Chris@16
|
179 # define j_ BOOST_PP_FRAME_ITERATION(2)
|
Chris@16
|
180
|
Chris@16
|
181 #if i_ == 0 && j_ == 0 \
|
Chris@16
|
182 && defined(BOOST_MPL_CFG_BCC590_WORKAROUNDS) \
|
Chris@16
|
183 && !defined(BOOST_MPL_CFG_NO_HAS_APPLY)
|
Chris@16
|
184
|
Chris@16
|
185 template< typename F, bool F_has_apply >
|
Chris@16
|
186 struct apply_wrap_impl0_bcb {
|
Chris@16
|
187 typedef typename F::template apply< na > type;
|
Chris@16
|
188 };
|
Chris@16
|
189
|
Chris@16
|
190 template< typename F >
|
Chris@16
|
191 struct apply_wrap_impl0_bcb< F, true > {
|
Chris@16
|
192 typedef typename F::apply type;
|
Chris@16
|
193 };
|
Chris@16
|
194
|
Chris@16
|
195 template<
|
Chris@16
|
196 typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T)
|
Chris@16
|
197 >
|
Chris@16
|
198 struct BOOST_PP_CAT(apply_wrap_impl,i_)<
|
Chris@16
|
199 BOOST_MPL_PP_ADD(i_, j_)
|
Chris@16
|
200 , F
|
Chris@16
|
201 BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, T)
|
Chris@16
|
202 >
|
Chris@16
|
203 {
|
Chris@16
|
204 typedef apply_wrap_impl0_bcb< F, aux::has_apply< F >::value >::type type;
|
Chris@16
|
205 };
|
Chris@16
|
206 #else
|
Chris@16
|
207
|
Chris@16
|
208 template<
|
Chris@16
|
209 typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T)
|
Chris@16
|
210 >
|
Chris@16
|
211 struct BOOST_PP_CAT(apply_wrap_impl,i_)<
|
Chris@16
|
212 BOOST_MPL_PP_ADD(i_, j_)
|
Chris@16
|
213 , F
|
Chris@16
|
214 BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, T)
|
Chris@16
|
215 >
|
Chris@16
|
216 {
|
Chris@16
|
217 typedef typename F::template apply<
|
Chris@16
|
218 AUX778076_APPLY_WRAP_PARAMS(i_, T)
|
Chris@16
|
219 #if i_ == 0 && j_ == 0
|
Chris@16
|
220 /// since the defaults are "lost", we have to pass *something* even for nullary
|
Chris@16
|
221 /// metafunction classes
|
Chris@16
|
222 na
|
Chris@16
|
223 #else
|
Chris@16
|
224 BOOST_PP_COMMA_IF(BOOST_PP_AND(i_, j_)) BOOST_MPL_PP_ENUM(j_, na)
|
Chris@16
|
225 #endif
|
Chris@16
|
226 > type;
|
Chris@16
|
227 };
|
Chris@16
|
228
|
Chris@16
|
229 #endif
|
Chris@16
|
230
|
Chris@16
|
231 # undef j_
|
Chris@16
|
232
|
Chris@16
|
233 #endif // BOOST_PP_ITERATION_DEPTH()
|
Chris@16
|
234 #endif // BOOST_PP_IS_ITERATING
|