Chris@16
|
1 // Boost Lambda Library lambda_functor_base.hpp -----------------------------
|
Chris@16
|
2 //
|
Chris@16
|
3 // Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi)
|
Chris@16
|
4 //
|
Chris@16
|
5 // Distributed under the Boost Software License, Version 1.0. (See
|
Chris@16
|
6 // accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
7 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
8 //
|
Chris@16
|
9 // For more information, see www.boost.org
|
Chris@16
|
10
|
Chris@16
|
11 // ------------------------------------------------------------
|
Chris@16
|
12
|
Chris@16
|
13 #ifndef BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_HPP
|
Chris@16
|
14 #define BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_HPP
|
Chris@16
|
15
|
Chris@16
|
16 #include "boost/type_traits/add_reference.hpp"
|
Chris@16
|
17 #include "boost/type_traits/add_const.hpp"
|
Chris@16
|
18 #include "boost/type_traits/remove_const.hpp"
|
Chris@16
|
19 #include "boost/lambda/detail/lambda_fwd.hpp"
|
Chris@16
|
20 #include "boost/lambda/detail/lambda_traits.hpp"
|
Chris@16
|
21
|
Chris@16
|
22 namespace boost {
|
Chris@16
|
23 namespace lambda {
|
Chris@16
|
24
|
Chris@16
|
25 #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
|
Chris@16
|
26 #pragma warning(push)
|
Chris@16
|
27 #pragma warning(disable:4512) //assignment operator could not be generated
|
Chris@16
|
28 #endif
|
Chris@16
|
29
|
Chris@16
|
30 // for return type deductions we wrap bound argument to this class,
|
Chris@16
|
31 // which fulfils the base class contract for lambda_functors
|
Chris@16
|
32 template <class T>
|
Chris@16
|
33 class identity {
|
Chris@16
|
34
|
Chris@16
|
35 T elem;
|
Chris@16
|
36 public:
|
Chris@16
|
37
|
Chris@16
|
38 typedef T element_t;
|
Chris@16
|
39
|
Chris@16
|
40 // take all parameters as const references. Note that non-const references
|
Chris@16
|
41 // stay as they are.
|
Chris@16
|
42 typedef typename boost::add_reference<
|
Chris@16
|
43 typename boost::add_const<T>::type
|
Chris@16
|
44 >::type par_t;
|
Chris@16
|
45
|
Chris@16
|
46 explicit identity(par_t t) : elem(t) {}
|
Chris@16
|
47
|
Chris@16
|
48 template <typename SigArgs>
|
Chris@16
|
49 struct sig { typedef typename boost::remove_const<element_t>::type type; };
|
Chris@16
|
50
|
Chris@16
|
51 template<class RET, CALL_TEMPLATE_ARGS>
|
Chris@16
|
52 RET call(CALL_FORMAL_ARGS) const { CALL_USE_ARGS; return elem; }
|
Chris@16
|
53 };
|
Chris@16
|
54
|
Chris@16
|
55 #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
|
Chris@16
|
56 #pragma warning(pop)
|
Chris@16
|
57 #endif
|
Chris@16
|
58
|
Chris@16
|
59 template <class T>
|
Chris@16
|
60 inline lambda_functor<identity<T&> > var(T& t) { return identity<T&>(t); }
|
Chris@16
|
61
|
Chris@16
|
62 // for lambda functors, var is an identity operator. It was forbidden
|
Chris@16
|
63 // at some point, but we might want to var something that can be a
|
Chris@16
|
64 // non-lambda functor or a lambda functor.
|
Chris@16
|
65 template <class T>
|
Chris@16
|
66 lambda_functor<T> var(const lambda_functor<T>& t) { return t; }
|
Chris@16
|
67
|
Chris@16
|
68 template <class T> struct var_type {
|
Chris@16
|
69 typedef lambda_functor<identity<T&> > type;
|
Chris@16
|
70 };
|
Chris@16
|
71
|
Chris@16
|
72
|
Chris@16
|
73 template <class T>
|
Chris@16
|
74 inline
|
Chris@16
|
75 lambda_functor<identity<typename bound_argument_conversion<const T>::type> >
|
Chris@16
|
76 constant(const T& t) {
|
Chris@16
|
77 return identity<typename bound_argument_conversion<const T>::type>(t);
|
Chris@16
|
78 }
|
Chris@16
|
79 template <class T>
|
Chris@16
|
80 lambda_functor<T> constant(const lambda_functor<T>& t) { return t; }
|
Chris@16
|
81
|
Chris@16
|
82 template <class T> struct constant_type {
|
Chris@16
|
83 typedef
|
Chris@16
|
84 lambda_functor<
|
Chris@16
|
85 identity<typename bound_argument_conversion<const T>::type>
|
Chris@16
|
86 > type;
|
Chris@16
|
87 };
|
Chris@16
|
88
|
Chris@16
|
89
|
Chris@16
|
90
|
Chris@16
|
91 template <class T>
|
Chris@16
|
92 inline lambda_functor<identity<const T&> > constant_ref(const T& t) {
|
Chris@16
|
93 return identity<const T&>(t);
|
Chris@16
|
94 }
|
Chris@16
|
95 template <class T>
|
Chris@16
|
96 lambda_functor<T> constant_ref(const lambda_functor<T>& t) { return t; }
|
Chris@16
|
97
|
Chris@16
|
98 template <class T> struct constant_ref_type {
|
Chris@16
|
99 typedef
|
Chris@16
|
100 lambda_functor<identity<const T&> > type;
|
Chris@16
|
101 };
|
Chris@16
|
102
|
Chris@16
|
103
|
Chris@16
|
104
|
Chris@16
|
105 // as_lambda_functor turns any types to lambda functors
|
Chris@16
|
106 // non-lambda_functors will be bound argument types
|
Chris@16
|
107 template <class T>
|
Chris@16
|
108 struct as_lambda_functor {
|
Chris@16
|
109 typedef typename
|
Chris@16
|
110 detail::remove_reference_and_cv<T>::type plain_T;
|
Chris@16
|
111 typedef typename
|
Chris@16
|
112 detail::IF<is_lambda_functor<plain_T>::value,
|
Chris@16
|
113 plain_T,
|
Chris@16
|
114 lambda_functor<
|
Chris@16
|
115 identity<typename bound_argument_conversion<T>::type>
|
Chris@16
|
116 >
|
Chris@16
|
117 >::RET type;
|
Chris@16
|
118 };
|
Chris@16
|
119
|
Chris@16
|
120 // turns arbitrary objects into lambda functors
|
Chris@16
|
121 template <class T>
|
Chris@16
|
122 inline
|
Chris@16
|
123 lambda_functor<identity<typename bound_argument_conversion<const T>::type> >
|
Chris@16
|
124 to_lambda_functor(const T& t) {
|
Chris@16
|
125 return identity<typename bound_argument_conversion<const T>::type>(t);
|
Chris@16
|
126 }
|
Chris@16
|
127
|
Chris@16
|
128 template <class T>
|
Chris@16
|
129 inline lambda_functor<T>
|
Chris@16
|
130 to_lambda_functor(const lambda_functor<T>& t) {
|
Chris@16
|
131 return t;
|
Chris@16
|
132 }
|
Chris@16
|
133
|
Chris@16
|
134 namespace detail {
|
Chris@16
|
135
|
Chris@16
|
136
|
Chris@16
|
137
|
Chris@16
|
138 // In a call constify_rvals<T>::go(x)
|
Chris@16
|
139 // x should be of type T. If T is a non-reference type, do
|
Chris@16
|
140 // returns x as const reference.
|
Chris@16
|
141 // Otherwise the type doesn't change.
|
Chris@16
|
142 // The purpose of this class is to avoid
|
Chris@16
|
143 // 'cannot bind temporaries to non-const references' errors.
|
Chris@16
|
144 template <class T> struct constify_rvals {
|
Chris@16
|
145 template<class U>
|
Chris@16
|
146 static inline const U& go(const U& u) { return u; }
|
Chris@16
|
147 };
|
Chris@16
|
148
|
Chris@16
|
149 template <class T> struct constify_rvals<T&> {
|
Chris@16
|
150 template<class U>
|
Chris@16
|
151 static inline U& go(U& u) { return u; }
|
Chris@16
|
152 };
|
Chris@16
|
153
|
Chris@16
|
154 // check whether one of the elements of a tuple (cons list) is of type
|
Chris@16
|
155 // null_type. Needed, because the compiler goes ahead and instantiates
|
Chris@16
|
156 // sig template for nullary case even if the nullary operator() is not
|
Chris@16
|
157 // called
|
Chris@16
|
158 template <class T> struct is_null_type
|
Chris@16
|
159 { BOOST_STATIC_CONSTANT(bool, value = false); };
|
Chris@16
|
160
|
Chris@16
|
161 template <> struct is_null_type<null_type>
|
Chris@16
|
162 { BOOST_STATIC_CONSTANT(bool, value = true); };
|
Chris@16
|
163
|
Chris@16
|
164 template<class Tuple> struct has_null_type {
|
Chris@16
|
165 BOOST_STATIC_CONSTANT(bool, value = (is_null_type<typename Tuple::head_type>::value || has_null_type<typename Tuple::tail_type>::value));
|
Chris@16
|
166 };
|
Chris@16
|
167 template<> struct has_null_type<null_type> {
|
Chris@16
|
168 BOOST_STATIC_CONSTANT(bool, value = false);
|
Chris@16
|
169 };
|
Chris@16
|
170
|
Chris@16
|
171
|
Chris@16
|
172 // helpers -------------------
|
Chris@16
|
173
|
Chris@16
|
174
|
Chris@16
|
175 template<class Args, class SigArgs>
|
Chris@16
|
176 class deduce_argument_types_ {
|
Chris@16
|
177 typedef typename as_lambda_functor<typename Args::head_type>::type lf_t;
|
Chris@16
|
178 typedef typename lf_t::inherited::template sig<SigArgs>::type el_t;
|
Chris@16
|
179 public:
|
Chris@16
|
180 typedef
|
Chris@16
|
181 boost::tuples::cons<
|
Chris@16
|
182 el_t,
|
Chris@16
|
183 typename deduce_argument_types_<typename Args::tail_type, SigArgs>::type
|
Chris@16
|
184 > type;
|
Chris@16
|
185 };
|
Chris@16
|
186
|
Chris@16
|
187 template<class SigArgs>
|
Chris@16
|
188 class deduce_argument_types_<null_type, SigArgs> {
|
Chris@16
|
189 public:
|
Chris@16
|
190 typedef null_type type;
|
Chris@16
|
191 };
|
Chris@16
|
192
|
Chris@16
|
193
|
Chris@16
|
194 // // note that tuples cannot have plain function types as elements.
|
Chris@16
|
195 // // Hence, all other types will be non-const, except references to
|
Chris@16
|
196 // // functions.
|
Chris@16
|
197 // template <class T> struct remove_reference_except_from_functions {
|
Chris@16
|
198 // typedef typename boost::remove_reference<T>::type t;
|
Chris@16
|
199 // typedef typename detail::IF<boost::is_function<t>::value, T, t>::RET type;
|
Chris@16
|
200 // };
|
Chris@16
|
201
|
Chris@16
|
202 template<class Args, class SigArgs>
|
Chris@16
|
203 class deduce_non_ref_argument_types_ {
|
Chris@16
|
204 typedef typename as_lambda_functor<typename Args::head_type>::type lf_t;
|
Chris@16
|
205 typedef typename lf_t::inherited::template sig<SigArgs>::type el_t;
|
Chris@16
|
206 public:
|
Chris@16
|
207 typedef
|
Chris@16
|
208 boost::tuples::cons<
|
Chris@16
|
209 // typename detail::remove_reference_except_from_functions<el_t>::type,
|
Chris@16
|
210 typename boost::remove_reference<el_t>::type,
|
Chris@16
|
211 typename deduce_non_ref_argument_types_<typename Args::tail_type, SigArgs>::type
|
Chris@16
|
212 > type;
|
Chris@16
|
213 };
|
Chris@16
|
214
|
Chris@16
|
215 template<class SigArgs>
|
Chris@16
|
216 class deduce_non_ref_argument_types_<null_type, SigArgs> {
|
Chris@16
|
217 public:
|
Chris@16
|
218 typedef null_type type;
|
Chris@16
|
219 };
|
Chris@16
|
220
|
Chris@16
|
221 // -------------
|
Chris@16
|
222
|
Chris@16
|
223 // take stored Args and Open Args, and return a const list with
|
Chris@16
|
224 // deduced elements (real return types)
|
Chris@16
|
225 template<class Args, class SigArgs>
|
Chris@16
|
226 class deduce_argument_types {
|
Chris@16
|
227 typedef typename deduce_argument_types_<Args, SigArgs>::type t1;
|
Chris@16
|
228 public:
|
Chris@16
|
229 typedef typename detail::IF<
|
Chris@16
|
230 has_null_type<t1>::value, null_type, t1
|
Chris@16
|
231 >::RET type;
|
Chris@16
|
232 };
|
Chris@16
|
233
|
Chris@16
|
234 // take stored Args and Open Args, and return a const list with
|
Chris@16
|
235 // deduced elements (references are stripped from the element types)
|
Chris@16
|
236
|
Chris@16
|
237 template<class Args, class SigArgs>
|
Chris@16
|
238 class deduce_non_ref_argument_types {
|
Chris@16
|
239 typedef typename deduce_non_ref_argument_types_<Args, SigArgs>::type t1;
|
Chris@16
|
240 public:
|
Chris@16
|
241 typedef typename detail::IF<
|
Chris@16
|
242 has_null_type<t1>::value, null_type, t1
|
Chris@16
|
243 >::RET type;
|
Chris@16
|
244 };
|
Chris@16
|
245
|
Chris@16
|
246 template <int N, class Args, class SigArgs>
|
Chris@16
|
247 struct nth_return_type_sig {
|
Chris@16
|
248 typedef typename
|
Chris@16
|
249 as_lambda_functor<
|
Chris@16
|
250 typename boost::tuples::element<N, Args>::type
|
Chris@16
|
251 // typename tuple_element_as_reference<N, Args>::type
|
Chris@16
|
252 >::type lf_type;
|
Chris@16
|
253
|
Chris@16
|
254 typedef typename lf_type::inherited::template sig<SigArgs>::type type;
|
Chris@16
|
255 };
|
Chris@16
|
256
|
Chris@16
|
257 template<int N, class Tuple> struct element_or_null {
|
Chris@16
|
258 typedef typename boost::tuples::element<N, Tuple>::type type;
|
Chris@16
|
259 };
|
Chris@16
|
260
|
Chris@16
|
261 template<int N> struct element_or_null<N, null_type> {
|
Chris@16
|
262 typedef null_type type;
|
Chris@16
|
263 };
|
Chris@16
|
264
|
Chris@16
|
265
|
Chris@16
|
266
|
Chris@16
|
267
|
Chris@16
|
268 } // end detail
|
Chris@16
|
269
|
Chris@16
|
270 // -- lambda_functor base ---------------------
|
Chris@16
|
271
|
Chris@16
|
272 // the explicit_return_type_action case -----------------------------------
|
Chris@16
|
273 template<class RET, class Args>
|
Chris@16
|
274 class lambda_functor_base<explicit_return_type_action<RET>, Args>
|
Chris@16
|
275 {
|
Chris@16
|
276 public:
|
Chris@16
|
277 Args args;
|
Chris@16
|
278
|
Chris@16
|
279 typedef RET result_type;
|
Chris@16
|
280
|
Chris@16
|
281 explicit lambda_functor_base(const Args& a) : args(a) {}
|
Chris@16
|
282
|
Chris@16
|
283 template <class SigArgs> struct sig { typedef RET type; };
|
Chris@16
|
284
|
Chris@16
|
285 template<class RET_, CALL_TEMPLATE_ARGS>
|
Chris@16
|
286 RET call(CALL_FORMAL_ARGS) const
|
Chris@16
|
287 {
|
Chris@16
|
288 return detail::constify_rvals<RET>::go(
|
Chris@16
|
289 detail::r_select<RET>::go(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS));
|
Chris@16
|
290 }
|
Chris@16
|
291 };
|
Chris@16
|
292
|
Chris@16
|
293 // the protect_action case -----------------------------------
|
Chris@16
|
294 template<class Args>
|
Chris@16
|
295 class lambda_functor_base<protect_action, Args>
|
Chris@16
|
296 {
|
Chris@16
|
297 public:
|
Chris@16
|
298 Args args;
|
Chris@16
|
299 public:
|
Chris@16
|
300
|
Chris@16
|
301 explicit lambda_functor_base(const Args& a) : args(a) {}
|
Chris@16
|
302
|
Chris@16
|
303
|
Chris@16
|
304 template<class RET, CALL_TEMPLATE_ARGS>
|
Chris@16
|
305 RET call(CALL_FORMAL_ARGS) const
|
Chris@16
|
306 {
|
Chris@16
|
307 CALL_USE_ARGS;
|
Chris@16
|
308 return boost::tuples::get<0>(args);
|
Chris@16
|
309 }
|
Chris@16
|
310
|
Chris@16
|
311 template<class SigArgs> struct sig {
|
Chris@16
|
312 // typedef typename detail::tuple_element_as_reference<0, SigArgs>::type type;
|
Chris@16
|
313 typedef typename boost::tuples::element<0, Args>::type type;
|
Chris@16
|
314 };
|
Chris@16
|
315 };
|
Chris@16
|
316
|
Chris@16
|
317 // Do nothing --------------------------------------------------------
|
Chris@16
|
318 class do_nothing_action {};
|
Chris@16
|
319
|
Chris@16
|
320 template<class Args>
|
Chris@16
|
321 class lambda_functor_base<do_nothing_action, Args> {
|
Chris@16
|
322 // Args args;
|
Chris@16
|
323 public:
|
Chris@16
|
324 // explicit lambda_functor_base(const Args& a) {}
|
Chris@16
|
325 lambda_functor_base() {}
|
Chris@16
|
326
|
Chris@16
|
327
|
Chris@16
|
328 template<class RET, CALL_TEMPLATE_ARGS> RET call(CALL_FORMAL_ARGS) const {
|
Chris@16
|
329 return CALL_USE_ARGS;
|
Chris@16
|
330 }
|
Chris@16
|
331
|
Chris@16
|
332 template<class SigArgs> struct sig { typedef void type; };
|
Chris@16
|
333 };
|
Chris@16
|
334
|
Chris@16
|
335
|
Chris@16
|
336 // These specializations provide a shorter notation to define actions.
|
Chris@16
|
337 // These lambda_functor_base instances take care of the recursive evaluation
|
Chris@16
|
338 // of the arguments and pass the evaluated arguments to the apply function
|
Chris@16
|
339 // of an action class. To make action X work with these classes, one must
|
Chris@16
|
340 // instantiate the lambda_functor_base as:
|
Chris@16
|
341 // lambda_functor_base<action<ARITY, X>, Args>
|
Chris@16
|
342 // Where ARITY is the arity of the apply function in X
|
Chris@16
|
343
|
Chris@16
|
344 // The return type is queried as:
|
Chris@16
|
345 // return_type_N<X, EvaluatedArgumentTypes>::type
|
Chris@16
|
346 // for which there must be a specialization.
|
Chris@16
|
347
|
Chris@16
|
348 // Function actions, casts, throws,... all go via these classes.
|
Chris@16
|
349
|
Chris@16
|
350
|
Chris@16
|
351 template<class Act, class Args>
|
Chris@16
|
352 class lambda_functor_base<action<0, Act>, Args>
|
Chris@16
|
353 {
|
Chris@16
|
354 public:
|
Chris@16
|
355 // Args args; not needed
|
Chris@16
|
356 explicit lambda_functor_base(const Args& /*a*/) {}
|
Chris@16
|
357
|
Chris@16
|
358 template<class SigArgs> struct sig {
|
Chris@16
|
359 typedef typename return_type_N<Act, null_type>::type type;
|
Chris@16
|
360 };
|
Chris@16
|
361
|
Chris@16
|
362 template<class RET, CALL_TEMPLATE_ARGS>
|
Chris@16
|
363 RET call(CALL_FORMAL_ARGS) const {
|
Chris@16
|
364 CALL_USE_ARGS;
|
Chris@16
|
365 return Act::template apply<RET>();
|
Chris@16
|
366 }
|
Chris@16
|
367 };
|
Chris@16
|
368
|
Chris@16
|
369
|
Chris@16
|
370 #if defined BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART
|
Chris@16
|
371 #error "Multiple defines of BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART"
|
Chris@16
|
372 #endif
|
Chris@16
|
373
|
Chris@16
|
374
|
Chris@16
|
375 #define BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(ARITY) \
|
Chris@16
|
376 template<class Act, class Args> \
|
Chris@16
|
377 class lambda_functor_base<action<ARITY, Act>, Args> \
|
Chris@16
|
378 { \
|
Chris@16
|
379 public: \
|
Chris@16
|
380 Args args; \
|
Chris@16
|
381 \
|
Chris@16
|
382 explicit lambda_functor_base(const Args& a) : args(a) {} \
|
Chris@16
|
383 \
|
Chris@16
|
384 template<class SigArgs> struct sig { \
|
Chris@16
|
385 typedef typename \
|
Chris@16
|
386 detail::deduce_argument_types<Args, SigArgs>::type rets_t; \
|
Chris@16
|
387 public: \
|
Chris@16
|
388 typedef typename \
|
Chris@16
|
389 return_type_N_prot<Act, rets_t>::type type; \
|
Chris@16
|
390 }; \
|
Chris@16
|
391 \
|
Chris@16
|
392 \
|
Chris@16
|
393 template<class RET, CALL_TEMPLATE_ARGS> \
|
Chris@16
|
394 RET call(CALL_FORMAL_ARGS) const { \
|
Chris@16
|
395 using boost::tuples::get; \
|
Chris@16
|
396 using detail::constify_rvals; \
|
Chris@16
|
397 using detail::r_select; \
|
Chris@16
|
398 using detail::element_or_null; \
|
Chris@16
|
399 using detail::deduce_argument_types;
|
Chris@16
|
400
|
Chris@16
|
401 BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(1)
|
Chris@16
|
402
|
Chris@16
|
403 typedef typename
|
Chris@16
|
404 deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t;
|
Chris@16
|
405 typedef typename element_or_null<0, rets_t>::type rt0;
|
Chris@16
|
406
|
Chris@16
|
407 return Act::template apply<RET>(
|
Chris@16
|
408 constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS))
|
Chris@16
|
409 );
|
Chris@16
|
410 }
|
Chris@16
|
411 };
|
Chris@16
|
412
|
Chris@16
|
413
|
Chris@16
|
414 BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(2)
|
Chris@16
|
415
|
Chris@16
|
416 typedef typename
|
Chris@16
|
417 deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t;
|
Chris@16
|
418 typedef typename element_or_null<0, rets_t>::type rt0;
|
Chris@16
|
419 typedef typename element_or_null<1, rets_t>::type rt1;
|
Chris@16
|
420
|
Chris@16
|
421 return Act::template apply<RET>(
|
Chris@16
|
422 constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)),
|
Chris@16
|
423 constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS))
|
Chris@16
|
424 );
|
Chris@16
|
425 }
|
Chris@16
|
426 };
|
Chris@16
|
427
|
Chris@16
|
428 BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(3)
|
Chris@16
|
429
|
Chris@16
|
430 typedef typename
|
Chris@16
|
431 deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t;
|
Chris@16
|
432
|
Chris@16
|
433 typedef typename element_or_null<0, rets_t>::type rt0;
|
Chris@16
|
434 typedef typename element_or_null<1, rets_t>::type rt1;
|
Chris@16
|
435 typedef typename element_or_null<2, rets_t>::type rt2;
|
Chris@16
|
436
|
Chris@16
|
437 return Act::template apply<RET>(
|
Chris@16
|
438 constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)),
|
Chris@16
|
439 constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)),
|
Chris@16
|
440 constify_rvals<rt2>::go(r_select<rt2>::go(get<2>(args), CALL_ACTUAL_ARGS))
|
Chris@16
|
441 );
|
Chris@16
|
442 }
|
Chris@16
|
443 };
|
Chris@16
|
444
|
Chris@16
|
445 BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(4)
|
Chris@16
|
446 typedef typename
|
Chris@16
|
447 deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t;
|
Chris@16
|
448 typedef typename element_or_null<0, rets_t>::type rt0;
|
Chris@16
|
449 typedef typename element_or_null<1, rets_t>::type rt1;
|
Chris@16
|
450 typedef typename element_or_null<2, rets_t>::type rt2;
|
Chris@16
|
451 typedef typename element_or_null<3, rets_t>::type rt3;
|
Chris@16
|
452
|
Chris@16
|
453 return Act::template apply<RET>(
|
Chris@16
|
454 constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)),
|
Chris@16
|
455 constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)),
|
Chris@16
|
456 constify_rvals<rt2>::go(r_select<rt2>::go(get<2>(args), CALL_ACTUAL_ARGS)),
|
Chris@16
|
457 constify_rvals<rt3>::go(r_select<rt3>::go(get<3>(args), CALL_ACTUAL_ARGS))
|
Chris@16
|
458 );
|
Chris@16
|
459 }
|
Chris@16
|
460 };
|
Chris@16
|
461
|
Chris@16
|
462 BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(5)
|
Chris@16
|
463 typedef typename
|
Chris@16
|
464 deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t;
|
Chris@16
|
465 typedef typename element_or_null<0, rets_t>::type rt0;
|
Chris@16
|
466 typedef typename element_or_null<1, rets_t>::type rt1;
|
Chris@16
|
467 typedef typename element_or_null<2, rets_t>::type rt2;
|
Chris@16
|
468 typedef typename element_or_null<3, rets_t>::type rt3;
|
Chris@16
|
469 typedef typename element_or_null<4, rets_t>::type rt4;
|
Chris@16
|
470
|
Chris@16
|
471 return Act::template apply<RET>(
|
Chris@16
|
472 constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)),
|
Chris@16
|
473 constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)),
|
Chris@16
|
474 constify_rvals<rt2>::go(r_select<rt2>::go(get<2>(args), CALL_ACTUAL_ARGS)),
|
Chris@16
|
475 constify_rvals<rt3>::go(r_select<rt3>::go(get<3>(args), CALL_ACTUAL_ARGS)),
|
Chris@16
|
476 constify_rvals<rt4>::go(r_select<rt4>::go(get<4>(args), CALL_ACTUAL_ARGS))
|
Chris@16
|
477 );
|
Chris@16
|
478 }
|
Chris@16
|
479 };
|
Chris@16
|
480
|
Chris@16
|
481 BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(6)
|
Chris@16
|
482
|
Chris@16
|
483 typedef typename
|
Chris@16
|
484 deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t;
|
Chris@16
|
485 typedef typename element_or_null<0, rets_t>::type rt0;
|
Chris@16
|
486 typedef typename element_or_null<1, rets_t>::type rt1;
|
Chris@16
|
487 typedef typename element_or_null<2, rets_t>::type rt2;
|
Chris@16
|
488 typedef typename element_or_null<3, rets_t>::type rt3;
|
Chris@16
|
489 typedef typename element_or_null<4, rets_t>::type rt4;
|
Chris@16
|
490 typedef typename element_or_null<5, rets_t>::type rt5;
|
Chris@16
|
491
|
Chris@16
|
492
|
Chris@16
|
493 return Act::template apply<RET>(
|
Chris@16
|
494 constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)),
|
Chris@16
|
495 constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)),
|
Chris@16
|
496 constify_rvals<rt2>::go(r_select<rt2>::go(get<2>(args), CALL_ACTUAL_ARGS)),
|
Chris@16
|
497 constify_rvals<rt3>::go(r_select<rt3>::go(get<3>(args), CALL_ACTUAL_ARGS)),
|
Chris@16
|
498 constify_rvals<rt4>::go(r_select<rt4>::go(get<4>(args), CALL_ACTUAL_ARGS)),
|
Chris@16
|
499 constify_rvals<rt5>::go(r_select<rt5>::go(get<5>(args), CALL_ACTUAL_ARGS))
|
Chris@16
|
500 );
|
Chris@16
|
501 }
|
Chris@16
|
502 };
|
Chris@16
|
503
|
Chris@16
|
504 BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(7)
|
Chris@16
|
505 typedef typename
|
Chris@16
|
506 deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t;
|
Chris@16
|
507 typedef typename element_or_null<0, rets_t>::type rt0;
|
Chris@16
|
508 typedef typename element_or_null<1, rets_t>::type rt1;
|
Chris@16
|
509 typedef typename element_or_null<2, rets_t>::type rt2;
|
Chris@16
|
510 typedef typename element_or_null<3, rets_t>::type rt3;
|
Chris@16
|
511 typedef typename element_or_null<4, rets_t>::type rt4;
|
Chris@16
|
512 typedef typename element_or_null<5, rets_t>::type rt5;
|
Chris@16
|
513 typedef typename element_or_null<6, rets_t>::type rt6;
|
Chris@16
|
514
|
Chris@16
|
515
|
Chris@16
|
516 return Act::template apply<RET>(
|
Chris@16
|
517 constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)),
|
Chris@16
|
518 constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)),
|
Chris@16
|
519 constify_rvals<rt2>::go(r_select<rt2>::go(get<2>(args), CALL_ACTUAL_ARGS)),
|
Chris@16
|
520 constify_rvals<rt3>::go(r_select<rt3>::go(get<3>(args), CALL_ACTUAL_ARGS)),
|
Chris@16
|
521 constify_rvals<rt4>::go(r_select<rt4>::go(get<4>(args), CALL_ACTUAL_ARGS)),
|
Chris@16
|
522 constify_rvals<rt5>::go(r_select<rt5>::go(get<5>(args), CALL_ACTUAL_ARGS)),
|
Chris@16
|
523 constify_rvals<rt6>::go(r_select<rt6>::go(get<6>(args), CALL_ACTUAL_ARGS))
|
Chris@16
|
524 );
|
Chris@16
|
525 }
|
Chris@16
|
526 };
|
Chris@16
|
527
|
Chris@16
|
528 BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(8)
|
Chris@16
|
529 typedef typename
|
Chris@16
|
530 deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t;
|
Chris@16
|
531 typedef typename element_or_null<0, rets_t>::type rt0;
|
Chris@16
|
532 typedef typename element_or_null<1, rets_t>::type rt1;
|
Chris@16
|
533 typedef typename element_or_null<2, rets_t>::type rt2;
|
Chris@16
|
534 typedef typename element_or_null<3, rets_t>::type rt3;
|
Chris@16
|
535 typedef typename element_or_null<4, rets_t>::type rt4;
|
Chris@16
|
536 typedef typename element_or_null<5, rets_t>::type rt5;
|
Chris@16
|
537 typedef typename element_or_null<6, rets_t>::type rt6;
|
Chris@16
|
538 typedef typename element_or_null<7, rets_t>::type rt7;
|
Chris@16
|
539
|
Chris@16
|
540 return Act::template apply<RET>(
|
Chris@16
|
541 constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)),
|
Chris@16
|
542 constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)),
|
Chris@16
|
543 constify_rvals<rt2>::go(r_select<rt2>::go(get<2>(args), CALL_ACTUAL_ARGS)),
|
Chris@16
|
544 constify_rvals<rt3>::go(r_select<rt3>::go(get<3>(args), CALL_ACTUAL_ARGS)),
|
Chris@16
|
545 constify_rvals<rt4>::go(r_select<rt4>::go(get<4>(args), CALL_ACTUAL_ARGS)),
|
Chris@16
|
546 constify_rvals<rt5>::go(r_select<rt5>::go(get<5>(args), CALL_ACTUAL_ARGS)),
|
Chris@16
|
547 constify_rvals<rt6>::go(r_select<rt6>::go(get<6>(args), CALL_ACTUAL_ARGS)),
|
Chris@16
|
548 constify_rvals<rt7>::go(r_select<rt7>::go(get<7>(args), CALL_ACTUAL_ARGS))
|
Chris@16
|
549 );
|
Chris@16
|
550 }
|
Chris@16
|
551 };
|
Chris@16
|
552
|
Chris@16
|
553 BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(9)
|
Chris@16
|
554 typedef typename
|
Chris@16
|
555 deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t;
|
Chris@16
|
556 typedef typename element_or_null<0, rets_t>::type rt0;
|
Chris@16
|
557 typedef typename element_or_null<1, rets_t>::type rt1;
|
Chris@16
|
558 typedef typename element_or_null<2, rets_t>::type rt2;
|
Chris@16
|
559 typedef typename element_or_null<3, rets_t>::type rt3;
|
Chris@16
|
560 typedef typename element_or_null<4, rets_t>::type rt4;
|
Chris@16
|
561 typedef typename element_or_null<5, rets_t>::type rt5;
|
Chris@16
|
562 typedef typename element_or_null<6, rets_t>::type rt6;
|
Chris@16
|
563 typedef typename element_or_null<7, rets_t>::type rt7;
|
Chris@16
|
564 typedef typename element_or_null<8, rets_t>::type rt8;
|
Chris@16
|
565
|
Chris@16
|
566 return Act::template apply<RET>(
|
Chris@16
|
567 constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)),
|
Chris@16
|
568 constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)),
|
Chris@16
|
569 constify_rvals<rt2>::go(r_select<rt2>::go(get<2>(args), CALL_ACTUAL_ARGS)),
|
Chris@16
|
570 constify_rvals<rt3>::go(r_select<rt3>::go(get<3>(args), CALL_ACTUAL_ARGS)),
|
Chris@16
|
571 constify_rvals<rt4>::go(r_select<rt4>::go(get<4>(args), CALL_ACTUAL_ARGS)),
|
Chris@16
|
572 constify_rvals<rt5>::go(r_select<rt5>::go(get<5>(args), CALL_ACTUAL_ARGS)),
|
Chris@16
|
573 constify_rvals<rt6>::go(r_select<rt6>::go(get<6>(args), CALL_ACTUAL_ARGS)),
|
Chris@16
|
574 constify_rvals<rt7>::go(r_select<rt7>::go(get<7>(args), CALL_ACTUAL_ARGS)),
|
Chris@16
|
575 constify_rvals<rt8>::go(r_select<rt8>::go(get<8>(args), CALL_ACTUAL_ARGS))
|
Chris@16
|
576 );
|
Chris@16
|
577 }
|
Chris@16
|
578 };
|
Chris@16
|
579
|
Chris@16
|
580 BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(10)
|
Chris@16
|
581 typedef typename
|
Chris@16
|
582 deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t;
|
Chris@16
|
583 typedef typename element_or_null<0, rets_t>::type rt0;
|
Chris@16
|
584 typedef typename element_or_null<1, rets_t>::type rt1;
|
Chris@16
|
585 typedef typename element_or_null<2, rets_t>::type rt2;
|
Chris@16
|
586 typedef typename element_or_null<3, rets_t>::type rt3;
|
Chris@16
|
587 typedef typename element_or_null<4, rets_t>::type rt4;
|
Chris@16
|
588 typedef typename element_or_null<5, rets_t>::type rt5;
|
Chris@16
|
589 typedef typename element_or_null<6, rets_t>::type rt6;
|
Chris@16
|
590 typedef typename element_or_null<7, rets_t>::type rt7;
|
Chris@16
|
591 typedef typename element_or_null<8, rets_t>::type rt8;
|
Chris@16
|
592 typedef typename element_or_null<9, rets_t>::type rt9;
|
Chris@16
|
593
|
Chris@16
|
594 return Act::template apply<RET>(
|
Chris@16
|
595 constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)),
|
Chris@16
|
596 constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)),
|
Chris@16
|
597 constify_rvals<rt2>::go(r_select<rt2>::go(get<2>(args), CALL_ACTUAL_ARGS)),
|
Chris@16
|
598 constify_rvals<rt3>::go(r_select<rt3>::go(get<3>(args), CALL_ACTUAL_ARGS)),
|
Chris@16
|
599 constify_rvals<rt4>::go(r_select<rt4>::go(get<4>(args), CALL_ACTUAL_ARGS)),
|
Chris@16
|
600 constify_rvals<rt5>::go(r_select<rt5>::go(get<5>(args), CALL_ACTUAL_ARGS)),
|
Chris@16
|
601 constify_rvals<rt6>::go(r_select<rt6>::go(get<6>(args), CALL_ACTUAL_ARGS)),
|
Chris@16
|
602 constify_rvals<rt7>::go(r_select<rt7>::go(get<7>(args), CALL_ACTUAL_ARGS)),
|
Chris@16
|
603 constify_rvals<rt8>::go(r_select<rt8>::go(get<8>(args), CALL_ACTUAL_ARGS)),
|
Chris@16
|
604 constify_rvals<rt9>::go(r_select<rt9>::go(get<9>(args), CALL_ACTUAL_ARGS))
|
Chris@16
|
605 );
|
Chris@16
|
606 }
|
Chris@16
|
607 };
|
Chris@16
|
608
|
Chris@16
|
609 #undef BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART
|
Chris@16
|
610
|
Chris@16
|
611
|
Chris@16
|
612 } // namespace lambda
|
Chris@16
|
613 } // namespace boost
|
Chris@16
|
614
|
Chris@16
|
615 #endif
|