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_BIND_HPP_INCLUDED
|
Chris@16
|
7 #define BOOST_MPL_BIND_HPP_INCLUDED
|
Chris@16
|
8
|
Chris@16
|
9 // Copyright Peter Dimov 2001
|
Chris@16
|
10 // Copyright Aleksey Gurtovoy 2001-2004
|
Chris@16
|
11 //
|
Chris@16
|
12 // Distributed under the Boost Software License, Version 1.0.
|
Chris@16
|
13 // (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
14 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
15 //
|
Chris@16
|
16 // See http://www.boost.org/libs/mpl for documentation.
|
Chris@16
|
17
|
Chris@101
|
18 // $Id$
|
Chris@101
|
19 // $Date$
|
Chris@101
|
20 // $Revision$
|
Chris@16
|
21
|
Chris@16
|
22 #if !defined(BOOST_MPL_PREPROCESSING_MODE)
|
Chris@16
|
23 # include <boost/mpl/bind_fwd.hpp>
|
Chris@16
|
24 # include <boost/mpl/placeholders.hpp>
|
Chris@16
|
25 # include <boost/mpl/next.hpp>
|
Chris@16
|
26 # include <boost/mpl/protect.hpp>
|
Chris@16
|
27 # include <boost/mpl/apply_wrap.hpp>
|
Chris@16
|
28 # include <boost/mpl/limits/arity.hpp>
|
Chris@16
|
29 # include <boost/mpl/aux_/na.hpp>
|
Chris@16
|
30 # include <boost/mpl/aux_/arity_spec.hpp>
|
Chris@16
|
31 # include <boost/mpl/aux_/type_wrapper.hpp>
|
Chris@16
|
32 # include <boost/mpl/aux_/yes_no.hpp>
|
Chris@16
|
33 # if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
Chris@16
|
34 # include <boost/type_traits/is_reference.hpp>
|
Chris@16
|
35 # endif
|
Chris@16
|
36 #endif
|
Chris@16
|
37
|
Chris@16
|
38 #include <boost/mpl/aux_/config/bind.hpp>
|
Chris@16
|
39 #include <boost/mpl/aux_/config/static_constant.hpp>
|
Chris@16
|
40 #include <boost/mpl/aux_/config/use_preprocessed.hpp>
|
Chris@16
|
41
|
Chris@16
|
42 #if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \
|
Chris@16
|
43 && !defined(BOOST_MPL_PREPROCESSING_MODE)
|
Chris@16
|
44
|
Chris@16
|
45 # if defined(BOOST_MPL_CFG_NO_UNNAMED_PLACEHOLDER_SUPPORT)
|
Chris@16
|
46 # define BOOST_MPL_PREPROCESSED_HEADER basic_bind.hpp
|
Chris@16
|
47 # else
|
Chris@16
|
48 # define BOOST_MPL_PREPROCESSED_HEADER bind.hpp
|
Chris@16
|
49 # endif
|
Chris@16
|
50 # include <boost/mpl/aux_/include_preprocessed.hpp>
|
Chris@16
|
51
|
Chris@16
|
52 #else
|
Chris@16
|
53
|
Chris@16
|
54 # include <boost/mpl/aux_/preprocessor/params.hpp>
|
Chris@16
|
55 # include <boost/mpl/aux_/preprocessor/default_params.hpp>
|
Chris@16
|
56 # include <boost/mpl/aux_/preprocessor/def_params_tail.hpp>
|
Chris@16
|
57 # include <boost/mpl/aux_/preprocessor/partial_spec_params.hpp>
|
Chris@16
|
58 # include <boost/mpl/aux_/preprocessor/ext_params.hpp>
|
Chris@16
|
59 # include <boost/mpl/aux_/preprocessor/repeat.hpp>
|
Chris@16
|
60 # include <boost/mpl/aux_/preprocessor/enum.hpp>
|
Chris@16
|
61 # include <boost/mpl/aux_/preprocessor/add.hpp>
|
Chris@16
|
62 # include <boost/mpl/aux_/config/dmc_ambiguous_ctps.hpp>
|
Chris@16
|
63 # include <boost/mpl/aux_/config/ctps.hpp>
|
Chris@16
|
64 # include <boost/mpl/aux_/config/ttp.hpp>
|
Chris@16
|
65 # include <boost/mpl/aux_/config/dtp.hpp>
|
Chris@16
|
66 # include <boost/mpl/aux_/nttp_decl.hpp>
|
Chris@16
|
67
|
Chris@16
|
68 # include <boost/preprocessor/iterate.hpp>
|
Chris@16
|
69 # include <boost/preprocessor/comma_if.hpp>
|
Chris@16
|
70 # include <boost/preprocessor/cat.hpp>
|
Chris@16
|
71 # include <boost/preprocessor/inc.hpp>
|
Chris@16
|
72
|
Chris@16
|
73 namespace boost { namespace mpl {
|
Chris@16
|
74
|
Chris@16
|
75 // local macros, #undef-ined at the end of the header
|
Chris@16
|
76 # define AUX778076_APPLY \
|
Chris@16
|
77 BOOST_PP_CAT(apply_wrap,BOOST_MPL_LIMIT_METAFUNCTION_ARITY) \
|
Chris@16
|
78 /**/
|
Chris@16
|
79
|
Chris@16
|
80 # if defined(BOOST_MPL_CFG_DMC_AMBIGUOUS_CTPS)
|
Chris@16
|
81 # define AUX778076_DMC_PARAM() , int dummy_
|
Chris@16
|
82 # else
|
Chris@16
|
83 # define AUX778076_DMC_PARAM()
|
Chris@16
|
84 # endif
|
Chris@16
|
85
|
Chris@16
|
86 # define AUX778076_BIND_PARAMS(param) \
|
Chris@16
|
87 BOOST_MPL_PP_PARAMS( \
|
Chris@16
|
88 BOOST_MPL_LIMIT_METAFUNCTION_ARITY \
|
Chris@16
|
89 , param \
|
Chris@16
|
90 ) \
|
Chris@16
|
91 /**/
|
Chris@16
|
92
|
Chris@16
|
93 # define AUX778076_BIND_DEFAULT_PARAMS(param, value) \
|
Chris@16
|
94 BOOST_MPL_PP_DEFAULT_PARAMS( \
|
Chris@16
|
95 BOOST_MPL_LIMIT_METAFUNCTION_ARITY \
|
Chris@16
|
96 , param \
|
Chris@16
|
97 , value \
|
Chris@16
|
98 ) \
|
Chris@16
|
99 /**/
|
Chris@16
|
100
|
Chris@16
|
101 # define AUX778076_BIND_N_PARAMS(n, param) \
|
Chris@16
|
102 BOOST_PP_COMMA_IF(n) BOOST_MPL_PP_PARAMS(n, param) \
|
Chris@16
|
103 /**/
|
Chris@16
|
104
|
Chris@16
|
105 # define AUX778076_BIND_N_SPEC_PARAMS(n, param, def) \
|
Chris@16
|
106 BOOST_PP_COMMA_IF(n) \
|
Chris@16
|
107 BOOST_MPL_PP_PARTIAL_SPEC_PARAMS(n, param, def) \
|
Chris@16
|
108 /**/
|
Chris@16
|
109
|
Chris@16
|
110 #if !defined(BOOST_MPL_CFG_NO_DEFAULT_PARAMETERS_IN_NESTED_TEMPLATES)
|
Chris@16
|
111 # define AUX778076_BIND_NESTED_DEFAULT_PARAMS(param, value) \
|
Chris@16
|
112 AUX778076_BIND_DEFAULT_PARAMS(param, value) \
|
Chris@16
|
113 /**/
|
Chris@16
|
114 #else
|
Chris@16
|
115 # define AUX778076_BIND_NESTED_DEFAULT_PARAMS(param, value) \
|
Chris@16
|
116 AUX778076_BIND_PARAMS(param) \
|
Chris@16
|
117 /**/
|
Chris@16
|
118 #endif
|
Chris@16
|
119
|
Chris@16
|
120 namespace aux {
|
Chris@16
|
121
|
Chris@16
|
122 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
Chris@16
|
123
|
Chris@16
|
124 template<
|
Chris@16
|
125 typename T, AUX778076_BIND_PARAMS(typename U)
|
Chris@16
|
126 >
|
Chris@16
|
127 struct resolve_bind_arg
|
Chris@16
|
128 {
|
Chris@16
|
129 typedef T type;
|
Chris@16
|
130 };
|
Chris@16
|
131
|
Chris@16
|
132 # if !defined(BOOST_MPL_CFG_NO_UNNAMED_PLACEHOLDER_SUPPORT)
|
Chris@16
|
133
|
Chris@16
|
134 template<
|
Chris@16
|
135 typename T
|
Chris@16
|
136 , typename Arg
|
Chris@16
|
137 >
|
Chris@16
|
138 struct replace_unnamed_arg
|
Chris@16
|
139 {
|
Chris@16
|
140 typedef Arg next;
|
Chris@16
|
141 typedef T type;
|
Chris@16
|
142 };
|
Chris@16
|
143
|
Chris@16
|
144 template<
|
Chris@16
|
145 typename Arg
|
Chris@16
|
146 >
|
Chris@16
|
147 struct replace_unnamed_arg< arg<-1>,Arg >
|
Chris@16
|
148 {
|
Chris@16
|
149 typedef typename Arg::next next;
|
Chris@16
|
150 typedef Arg type;
|
Chris@16
|
151 };
|
Chris@16
|
152
|
Chris@16
|
153 # endif // BOOST_MPL_CFG_NO_UNNAMED_PLACEHOLDER_SUPPORT
|
Chris@16
|
154
|
Chris@16
|
155 template<
|
Chris@16
|
156 BOOST_MPL_AUX_NTTP_DECL(int, N), AUX778076_BIND_PARAMS(typename U)
|
Chris@16
|
157 >
|
Chris@16
|
158 struct resolve_bind_arg< arg<N>,AUX778076_BIND_PARAMS(U) >
|
Chris@16
|
159 {
|
Chris@16
|
160 typedef typename AUX778076_APPLY<mpl::arg<N>, AUX778076_BIND_PARAMS(U)>::type type;
|
Chris@16
|
161 };
|
Chris@16
|
162
|
Chris@16
|
163 #if !defined(BOOST_MPL_CFG_NO_BIND_TEMPLATE)
|
Chris@16
|
164 template<
|
Chris@16
|
165 typename F, AUX778076_BIND_PARAMS(typename T), AUX778076_BIND_PARAMS(typename U)
|
Chris@16
|
166 >
|
Chris@16
|
167 struct resolve_bind_arg< bind<F,AUX778076_BIND_PARAMS(T)>,AUX778076_BIND_PARAMS(U) >
|
Chris@16
|
168 {
|
Chris@16
|
169 typedef bind<F,AUX778076_BIND_PARAMS(T)> f_;
|
Chris@16
|
170 typedef typename AUX778076_APPLY<f_, AUX778076_BIND_PARAMS(U)>::type type;
|
Chris@16
|
171 };
|
Chris@16
|
172 #endif
|
Chris@16
|
173
|
Chris@16
|
174 #else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
Chris@16
|
175
|
Chris@16
|
176 // agurt, 15/jan/02: it's not a intended to be used as a function class, and
|
Chris@16
|
177 // MSVC6.5 has problems with 'apply' name here (the code compiles, but doesn't
|
Chris@16
|
178 // work), so I went with the 'result_' here, and in all other similar cases
|
Chris@16
|
179 template< bool >
|
Chris@16
|
180 struct resolve_arg_impl
|
Chris@16
|
181 {
|
Chris@16
|
182 template< typename T, AUX778076_BIND_PARAMS(typename U) > struct result_
|
Chris@16
|
183 {
|
Chris@16
|
184 typedef T type;
|
Chris@16
|
185 };
|
Chris@16
|
186 };
|
Chris@16
|
187
|
Chris@16
|
188 template<>
|
Chris@16
|
189 struct resolve_arg_impl<true>
|
Chris@16
|
190 {
|
Chris@16
|
191 template< typename T, AUX778076_BIND_PARAMS(typename U) > struct result_
|
Chris@16
|
192 {
|
Chris@16
|
193 typedef typename AUX778076_APPLY<
|
Chris@16
|
194 T
|
Chris@16
|
195 , AUX778076_BIND_PARAMS(U)
|
Chris@16
|
196 >::type type;
|
Chris@16
|
197 };
|
Chris@16
|
198 };
|
Chris@16
|
199
|
Chris@16
|
200 // for 'resolve_bind_arg'
|
Chris@16
|
201 template< typename T > struct is_bind_template;
|
Chris@16
|
202
|
Chris@16
|
203 template<
|
Chris@16
|
204 typename T, AUX778076_BIND_PARAMS(typename U)
|
Chris@16
|
205 >
|
Chris@16
|
206 struct resolve_bind_arg
|
Chris@16
|
207 : resolve_arg_impl< is_bind_template<T>::value >
|
Chris@16
|
208 ::template result_< T,AUX778076_BIND_PARAMS(U) >
|
Chris@16
|
209 {
|
Chris@16
|
210 };
|
Chris@16
|
211
|
Chris@16
|
212 # if !defined(BOOST_MPL_CFG_NO_UNNAMED_PLACEHOLDER_SUPPORT)
|
Chris@16
|
213
|
Chris@16
|
214 template< typename T >
|
Chris@16
|
215 struct replace_unnamed_arg_impl
|
Chris@16
|
216 {
|
Chris@16
|
217 template< typename Arg > struct result_
|
Chris@16
|
218 {
|
Chris@16
|
219 typedef Arg next;
|
Chris@16
|
220 typedef T type;
|
Chris@16
|
221 };
|
Chris@16
|
222 };
|
Chris@16
|
223
|
Chris@16
|
224 template<>
|
Chris@16
|
225 struct replace_unnamed_arg_impl< arg<-1> >
|
Chris@16
|
226 {
|
Chris@16
|
227 template< typename Arg > struct result_
|
Chris@16
|
228 {
|
Chris@16
|
229 typedef typename next<Arg>::type next;
|
Chris@16
|
230 typedef Arg type;
|
Chris@16
|
231 };
|
Chris@16
|
232 };
|
Chris@16
|
233
|
Chris@16
|
234 template< typename T, typename Arg >
|
Chris@16
|
235 struct replace_unnamed_arg
|
Chris@16
|
236 : replace_unnamed_arg_impl<T>::template result_<Arg>
|
Chris@16
|
237 {
|
Chris@16
|
238 };
|
Chris@16
|
239
|
Chris@16
|
240 # endif // BOOST_MPL_CFG_NO_UNNAMED_PLACEHOLDER_SUPPORT
|
Chris@16
|
241
|
Chris@16
|
242 // agurt, 10/mar/02: the forward declaration has to appear before any of
|
Chris@16
|
243 // 'is_bind_helper' overloads, otherwise MSVC6.5 issues an ICE on it
|
Chris@16
|
244 template< BOOST_MPL_AUX_NTTP_DECL(int, arity_) > struct bind_chooser;
|
Chris@16
|
245
|
Chris@16
|
246 aux::no_tag is_bind_helper(...);
|
Chris@16
|
247 template< typename T > aux::no_tag is_bind_helper(protect<T>*);
|
Chris@16
|
248
|
Chris@16
|
249 // overload for "main" form
|
Chris@16
|
250 // agurt, 15/mar/02: MSVC 6.5 fails to properly resolve the overload
|
Chris@16
|
251 // in case if we use 'aux::type_wrapper< bind<...> >' here, and all
|
Chris@16
|
252 // 'bind' instantiations form a complete type anyway
|
Chris@16
|
253 #if !defined(BOOST_MPL_CFG_NO_BIND_TEMPLATE)
|
Chris@16
|
254 template<
|
Chris@16
|
255 typename F, AUX778076_BIND_PARAMS(typename T)
|
Chris@16
|
256 >
|
Chris@16
|
257 aux::yes_tag is_bind_helper(bind<F,AUX778076_BIND_PARAMS(T)>*);
|
Chris@16
|
258 #endif
|
Chris@16
|
259
|
Chris@16
|
260 template< BOOST_MPL_AUX_NTTP_DECL(int, N) >
|
Chris@16
|
261 aux::yes_tag is_bind_helper(arg<N>*);
|
Chris@16
|
262
|
Chris@16
|
263 template< bool is_ref_ = true >
|
Chris@16
|
264 struct is_bind_template_impl
|
Chris@16
|
265 {
|
Chris@16
|
266 template< typename T > struct result_
|
Chris@16
|
267 {
|
Chris@16
|
268 BOOST_STATIC_CONSTANT(bool, value = false);
|
Chris@16
|
269 };
|
Chris@16
|
270 };
|
Chris@16
|
271
|
Chris@16
|
272 template<>
|
Chris@16
|
273 struct is_bind_template_impl<false>
|
Chris@16
|
274 {
|
Chris@16
|
275 template< typename T > struct result_
|
Chris@16
|
276 {
|
Chris@16
|
277 BOOST_STATIC_CONSTANT(bool, value =
|
Chris@16
|
278 sizeof(aux::is_bind_helper(static_cast<T*>(0)))
|
Chris@16
|
279 == sizeof(aux::yes_tag)
|
Chris@16
|
280 );
|
Chris@16
|
281 };
|
Chris@16
|
282 };
|
Chris@16
|
283
|
Chris@16
|
284 template< typename T > struct is_bind_template
|
Chris@16
|
285 : is_bind_template_impl< ::boost::detail::is_reference_impl<T>::value >
|
Chris@16
|
286 ::template result_<T>
|
Chris@16
|
287 {
|
Chris@16
|
288 };
|
Chris@16
|
289
|
Chris@16
|
290 #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
Chris@16
|
291
|
Chris@16
|
292 } // namespace aux
|
Chris@16
|
293
|
Chris@16
|
294
|
Chris@16
|
295 #define BOOST_PP_ITERATION_PARAMS_1 \
|
Chris@16
|
296 (3,(0, BOOST_MPL_LIMIT_METAFUNCTION_ARITY, <boost/mpl/bind.hpp>))
|
Chris@16
|
297 #include BOOST_PP_ITERATE()
|
Chris@16
|
298
|
Chris@16
|
299 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
|
Chris@16
|
300 && !defined(BOOST_MPL_CFG_NO_TEMPLATE_TEMPLATE_PARAMETERS)
|
Chris@16
|
301 /// if_/eval_if specializations
|
Chris@16
|
302 # define AUX778076_SPEC_NAME if_
|
Chris@16
|
303 # define BOOST_PP_ITERATION_PARAMS_1 (3,(3, 3, <boost/mpl/bind.hpp>))
|
Chris@16
|
304 # include BOOST_PP_ITERATE()
|
Chris@16
|
305
|
Chris@16
|
306 #if !defined(BOOST_MPL_CFG_DMC_AMBIGUOUS_CTPS)
|
Chris@16
|
307 # define AUX778076_SPEC_NAME eval_if
|
Chris@16
|
308 # define BOOST_PP_ITERATION_PARAMS_1 (3,(3, 3, <boost/mpl/bind.hpp>))
|
Chris@16
|
309 # include BOOST_PP_ITERATE()
|
Chris@16
|
310 #endif
|
Chris@16
|
311 #endif
|
Chris@16
|
312
|
Chris@16
|
313 // real C++ version is already taken care of
|
Chris@16
|
314 #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
|
Chris@16
|
315 && !defined(BOOST_MPL_CFG_NO_BIND_TEMPLATE)
|
Chris@16
|
316
|
Chris@16
|
317 namespace aux {
|
Chris@16
|
318 // apply_count_args
|
Chris@16
|
319 #define AUX778076_COUNT_ARGS_PREFIX bind
|
Chris@16
|
320 #define AUX778076_COUNT_ARGS_DEFAULT na
|
Chris@16
|
321 #define AUX778076_COUNT_ARGS_ARITY BOOST_MPL_LIMIT_METAFUNCTION_ARITY
|
Chris@16
|
322 #include <boost/mpl/aux_/count_args.hpp>
|
Chris@16
|
323 }
|
Chris@16
|
324
|
Chris@16
|
325 // bind
|
Chris@16
|
326 template<
|
Chris@16
|
327 typename F, AUX778076_BIND_PARAMS(typename T) AUX778076_DMC_PARAM()
|
Chris@16
|
328 >
|
Chris@16
|
329 struct bind
|
Chris@16
|
330 : aux::bind_chooser<
|
Chris@16
|
331 aux::bind_count_args<AUX778076_BIND_PARAMS(T)>::value
|
Chris@16
|
332 >::template result_< F,AUX778076_BIND_PARAMS(T) >::type
|
Chris@16
|
333 {
|
Chris@16
|
334 };
|
Chris@16
|
335
|
Chris@16
|
336 BOOST_MPL_AUX_ARITY_SPEC(
|
Chris@16
|
337 BOOST_PP_INC(BOOST_MPL_LIMIT_METAFUNCTION_ARITY)
|
Chris@16
|
338 , bind
|
Chris@16
|
339 )
|
Chris@16
|
340
|
Chris@16
|
341 BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(
|
Chris@16
|
342 BOOST_PP_INC(BOOST_MPL_LIMIT_METAFUNCTION_ARITY)
|
Chris@16
|
343 , bind
|
Chris@16
|
344 )
|
Chris@16
|
345
|
Chris@16
|
346
|
Chris@16
|
347 #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
Chris@16
|
348
|
Chris@16
|
349 # undef AUX778076_BIND_NESTED_DEFAULT_PARAMS
|
Chris@16
|
350 # undef AUX778076_BIND_N_SPEC_PARAMS
|
Chris@16
|
351 # undef AUX778076_BIND_N_PARAMS
|
Chris@16
|
352 # undef AUX778076_BIND_DEFAULT_PARAMS
|
Chris@16
|
353 # undef AUX778076_BIND_PARAMS
|
Chris@16
|
354 # undef AUX778076_DMC_PARAM
|
Chris@16
|
355 # undef AUX778076_APPLY
|
Chris@16
|
356
|
Chris@16
|
357 }}
|
Chris@16
|
358
|
Chris@16
|
359 #endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
|
Chris@16
|
360 #endif // BOOST_MPL_BIND_HPP_INCLUDED
|
Chris@16
|
361
|
Chris@16
|
362 ///// iteration, depth == 1
|
Chris@16
|
363
|
Chris@16
|
364 // For gcc 4.4 compatability, we must include the
|
Chris@16
|
365 // BOOST_PP_ITERATION_DEPTH test inside an #else clause.
|
Chris@16
|
366 #else // BOOST_PP_IS_ITERATING
|
Chris@16
|
367 #if BOOST_PP_ITERATION_DEPTH() == 1
|
Chris@16
|
368
|
Chris@16
|
369 # define i_ BOOST_PP_FRAME_ITERATION(1)
|
Chris@16
|
370
|
Chris@16
|
371 #if defined(AUX778076_SPEC_NAME)
|
Chris@16
|
372
|
Chris@16
|
373 // lazy metafunction specialization
|
Chris@16
|
374 template< template< BOOST_MPL_PP_PARAMS(i_, typename T) > class F, typename Tag >
|
Chris@16
|
375 struct BOOST_PP_CAT(quote,i_);
|
Chris@16
|
376
|
Chris@16
|
377 template< BOOST_MPL_PP_PARAMS(i_, typename T) > struct AUX778076_SPEC_NAME;
|
Chris@16
|
378
|
Chris@16
|
379 template<
|
Chris@16
|
380 typename Tag AUX778076_BIND_N_PARAMS(i_, typename T)
|
Chris@16
|
381 >
|
Chris@16
|
382 struct BOOST_PP_CAT(bind,i_)<
|
Chris@16
|
383 BOOST_PP_CAT(quote,i_)<AUX778076_SPEC_NAME,Tag>
|
Chris@16
|
384 AUX778076_BIND_N_PARAMS(i_,T)
|
Chris@16
|
385 >
|
Chris@16
|
386 {
|
Chris@16
|
387 template<
|
Chris@16
|
388 AUX778076_BIND_NESTED_DEFAULT_PARAMS(typename U, na)
|
Chris@16
|
389 >
|
Chris@16
|
390 struct apply
|
Chris@16
|
391 {
|
Chris@16
|
392 private:
|
Chris@16
|
393 typedef mpl::arg<1> n1;
|
Chris@16
|
394 # define BOOST_PP_ITERATION_PARAMS_2 (3,(1, i_, <boost/mpl/bind.hpp>))
|
Chris@16
|
395 # include BOOST_PP_ITERATE()
|
Chris@16
|
396
|
Chris@16
|
397 typedef typename AUX778076_SPEC_NAME<
|
Chris@16
|
398 typename t1::type
|
Chris@16
|
399 , BOOST_MPL_PP_EXT_PARAMS(2, BOOST_PP_INC(i_), t)
|
Chris@16
|
400 >::type f_;
|
Chris@16
|
401
|
Chris@16
|
402 public:
|
Chris@16
|
403 typedef typename f_::type type;
|
Chris@16
|
404 };
|
Chris@16
|
405 };
|
Chris@16
|
406
|
Chris@16
|
407 #undef AUX778076_SPEC_NAME
|
Chris@16
|
408
|
Chris@16
|
409 #else // AUX778076_SPEC_NAME
|
Chris@16
|
410
|
Chris@16
|
411 template<
|
Chris@16
|
412 typename F AUX778076_BIND_N_PARAMS(i_, typename T) AUX778076_DMC_PARAM()
|
Chris@16
|
413 >
|
Chris@16
|
414 struct BOOST_PP_CAT(bind,i_)
|
Chris@16
|
415 {
|
Chris@16
|
416 template<
|
Chris@16
|
417 AUX778076_BIND_NESTED_DEFAULT_PARAMS(typename U, na)
|
Chris@16
|
418 >
|
Chris@16
|
419 struct apply
|
Chris@16
|
420 {
|
Chris@16
|
421 private:
|
Chris@16
|
422 # if !defined(BOOST_MPL_CFG_NO_UNNAMED_PLACEHOLDER_SUPPORT)
|
Chris@16
|
423
|
Chris@16
|
424 typedef aux::replace_unnamed_arg< F,mpl::arg<1> > r0;
|
Chris@16
|
425 typedef typename r0::type a0;
|
Chris@16
|
426 typedef typename r0::next n1;
|
Chris@16
|
427 typedef typename aux::resolve_bind_arg<a0,AUX778076_BIND_PARAMS(U)>::type f_;
|
Chris@16
|
428 ///
|
Chris@16
|
429 # else
|
Chris@16
|
430 typedef typename aux::resolve_bind_arg<F,AUX778076_BIND_PARAMS(U)>::type f_;
|
Chris@16
|
431
|
Chris@16
|
432 # endif // BOOST_MPL_CFG_NO_UNNAMED_PLACEHOLDER_SUPPORT
|
Chris@16
|
433
|
Chris@16
|
434 # if i_ > 0
|
Chris@16
|
435 # define BOOST_PP_ITERATION_PARAMS_2 (3,(1, i_, <boost/mpl/bind.hpp>))
|
Chris@16
|
436 # include BOOST_PP_ITERATE()
|
Chris@16
|
437 # endif
|
Chris@16
|
438
|
Chris@16
|
439 public:
|
Chris@16
|
440
|
Chris@16
|
441 # define AUX778076_ARG(unused, i_, t) \
|
Chris@16
|
442 BOOST_PP_COMMA_IF(i_) \
|
Chris@16
|
443 typename BOOST_PP_CAT(t,BOOST_PP_INC(i_))::type \
|
Chris@16
|
444 /**/
|
Chris@16
|
445
|
Chris@16
|
446 typedef typename BOOST_PP_CAT(apply_wrap,i_)<
|
Chris@16
|
447 f_
|
Chris@16
|
448 BOOST_PP_COMMA_IF(i_) BOOST_MPL_PP_REPEAT(i_, AUX778076_ARG, t)
|
Chris@16
|
449 >::type type;
|
Chris@16
|
450
|
Chris@16
|
451 # undef AUX778076_ARG
|
Chris@16
|
452 };
|
Chris@16
|
453 };
|
Chris@16
|
454
|
Chris@16
|
455 namespace aux {
|
Chris@16
|
456
|
Chris@16
|
457 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
Chris@16
|
458
|
Chris@16
|
459 template<
|
Chris@16
|
460 typename F AUX778076_BIND_N_PARAMS(i_, typename T), AUX778076_BIND_PARAMS(typename U)
|
Chris@16
|
461 >
|
Chris@16
|
462 struct resolve_bind_arg<
|
Chris@16
|
463 BOOST_PP_CAT(bind,i_)<F AUX778076_BIND_N_PARAMS(i_,T)>,AUX778076_BIND_PARAMS(U)
|
Chris@16
|
464 >
|
Chris@16
|
465 {
|
Chris@16
|
466 typedef BOOST_PP_CAT(bind,i_)<F AUX778076_BIND_N_PARAMS(i_,T)> f_;
|
Chris@16
|
467 typedef typename AUX778076_APPLY<f_, AUX778076_BIND_PARAMS(U)>::type type;
|
Chris@16
|
468 };
|
Chris@16
|
469
|
Chris@16
|
470 #else
|
Chris@16
|
471
|
Chris@16
|
472 template<
|
Chris@16
|
473 typename F AUX778076_BIND_N_PARAMS(i_, typename T)
|
Chris@16
|
474 >
|
Chris@16
|
475 aux::yes_tag
|
Chris@16
|
476 is_bind_helper(BOOST_PP_CAT(bind,i_)<F AUX778076_BIND_N_PARAMS(i_,T)>*);
|
Chris@16
|
477
|
Chris@16
|
478 #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
Chris@16
|
479
|
Chris@16
|
480 } // namespace aux
|
Chris@16
|
481
|
Chris@16
|
482 BOOST_MPL_AUX_ARITY_SPEC(BOOST_PP_INC(i_), BOOST_PP_CAT(bind,i_))
|
Chris@16
|
483 BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(BOOST_PP_INC(i_), BOOST_PP_CAT(bind,i_))
|
Chris@16
|
484
|
Chris@16
|
485 # if !defined(BOOST_MPL_CFG_NO_BIND_TEMPLATE)
|
Chris@16
|
486 # if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
Chris@16
|
487
|
Chris@16
|
488 #if i_ == BOOST_MPL_LIMIT_METAFUNCTION_ARITY
|
Chris@16
|
489 /// primary template (not a specialization!)
|
Chris@16
|
490 template<
|
Chris@16
|
491 typename F AUX778076_BIND_N_PARAMS(i_, typename T) AUX778076_DMC_PARAM()
|
Chris@16
|
492 >
|
Chris@16
|
493 struct bind
|
Chris@16
|
494 : BOOST_PP_CAT(bind,i_)<F AUX778076_BIND_N_PARAMS(i_,T) >
|
Chris@16
|
495 {
|
Chris@16
|
496 };
|
Chris@16
|
497 #else
|
Chris@16
|
498 template<
|
Chris@16
|
499 typename F AUX778076_BIND_N_PARAMS(i_, typename T) AUX778076_DMC_PARAM()
|
Chris@16
|
500 >
|
Chris@16
|
501 struct bind< F AUX778076_BIND_N_SPEC_PARAMS(i_, T, na) >
|
Chris@16
|
502 : BOOST_PP_CAT(bind,i_)<F AUX778076_BIND_N_PARAMS(i_,T) >
|
Chris@16
|
503 {
|
Chris@16
|
504 };
|
Chris@16
|
505 #endif
|
Chris@16
|
506
|
Chris@16
|
507 # else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
Chris@16
|
508
|
Chris@16
|
509 namespace aux {
|
Chris@16
|
510
|
Chris@16
|
511 template<>
|
Chris@16
|
512 struct bind_chooser<i_>
|
Chris@16
|
513 {
|
Chris@16
|
514 template<
|
Chris@16
|
515 typename F, AUX778076_BIND_PARAMS(typename T)
|
Chris@16
|
516 >
|
Chris@16
|
517 struct result_
|
Chris@16
|
518 {
|
Chris@16
|
519 typedef BOOST_PP_CAT(bind,i_)< F AUX778076_BIND_N_PARAMS(i_,T) > type;
|
Chris@16
|
520 };
|
Chris@16
|
521 };
|
Chris@16
|
522
|
Chris@16
|
523 } // namespace aux
|
Chris@16
|
524
|
Chris@16
|
525 # endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
Chris@16
|
526 # endif // BOOST_MPL_CFG_NO_BIND_TEMPLATE
|
Chris@16
|
527
|
Chris@16
|
528 #endif // AUX778076_SPEC_NAME
|
Chris@16
|
529
|
Chris@16
|
530 # undef i_
|
Chris@16
|
531
|
Chris@16
|
532 ///// iteration, depth == 2
|
Chris@16
|
533
|
Chris@16
|
534 #elif BOOST_PP_ITERATION_DEPTH() == 2
|
Chris@16
|
535
|
Chris@16
|
536 # define j_ BOOST_PP_FRAME_ITERATION(2)
|
Chris@16
|
537 # if !defined(BOOST_MPL_CFG_NO_UNNAMED_PLACEHOLDER_SUPPORT)
|
Chris@16
|
538
|
Chris@16
|
539 typedef aux::replace_unnamed_arg< BOOST_PP_CAT(T,j_),BOOST_PP_CAT(n,j_) > BOOST_PP_CAT(r,j_);
|
Chris@16
|
540 typedef typename BOOST_PP_CAT(r,j_)::type BOOST_PP_CAT(a,j_);
|
Chris@16
|
541 typedef typename BOOST_PP_CAT(r,j_)::next BOOST_PP_CAT(n,BOOST_PP_INC(j_));
|
Chris@16
|
542 typedef aux::resolve_bind_arg<BOOST_PP_CAT(a,j_), AUX778076_BIND_PARAMS(U)> BOOST_PP_CAT(t,j_);
|
Chris@16
|
543 ///
|
Chris@16
|
544 # else
|
Chris@16
|
545 typedef aux::resolve_bind_arg< BOOST_PP_CAT(T,j_),AUX778076_BIND_PARAMS(U)> BOOST_PP_CAT(t,j_);
|
Chris@16
|
546
|
Chris@16
|
547 # endif
|
Chris@16
|
548 # undef j_
|
Chris@16
|
549
|
Chris@16
|
550 #endif // BOOST_PP_ITERATION_DEPTH()
|
Chris@16
|
551 #endif // BOOST_PP_IS_ITERATING
|