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