1 | // -- Boost Lambda Library -- exceptions.hpp ----------------
|
---|
2 | //
|
---|
3 | // Copyright (C) 2000 Gary Powell (gwpowell@hotmail.com)
|
---|
4 | // Copyright (C) 1999, 2000 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
|
---|
5 | //
|
---|
6 | // Distributed under the Boost Software License, Version 1.0. (See
|
---|
7 | // accompanying file LICENSE_1_0.txt or copy at
|
---|
8 | // http://www.boost.org/LICENSE_1_0.txt)
|
---|
9 | //
|
---|
10 | // For more information, see http://www.boost.org
|
---|
11 |
|
---|
12 | // -----------------------------------------------------
|
---|
13 |
|
---|
14 | #if !defined(BOOST_LAMBDA_EXCEPTIONS_HPP)
|
---|
15 | #define BOOST_LAMBDA_EXCEPTIONS_HPP
|
---|
16 |
|
---|
17 | #include "boost/lambda/detail/control_constructs_common.hpp"
|
---|
18 |
|
---|
19 | namespace boost {
|
---|
20 | namespace lambda {
|
---|
21 |
|
---|
22 | typedef lambda_functor<placeholder<EXCEPTION> > placeholderE_type;
|
---|
23 |
|
---|
24 | namespace {
|
---|
25 | boost::lambda::placeholderE_type freeE;
|
---|
26 | boost::lambda::placeholderE_type& _e = freeE;
|
---|
27 | }
|
---|
28 |
|
---|
29 | // -- exception related actions -------------------
|
---|
30 |
|
---|
31 | // catch actions.
|
---|
32 | template <class Catch1, class Catch2 = null_type, class Catch3 = null_type,
|
---|
33 | class Catch4 = null_type, class Catch5 = null_type,
|
---|
34 | class Catch6 = null_type, class Catch7 = null_type,
|
---|
35 | class Catch8 = null_type, class Catch9 = null_type,
|
---|
36 | class Catch10 = null_type>
|
---|
37 | struct catch_action {};
|
---|
38 |
|
---|
39 | struct catch_all_action {};
|
---|
40 |
|
---|
41 | template<class CatchActions>
|
---|
42 | struct return_try_catch_action {};
|
---|
43 |
|
---|
44 | template<class CatchActions>
|
---|
45 | struct try_catch_action {};
|
---|
46 |
|
---|
47 | // rethrow actions
|
---|
48 | struct throw_new_action {};
|
---|
49 | struct rethrow_action {};
|
---|
50 |
|
---|
51 | template<class ThrowType> struct throw_action;
|
---|
52 |
|
---|
53 | template<>
|
---|
54 | struct throw_action<rethrow_action> {
|
---|
55 | template<class RET>
|
---|
56 | static RET apply() {
|
---|
57 | throw;
|
---|
58 | }
|
---|
59 | };
|
---|
60 |
|
---|
61 | template<> struct throw_action<throw_new_action> {
|
---|
62 | template<class RET, class T>
|
---|
63 | static RET apply(T& t) {
|
---|
64 | throw t;
|
---|
65 | }
|
---|
66 | };
|
---|
67 |
|
---|
68 | // return types for throw_actions --------------------------------------------
|
---|
69 |
|
---|
70 | template<class T, class Any>
|
---|
71 | struct
|
---|
72 | return_type_N<throw_action<T>, Any> {
|
---|
73 | typedef void type;
|
---|
74 | };
|
---|
75 |
|
---|
76 |
|
---|
77 | // return types deductions -------------------------------------------------
|
---|
78 |
|
---|
79 | // the return type of try_catch is the return type of the try lambda_functor
|
---|
80 | // (the return types of try and catch parts must match unless try returns void
|
---|
81 | // or the catch part throws for sure)
|
---|
82 |
|
---|
83 | // NOTE, the exception placeholder deduction rule is defined
|
---|
84 | // in return_type_traits.hpp
|
---|
85 |
|
---|
86 |
|
---|
87 |
|
---|
88 | // defined in control_constructs
|
---|
89 | class ifthenelse_action;
|
---|
90 |
|
---|
91 | namespace detail {
|
---|
92 |
|
---|
93 | // Templates for deducing, wether a lambda_functor throws inevitably of not -
|
---|
94 | // This mechanism is needed to make the compiler happy about
|
---|
95 | // return types of try and catch parts.
|
---|
96 |
|
---|
97 | // a lambda_functor throws for sure if:
|
---|
98 | // - it is a throw expression
|
---|
99 | // - it is a comma expression, and one of its arguments throws for sure
|
---|
100 | // - it is an if_then_else expression and either the if statement or both
|
---|
101 | // the then and else throw.
|
---|
102 | // (there are other cases as well, but we do not cover them)
|
---|
103 | // e.g. _1 + (rethrow(), 3) does throw for sure but this is not checked
|
---|
104 | // This implies, that in such a case, the return types of try and catch parts
|
---|
105 | // must match if the try part returns other than void.
|
---|
106 | // (Such checks could be done though)
|
---|
107 |
|
---|
108 | template <class Arg>
|
---|
109 | struct throws_for_sure_phase2 {
|
---|
110 | static const bool value = false;
|
---|
111 | };
|
---|
112 |
|
---|
113 | template <int N, class ThrowType, class Args>
|
---|
114 | struct throws_for_sure_phase2<
|
---|
115 | lambda_functor<
|
---|
116 | lambda_functor_base<action<N, throw_action<ThrowType> >, Args>
|
---|
117 | >
|
---|
118 | >
|
---|
119 | {
|
---|
120 | static const bool value = true;
|
---|
121 | };
|
---|
122 |
|
---|
123 | // Both then and else or the if throw of an if_then_else.
|
---|
124 | template <class Args>
|
---|
125 | struct throws_for_sure_phase2<
|
---|
126 | lambda_functor<
|
---|
127 | lambda_functor_base<
|
---|
128 | ifthenelse_action, Args
|
---|
129 | >
|
---|
130 | >
|
---|
131 | >
|
---|
132 | {
|
---|
133 | static const bool value =
|
---|
134 | throws_for_sure_phase2<
|
---|
135 | typename boost::tuples::element<0, Args>::type>::value
|
---|
136 | ||
|
---|
137 | (
|
---|
138 | throws_for_sure_phase2<
|
---|
139 | typename boost::tuples::element<1, Args>::type
|
---|
140 | >::value
|
---|
141 | &&
|
---|
142 | throws_for_sure_phase2<
|
---|
143 | typename boost::tuples::element<2, Args>::type
|
---|
144 | >::value
|
---|
145 | );
|
---|
146 | };
|
---|
147 |
|
---|
148 | template <class Args>
|
---|
149 | struct throws_for_sure_phase2<
|
---|
150 | lambda_functor<
|
---|
151 | lambda_functor_base< other_action<comma_action>, Args>
|
---|
152 | >
|
---|
153 | >
|
---|
154 | {
|
---|
155 | static const bool value =
|
---|
156 | throws_for_sure_phase2<
|
---|
157 | typename boost::tuples::element<0, Args>::type
|
---|
158 | >::value
|
---|
159 | ||
|
---|
160 | throws_for_sure_phase2<
|
---|
161 | typename boost::tuples::element<1, Args>::type
|
---|
162 | >::value;
|
---|
163 | };
|
---|
164 |
|
---|
165 | // get rid of any qualifiers and references
|
---|
166 | // lambda_functors should be stored like that, so this is to be extra sure
|
---|
167 | template <class Arg>
|
---|
168 | struct throws_for_sure {
|
---|
169 | static const bool value
|
---|
170 | = throws_for_sure_phase2<
|
---|
171 | typename detail::remove_reference_and_cv<Arg>::type
|
---|
172 | >::value;
|
---|
173 | };
|
---|
174 |
|
---|
175 |
|
---|
176 | // -- return_or_throw templates -----------------------------
|
---|
177 |
|
---|
178 | // false case, catch and try return types are incompatible
|
---|
179 | // Now the catch part must throw for sure, otherwise a compile time error
|
---|
180 | // occurs.
|
---|
181 | template<bool is_conversion>
|
---|
182 | struct return_or_throw_phase2 {
|
---|
183 | template<class RET, class Arg, CALL_TEMPLATE_ARGS>
|
---|
184 | static RET call(Arg& arg, CALL_FORMAL_ARGS) {
|
---|
185 | BOOST_STATIC_ASSERT(throws_for_sure<Arg>::value);
|
---|
186 | detail::select(arg, CALL_ACTUAL_ARGS); // this line throws
|
---|
187 | throw 1; // this line is never performed, hence 1 is just a dummy
|
---|
188 | // The line is needed to make compiler happy and not require
|
---|
189 | // a matching return type
|
---|
190 | }
|
---|
191 | };
|
---|
192 |
|
---|
193 | // the try and catch return types are compatible
|
---|
194 | template<>
|
---|
195 | struct return_or_throw_phase2<true> {
|
---|
196 | template<class RET, class Arg, CALL_TEMPLATE_ARGS>
|
---|
197 | static RET call(Arg& arg, CALL_FORMAL_ARGS) {
|
---|
198 | return detail::select(arg, CALL_ACTUAL_ARGS);
|
---|
199 | }
|
---|
200 | };
|
---|
201 |
|
---|
202 |
|
---|
203 | // the non-void case. Try part returns a value, so catch parts must
|
---|
204 | // return a value of the same type or throw
|
---|
205 | template<class RET, class ARG>
|
---|
206 | struct return_or_throw {
|
---|
207 | // Arg should be equal to ARG except that ARG may be a reference
|
---|
208 | // to be sure, that there are no suprises for peculiarly defined return types
|
---|
209 | // ARG is passed explicitely
|
---|
210 | template<class Arg, CALL_TEMPLATE_ARGS>
|
---|
211 | static RET call(Arg& arg, CALL_FORMAL_ARGS)
|
---|
212 | {
|
---|
213 | // typedef typename Arg::return_type<ARG, open_args<A&, B&, C&> >::type RT;
|
---|
214 | typedef typename as_lambda_functor<ARG>::type lf_type;
|
---|
215 | typedef typename lf_type::inherited::template
|
---|
216 | sig<tuple<CALL_REFERENCE_TYPES> >::type RT;
|
---|
217 |
|
---|
218 | return
|
---|
219 | return_or_throw_phase2<
|
---|
220 | ::boost::is_convertible<RT, RET>::value
|
---|
221 | >::template call<RET>(arg, CALL_ACTUAL_ARGS);
|
---|
222 | }
|
---|
223 | };
|
---|
224 |
|
---|
225 | // if try part returns void, we do not return the catch parts either
|
---|
226 | template<class ARG>
|
---|
227 | struct return_or_throw<void, ARG> {
|
---|
228 | template<class Arg, CALL_TEMPLATE_ARGS>
|
---|
229 | static void call(Arg& arg, CALL_FORMAL_ARGS) { detail::select(arg, CALL_ACTUAL_ARGS); }
|
---|
230 | };
|
---|
231 |
|
---|
232 | } // end detail
|
---|
233 |
|
---|
234 | // Throwing exceptions ---------------------------------------------
|
---|
235 |
|
---|
236 | namespace detail {
|
---|
237 |
|
---|
238 | template <class T> struct catch_block {};
|
---|
239 | struct catch_all_block {};
|
---|
240 |
|
---|
241 | template <class T> struct exception_catch_tag {};
|
---|
242 |
|
---|
243 | // normal catch block is represented as
|
---|
244 | // tagged_lambda_functor<exception_catch_tag<catch_type<T> > >, LambdaFunctor>
|
---|
245 |
|
---|
246 | // the default catch all block as:
|
---|
247 | // tagged_lambda_functor<exception_catch_tag<catch_all_block> >, LambdaFunctor>
|
---|
248 |
|
---|
249 |
|
---|
250 | } // end detail
|
---|
251 |
|
---|
252 | // the code is RETHROW, this ensures that a compile time error results,
|
---|
253 | // if this lambda_functor is used outside a delayed catch_expression
|
---|
254 | inline const
|
---|
255 | lambda_functor<
|
---|
256 | lambda_functor_base<
|
---|
257 | action<0, throw_action<rethrow_action> >,
|
---|
258 | null_type
|
---|
259 | >
|
---|
260 | >
|
---|
261 | rethrow() {
|
---|
262 | return
|
---|
263 | lambda_functor_base<
|
---|
264 | action<0, throw_action<rethrow_action> >,
|
---|
265 | null_type
|
---|
266 | >
|
---|
267 | ( null_type() );
|
---|
268 | }
|
---|
269 |
|
---|
270 | template <class Arg1>
|
---|
271 | inline const
|
---|
272 | lambda_functor<
|
---|
273 | lambda_functor_base<
|
---|
274 | action<1, throw_action<throw_new_action> >,
|
---|
275 | tuple<typename const_copy_argument<const Arg1>::type>
|
---|
276 | >
|
---|
277 | >
|
---|
278 | throw_exception(const Arg1& a1) {
|
---|
279 | return
|
---|
280 | lambda_functor_base<
|
---|
281 | action<1, throw_action<throw_new_action> >,
|
---|
282 | tuple<typename const_copy_argument<const Arg1>::type>
|
---|
283 | >
|
---|
284 | ( tuple<typename const_copy_argument<const Arg1>::type>(a1));
|
---|
285 | }
|
---|
286 |
|
---|
287 | // create catch blocks
|
---|
288 | template <class CatchType, class Arg>
|
---|
289 | inline const
|
---|
290 | tagged_lambda_functor<
|
---|
291 | detail::exception_catch_tag<detail::catch_block<CatchType> >,
|
---|
292 | lambda_functor<Arg>
|
---|
293 | >
|
---|
294 | catch_exception(const lambda_functor<Arg>& a) {
|
---|
295 | // the third placeholder cannot be used in catch_exception
|
---|
296 | // BOOST_STATIC_ASSERT((!has_placeholder<Arg, THIRD>::value));
|
---|
297 | return
|
---|
298 | tagged_lambda_functor<
|
---|
299 | detail::exception_catch_tag<detail::catch_block<CatchType> >,
|
---|
300 | lambda_functor<Arg>
|
---|
301 | > (a);
|
---|
302 | }
|
---|
303 |
|
---|
304 | // catch and do nothing case.
|
---|
305 | template <class CatchType>
|
---|
306 | inline const
|
---|
307 | tagged_lambda_functor<
|
---|
308 | detail::exception_catch_tag<detail::catch_block<CatchType> >,
|
---|
309 | lambda_functor<
|
---|
310 | lambda_functor_base<
|
---|
311 | do_nothing_action,
|
---|
312 | null_type
|
---|
313 | >
|
---|
314 | >
|
---|
315 | >
|
---|
316 | catch_exception() {
|
---|
317 | return
|
---|
318 | tagged_lambda_functor<
|
---|
319 | detail::exception_catch_tag<detail::catch_block<CatchType> >,
|
---|
320 | lambda_functor<
|
---|
321 | lambda_functor_base<
|
---|
322 | do_nothing_action,
|
---|
323 | null_type
|
---|
324 | >
|
---|
325 | >
|
---|
326 | > ();
|
---|
327 | }
|
---|
328 |
|
---|
329 | // create catch(...) blocks
|
---|
330 | template <class Arg>
|
---|
331 | inline const
|
---|
332 | tagged_lambda_functor<
|
---|
333 | detail::exception_catch_tag<detail::catch_all_block>,
|
---|
334 | lambda_functor<Arg>
|
---|
335 | >
|
---|
336 | catch_all(const lambda_functor<Arg>& a) {
|
---|
337 | // the third placeholder cannot be used in catch_exception
|
---|
338 | BOOST_STATIC_ASSERT((!has_placeholder<Arg, THIRD>::value));
|
---|
339 | return
|
---|
340 | tagged_lambda_functor<
|
---|
341 | detail::exception_catch_tag<detail::catch_all_block>,
|
---|
342 | lambda_functor<Arg>
|
---|
343 | > (a);
|
---|
344 | }
|
---|
345 |
|
---|
346 | // catch(...) and do nothing case.
|
---|
347 | inline const
|
---|
348 | tagged_lambda_functor<
|
---|
349 | detail::exception_catch_tag<detail::catch_all_block>,
|
---|
350 | lambda_functor<
|
---|
351 | lambda_functor_base<
|
---|
352 | do_nothing_action,
|
---|
353 | null_type
|
---|
354 | >
|
---|
355 | >
|
---|
356 | >
|
---|
357 | catch_all() {
|
---|
358 | return
|
---|
359 | tagged_lambda_functor<
|
---|
360 | detail::exception_catch_tag<detail::catch_all_block>,
|
---|
361 | lambda_functor<
|
---|
362 | lambda_functor_base<
|
---|
363 | do_nothing_action,
|
---|
364 | null_type
|
---|
365 | >
|
---|
366 | >
|
---|
367 | > ();
|
---|
368 | }
|
---|
369 |
|
---|
370 | // try_catch functions --------------------------------
|
---|
371 | // The second -> N argument(s) are must be catch lambda_functors
|
---|
372 | template <class TryArg, class Catch1, class LF1>
|
---|
373 | inline const
|
---|
374 | lambda_functor<
|
---|
375 | lambda_functor_base<
|
---|
376 | action<2, try_catch_action<catch_action<Catch1> > >,
|
---|
377 | tuple<lambda_functor<TryArg>, LF1>
|
---|
378 | >
|
---|
379 | >
|
---|
380 | try_catch(
|
---|
381 | const lambda_functor<TryArg>& a1,
|
---|
382 | const tagged_lambda_functor<detail::exception_catch_tag<Catch1>, LF1>& a2)
|
---|
383 | {
|
---|
384 | return
|
---|
385 | lambda_functor_base<
|
---|
386 | action<2, try_catch_action<catch_action<Catch1> > >,
|
---|
387 | tuple<lambda_functor<TryArg>, LF1>
|
---|
388 | >
|
---|
389 | ( tuple< lambda_functor<TryArg>, LF1>(a1, a2));
|
---|
390 | }
|
---|
391 |
|
---|
392 | template <class TryArg, class Catch1, class LF1,
|
---|
393 | class Catch2, class LF2>
|
---|
394 | inline const
|
---|
395 | lambda_functor<
|
---|
396 | lambda_functor_base<
|
---|
397 | action<3, try_catch_action<catch_action<detail::catch_block<Catch1>, Catch2> > >,
|
---|
398 | tuple<lambda_functor<TryArg>, LF1, LF2>
|
---|
399 | >
|
---|
400 | >
|
---|
401 | try_catch(
|
---|
402 | const lambda_functor<TryArg>& a1,
|
---|
403 | const tagged_lambda_functor<detail::exception_catch_tag<detail::catch_block<Catch1> >, LF1>& a2,
|
---|
404 | const tagged_lambda_functor<detail::exception_catch_tag<Catch2>, LF2>& a3)
|
---|
405 | {
|
---|
406 | return
|
---|
407 | lambda_functor_base<
|
---|
408 | action<3, try_catch_action<catch_action<detail::catch_block<Catch1>, Catch2> > >,
|
---|
409 | tuple<lambda_functor<TryArg>, LF1, LF2>
|
---|
410 | >
|
---|
411 | ( tuple<lambda_functor<TryArg>, LF1, LF2>(a1, a2, a3));
|
---|
412 | }
|
---|
413 |
|
---|
414 | template <class TryArg, class Catch1, class LF1,
|
---|
415 | class Catch2, class LF2,
|
---|
416 | class Catch3, class LF3>
|
---|
417 | inline const lambda_functor<
|
---|
418 | lambda_functor_base<
|
---|
419 | action<4, try_catch_action<catch_action<detail::catch_block<Catch1>, detail::catch_block<Catch2>, Catch3> > >,
|
---|
420 | tuple<lambda_functor<TryArg>, LF1, LF2, LF3>
|
---|
421 | >
|
---|
422 | >
|
---|
423 | try_catch(
|
---|
424 | const lambda_functor<TryArg>& a1,
|
---|
425 | const tagged_lambda_functor<detail::exception_catch_tag<detail::catch_block<Catch1> >, LF1>& a2,
|
---|
426 | const tagged_lambda_functor<detail::exception_catch_tag<detail::catch_block<Catch2> >, LF2>& a3,
|
---|
427 | const tagged_lambda_functor<detail::exception_catch_tag<Catch3>, LF3>& a4)
|
---|
428 | {
|
---|
429 | return
|
---|
430 | lambda_functor_base<
|
---|
431 | action<4, try_catch_action<catch_action<detail::catch_block<Catch1>, detail::catch_block<Catch2>, Catch3> > >,
|
---|
432 | tuple<lambda_functor<TryArg>, LF1, LF2, LF3>
|
---|
433 | >
|
---|
434 | ( tuple<lambda_functor<TryArg>, LF1, LF2, LF3>(a1, a2, a3, a4));
|
---|
435 | }
|
---|
436 |
|
---|
437 | template <class TryArg, class Catch1, class LF1,
|
---|
438 | class Catch2, class LF2,
|
---|
439 | class Catch3, class LF3,
|
---|
440 | class Catch4, class LF4>
|
---|
441 | inline const
|
---|
442 | lambda_functor<
|
---|
443 | lambda_functor_base<
|
---|
444 | action<
|
---|
445 | 5,
|
---|
446 | try_catch_action<
|
---|
447 | catch_action<detail::catch_block<Catch1>, detail::catch_block<Catch2>, detail::catch_block<Catch3>, Catch4>
|
---|
448 | >
|
---|
449 | >,
|
---|
450 | tuple<lambda_functor<TryArg>, LF1, LF2, LF3, LF4>
|
---|
451 | >
|
---|
452 | >
|
---|
453 | try_catch(
|
---|
454 | const lambda_functor<TryArg>& a1,
|
---|
455 | const tagged_lambda_functor<detail::exception_catch_tag<detail::catch_block<Catch1> >, LF1>& a2,
|
---|
456 | const tagged_lambda_functor<detail::exception_catch_tag<detail::catch_block<Catch2> >, LF2>& a3,
|
---|
457 | const tagged_lambda_functor<detail::exception_catch_tag<detail::catch_block<Catch3> >, LF3>& a4,
|
---|
458 | const tagged_lambda_functor<detail::exception_catch_tag<Catch4>, LF4>& a5)
|
---|
459 | {
|
---|
460 | return
|
---|
461 | lambda_functor_base<
|
---|
462 | action<
|
---|
463 | 5,
|
---|
464 | try_catch_action<catch_action<detail::catch_block<Catch1>, detail::catch_block<Catch2>, detail::catch_block<Catch3>, Catch4> >
|
---|
465 | >,
|
---|
466 | tuple<lambda_functor<TryArg>, LF1, LF2, LF3, LF4>
|
---|
467 | >
|
---|
468 | ( tuple<lambda_functor<TryArg>, LF1, LF2, LF3, LF4>(a1, a2, a3, a4, a5));
|
---|
469 | }
|
---|
470 |
|
---|
471 | template <class TryArg, class Catch1, class LF1,
|
---|
472 | class Catch2, class LF2,
|
---|
473 | class Catch3, class LF3,
|
---|
474 | class Catch4, class LF4,
|
---|
475 | class Catch5, class LF5>
|
---|
476 | inline const
|
---|
477 | lambda_functor<
|
---|
478 | lambda_functor_base<
|
---|
479 | action<
|
---|
480 | 6,
|
---|
481 | try_catch_action<catch_action<detail::catch_block<Catch1>, detail::catch_block<Catch2>, detail::catch_block<Catch3>, detail::catch_block<Catch4>, Catch5> >
|
---|
482 | >,
|
---|
483 | tuple<lambda_functor<TryArg>, LF1, LF2, LF3, LF4, LF5>
|
---|
484 | >
|
---|
485 | >
|
---|
486 | try_catch(
|
---|
487 | const lambda_functor<TryArg>& a1,
|
---|
488 | const tagged_lambda_functor<detail::exception_catch_tag<detail::catch_block<Catch1> >, LF1>& a2,
|
---|
489 | const tagged_lambda_functor<detail::exception_catch_tag<detail::catch_block<Catch2> >, LF2>& a3,
|
---|
490 | const tagged_lambda_functor<detail::exception_catch_tag<detail::catch_block<Catch3> >, LF3>& a4,
|
---|
491 | const tagged_lambda_functor<detail::exception_catch_tag<detail::catch_block<Catch4> >, LF4>& a5,
|
---|
492 | const tagged_lambda_functor<detail::exception_catch_tag<Catch5>, LF5>& a6)
|
---|
493 | {
|
---|
494 | return
|
---|
495 | lambda_functor_base<
|
---|
496 | action<
|
---|
497 | 6,
|
---|
498 | try_catch_action<
|
---|
499 | catch_action<detail::catch_block<Catch1>, detail::catch_block<Catch2>, detail::catch_block<Catch3>, detail::catch_block<Catch4>, Catch5>
|
---|
500 | >
|
---|
501 | >,
|
---|
502 | tuple<lambda_functor<TryArg>, LF1, LF2, LF3, LF4, LF5>
|
---|
503 | >
|
---|
504 | ( tuple<lambda_functor<TryArg>, LF1, LF2, LF3, LF4, LF5>
|
---|
505 | (a1, a2, a3, a4, a5, a6)
|
---|
506 | );
|
---|
507 | }
|
---|
508 |
|
---|
509 | template <class TryArg, class Catch1, class LF1,
|
---|
510 | class Catch2, class LF2,
|
---|
511 | class Catch3, class LF3,
|
---|
512 | class Catch4, class LF4,
|
---|
513 | class Catch5, class LF5,
|
---|
514 | class Catch6, class LF6>
|
---|
515 | inline const
|
---|
516 | lambda_functor<
|
---|
517 | lambda_functor_base<
|
---|
518 | action<
|
---|
519 | 7,
|
---|
520 | try_catch_action<
|
---|
521 | catch_action<detail::catch_block<Catch1>, detail::catch_block<Catch2>, detail::catch_block<Catch3>, detail::catch_block<Catch4>, detail::catch_block<Catch5>, Catch6>
|
---|
522 | >
|
---|
523 | >,
|
---|
524 | tuple<lambda_functor<TryArg>, LF1, LF2, LF3, LF4, LF5, LF6>
|
---|
525 | >
|
---|
526 | >
|
---|
527 | try_catch(
|
---|
528 | const lambda_functor<TryArg>& a1,
|
---|
529 | const tagged_lambda_functor<detail::exception_catch_tag<detail::catch_block<Catch1> >, LF1>& a2,
|
---|
530 | const tagged_lambda_functor<detail::exception_catch_tag<detail::catch_block<Catch2> >, LF2>& a3,
|
---|
531 | const tagged_lambda_functor<detail::exception_catch_tag<detail::catch_block<Catch3> >, LF3>& a4,
|
---|
532 | const tagged_lambda_functor<detail::exception_catch_tag<detail::catch_block<Catch4> >, LF4>& a5,
|
---|
533 | const tagged_lambda_functor<detail::exception_catch_tag<detail::catch_block<Catch5> >, LF5>& a6,
|
---|
534 | const tagged_lambda_functor<detail::exception_catch_tag<Catch6>, LF6>& a7)
|
---|
535 | {
|
---|
536 | return
|
---|
537 | lambda_functor_base<
|
---|
538 | action<
|
---|
539 | 7,
|
---|
540 | try_catch_action<
|
---|
541 | catch_action<detail::catch_block<Catch1>, detail::catch_block<Catch2>, detail::catch_block<Catch3>, detail::catch_block<Catch4>, detail::catch_block<Catch5>,Catch6>
|
---|
542 | >
|
---|
543 | >,
|
---|
544 | tuple<lambda_functor<TryArg>, LF1, LF2, LF3, LF4, LF5, LF6>
|
---|
545 | >
|
---|
546 | ( tuple<lambda_functor<TryArg>, LF1, LF2, LF3, LF4, LF5, LF6>
|
---|
547 | (a1, a2, a3, a4, a5, a6, a7));
|
---|
548 | }
|
---|
549 |
|
---|
550 | template <class TryArg, class Catch1, class LF1,
|
---|
551 | class Catch2, class LF2,
|
---|
552 | class Catch3, class LF3,
|
---|
553 | class Catch4, class LF4,
|
---|
554 | class Catch5, class LF5,
|
---|
555 | class Catch6, class LF6,
|
---|
556 | class Catch7, class LF7>
|
---|
557 | inline const
|
---|
558 | lambda_functor<
|
---|
559 | lambda_functor_base<
|
---|
560 | action<
|
---|
561 | 8,
|
---|
562 | try_catch_action<
|
---|
563 | catch_action<detail::catch_block<Catch1>, detail::catch_block<Catch2>, detail::catch_block<Catch3>, detail::catch_block<Catch4>, detail::catch_block<Catch5>, detail::catch_block<Catch6>, Catch7>
|
---|
564 | >
|
---|
565 | >,
|
---|
566 | tuple<lambda_functor<TryArg>, LF1, LF2, LF3, LF4, LF5, LF6, LF7>
|
---|
567 | >
|
---|
568 | >
|
---|
569 | try_catch(
|
---|
570 | const lambda_functor<TryArg>& a1,
|
---|
571 | const tagged_lambda_functor<detail::exception_catch_tag<detail::catch_block<Catch1> >, LF1>& a2,
|
---|
572 | const tagged_lambda_functor<detail::exception_catch_tag<detail::catch_block<Catch2> >, LF2>& a3,
|
---|
573 | const tagged_lambda_functor<detail::exception_catch_tag<detail::catch_block<Catch3> >, LF3>& a4,
|
---|
574 | const tagged_lambda_functor<detail::exception_catch_tag<detail::catch_block<Catch4> >, LF4>& a5,
|
---|
575 | const tagged_lambda_functor<detail::exception_catch_tag<detail::catch_block<Catch5> >, LF5>& a6,
|
---|
576 | const tagged_lambda_functor<detail::exception_catch_tag<detail::catch_block<Catch6> >, LF6>& a7,
|
---|
577 | const tagged_lambda_functor<detail::exception_catch_tag<Catch7>, LF7>& a8)
|
---|
578 | {
|
---|
579 | return
|
---|
580 | lambda_functor_base<
|
---|
581 | action<
|
---|
582 | 8,
|
---|
583 | try_catch_action<
|
---|
584 | catch_action<
|
---|
585 | detail::catch_block<Catch1>, detail::catch_block<Catch2>, detail::catch_block<Catch3>, detail::catch_block<Catch4>, detail::catch_block<Catch5>, detail::catch_block<Catch6>, Catch7
|
---|
586 | >
|
---|
587 | >
|
---|
588 | >,
|
---|
589 | tuple<lambda_functor<TryArg>, LF1, LF2, LF3, LF4, LF5, LF6, LF7>
|
---|
590 | >
|
---|
591 | ( tuple<lambda_functor<TryArg>, LF1, LF2, LF3, LF4, LF5, LF6, LF7>
|
---|
592 | (a1, a2, a3, a4, a5, a6, a7, a8));
|
---|
593 | }
|
---|
594 |
|
---|
595 | template <class TryArg, class Catch1, class LF1,
|
---|
596 | class Catch2, class LF2,
|
---|
597 | class Catch3, class LF3,
|
---|
598 | class Catch4, class LF4,
|
---|
599 | class Catch5, class LF5,
|
---|
600 | class Catch6, class LF6,
|
---|
601 | class Catch7, class LF7,
|
---|
602 | class Catch8, class LF8>
|
---|
603 | inline const
|
---|
604 | lambda_functor<
|
---|
605 | lambda_functor_base<
|
---|
606 | action<
|
---|
607 | 9,
|
---|
608 | try_catch_action<
|
---|
609 | catch_action<
|
---|
610 | detail::catch_block<Catch1>, detail::catch_block<Catch2>, detail::catch_block<Catch3>, detail::catch_block<Catch4>, detail::catch_block<Catch5>, detail::catch_block<Catch6>, detail::catch_block<Catch7>, Catch8
|
---|
611 | >
|
---|
612 | >
|
---|
613 | >,
|
---|
614 | tuple<lambda_functor<TryArg>, LF1, LF2, LF3, LF4, LF5, LF6, LF7, LF8>
|
---|
615 | >
|
---|
616 | >
|
---|
617 | try_catch(
|
---|
618 | const lambda_functor<TryArg>& a1,
|
---|
619 | const tagged_lambda_functor<detail::exception_catch_tag<detail::catch_block<Catch1> >, LF1>& a2,
|
---|
620 | const tagged_lambda_functor<detail::exception_catch_tag<detail::catch_block<Catch2> >, LF2>& a3,
|
---|
621 | const tagged_lambda_functor<detail::exception_catch_tag<detail::catch_block<Catch3> >, LF3>& a4,
|
---|
622 | const tagged_lambda_functor<detail::exception_catch_tag<detail::catch_block<Catch4> >, LF4>& a5,
|
---|
623 | const tagged_lambda_functor<detail::exception_catch_tag<detail::catch_block<Catch5> >, LF5>& a6,
|
---|
624 | const tagged_lambda_functor<detail::exception_catch_tag<detail::catch_block<Catch6> >, LF6>& a7,
|
---|
625 | const tagged_lambda_functor<detail::exception_catch_tag<detail::catch_block<Catch7> >, LF7>& a8,
|
---|
626 | const tagged_lambda_functor<detail::exception_catch_tag<Catch8>, LF8>& a9)
|
---|
627 | {
|
---|
628 | return
|
---|
629 | lambda_functor_base<
|
---|
630 | action<
|
---|
631 | 9,
|
---|
632 | try_catch_action<
|
---|
633 | catch_action<
|
---|
634 | detail::catch_block<Catch1>, detail::catch_block<Catch2>, detail::catch_block<Catch3>, detail::catch_block<Catch4>, detail::catch_block<Catch5>, detail::catch_block<Catch6>, detail::catch_block<Catch7>, Catch8
|
---|
635 | >
|
---|
636 | >
|
---|
637 | >,
|
---|
638 | tuple<lambda_functor<TryArg>, LF1, LF2, LF3, LF4, LF5, LF6, LF7, LF8>
|
---|
639 | >
|
---|
640 | ( tuple<lambda_functor<TryArg>, LF1, LF2, LF3, LF4, LF5, LF6, LF7, LF8>
|
---|
641 | (a1, a2, a3, a4, a5, a6, a7, a8, a9));
|
---|
642 | }
|
---|
643 |
|
---|
644 | template <class TryArg, class Catch1, class LF1,
|
---|
645 | class Catch2, class LF2,
|
---|
646 | class Catch3, class LF3,
|
---|
647 | class Catch4, class LF4,
|
---|
648 | class Catch5, class LF5,
|
---|
649 | class Catch6, class LF6,
|
---|
650 | class Catch7, class LF7,
|
---|
651 | class Catch8, class LF8,
|
---|
652 | class Catch9, class LF9>
|
---|
653 | inline const
|
---|
654 | lambda_functor<
|
---|
655 | lambda_functor_base<
|
---|
656 | action<
|
---|
657 | 10,
|
---|
658 | try_catch_action<
|
---|
659 | catch_action<
|
---|
660 | detail::catch_block<Catch1>, detail::catch_block<Catch2>, detail::catch_block<Catch3>, detail::catch_block<Catch4>, detail::catch_block<Catch5>, detail::catch_block<Catch6>, detail::catch_block<Catch7>, detail::catch_block<Catch8>,
|
---|
661 | Catch9
|
---|
662 | >
|
---|
663 | >
|
---|
664 | >,
|
---|
665 | tuple<
|
---|
666 | lambda_functor<TryArg>, LF1, LF2, LF3, LF4, LF5, LF6, LF7, LF8, LF9
|
---|
667 | >
|
---|
668 | >
|
---|
669 | >
|
---|
670 | try_catch(
|
---|
671 | const lambda_functor<TryArg>& a1,
|
---|
672 | const tagged_lambda_functor<detail::exception_catch_tag<detail::catch_block<Catch1> >, LF1>& a2,
|
---|
673 | const tagged_lambda_functor<detail::exception_catch_tag<detail::catch_block<Catch2> >, LF2>& a3,
|
---|
674 | const tagged_lambda_functor<detail::exception_catch_tag<detail::catch_block<Catch3> >, LF3>& a4,
|
---|
675 | const tagged_lambda_functor<detail::exception_catch_tag<detail::catch_block<Catch4> >, LF4>& a5,
|
---|
676 | const tagged_lambda_functor<detail::exception_catch_tag<detail::catch_block<Catch5> >, LF5>& a6,
|
---|
677 | const tagged_lambda_functor<detail::exception_catch_tag<detail::catch_block<Catch6> >, LF6>& a7,
|
---|
678 | const tagged_lambda_functor<detail::exception_catch_tag<detail::catch_block<Catch7> >, LF7>& a8,
|
---|
679 | const tagged_lambda_functor<detail::exception_catch_tag<detail::catch_block<Catch8> >, LF8>& a9,
|
---|
680 | const tagged_lambda_functor<detail::exception_catch_tag<Catch9>, LF9>& a10)
|
---|
681 | {
|
---|
682 | return
|
---|
683 | lambda_functor_base<
|
---|
684 | action<
|
---|
685 | 10,
|
---|
686 | try_catch_action<
|
---|
687 | catch_action<
|
---|
688 | detail::catch_block<Catch1>, detail::catch_block<Catch2>, detail::catch_block<Catch3>, detail::catch_block<Catch4>, detail::catch_block<Catch5>, detail::catch_block<Catch6>, detail::catch_block<Catch7>, detail::catch_block<Catch8>,
|
---|
689 | Catch9
|
---|
690 | >
|
---|
691 | >
|
---|
692 | >,
|
---|
693 | tuple<
|
---|
694 | lambda_functor<TryArg>, LF1, LF2, LF3, LF4, LF5, LF6, LF7, LF8, LF9
|
---|
695 | >
|
---|
696 | >
|
---|
697 | ( tuple<
|
---|
698 | lambda_functor<TryArg>, LF1, LF2, LF3, LF4, LF5, LF6, LF7, LF8, LF9
|
---|
699 | >(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10));
|
---|
700 | }
|
---|
701 |
|
---|
702 |
|
---|
703 | // ---------------------------------------------------------------------------
|
---|
704 | // Specializations for lambda_functor_base of try_catch ----------------------
|
---|
705 |
|
---|
706 | // 1 catch type case
|
---|
707 |
|
---|
708 | template<class Args, class Catch1>
|
---|
709 | class lambda_functor_base<
|
---|
710 | action<2, try_catch_action<catch_action<detail::catch_block<Catch1> > > >,
|
---|
711 | Args
|
---|
712 | >
|
---|
713 | {
|
---|
714 | public:
|
---|
715 | Args args;
|
---|
716 | public:
|
---|
717 | explicit lambda_functor_base(const Args& a) : args(a) {}
|
---|
718 |
|
---|
719 | // the return type of try_catch is the return type of the try lambda_functor
|
---|
720 | // (the return types of try and catch parts must match unless try returns void
|
---|
721 | // or the catch part throws for sure)
|
---|
722 |
|
---|
723 | template <class SigArgs> struct sig {
|
---|
724 | typedef typename
|
---|
725 | as_lambda_functor<
|
---|
726 | typename boost::tuples::element<0, Args>::type
|
---|
727 | >::type lf_type;
|
---|
728 |
|
---|
729 | typedef typename lf_type::inherited::template sig<SigArgs>::type type;
|
---|
730 | };
|
---|
731 |
|
---|
732 | template<class RET, CALL_TEMPLATE_ARGS>
|
---|
733 | RET call(CALL_FORMAL_ARGS) const {
|
---|
734 | try
|
---|
735 | {
|
---|
736 | return detail::select(::boost::tuples::get<0>(args), CALL_ACTUAL_ARGS);
|
---|
737 | }
|
---|
738 | catch (Catch1& e)
|
---|
739 | {
|
---|
740 | return
|
---|
741 | detail::return_or_throw<RET, typename ::boost::tuples::element<1, Args>::type>
|
---|
742 | ::call(::boost::tuples::get<1>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
743 | }
|
---|
744 | }
|
---|
745 | };
|
---|
746 |
|
---|
747 |
|
---|
748 |
|
---|
749 | template<class Args>
|
---|
750 | class lambda_functor_base<action<2, try_catch_action<catch_action<detail::catch_all_block> > >, Args> {
|
---|
751 | public:
|
---|
752 | Args args;
|
---|
753 | public:
|
---|
754 | explicit lambda_functor_base(const Args& a) : args(a) {}
|
---|
755 |
|
---|
756 | template <class SigArgs> struct sig {
|
---|
757 | typedef typename
|
---|
758 | as_lambda_functor<
|
---|
759 | typename boost::tuples::element<0, Args>::type
|
---|
760 | >::type lf_type;
|
---|
761 |
|
---|
762 | typedef typename lf_type::inherited::template sig<SigArgs>::type type;
|
---|
763 | };
|
---|
764 |
|
---|
765 | template<class RET, CALL_TEMPLATE_ARGS>
|
---|
766 | RET call(CALL_FORMAL_ARGS) const {
|
---|
767 | try
|
---|
768 | {
|
---|
769 | return detail::select(::boost::tuples::get<0>(args), CALL_ACTUAL_ARGS);
|
---|
770 | }
|
---|
771 | catch (...)
|
---|
772 | {
|
---|
773 | return
|
---|
774 | detail::return_or_throw<RET, typename ::boost::tuples::element<1, Args>::type>
|
---|
775 | ::call(::boost::tuples::get<1>(args), CALL_ACTUAL_ARGS);
|
---|
776 | }
|
---|
777 | }
|
---|
778 | };
|
---|
779 |
|
---|
780 |
|
---|
781 | // 2 catch types case
|
---|
782 | template<class Args, class Catch1, class Catch2>
|
---|
783 | class lambda_functor_base<action<3, try_catch_action<catch_action<detail::catch_block<Catch1>, detail::catch_block<Catch2> > > >, Args> {
|
---|
784 | public:
|
---|
785 | Args args;
|
---|
786 | public:
|
---|
787 | explicit lambda_functor_base(const Args& a) : args(a) {}
|
---|
788 |
|
---|
789 | template <class SigArgs> struct sig {
|
---|
790 | typedef typename
|
---|
791 | as_lambda_functor<
|
---|
792 | typename boost::tuples::element<0, Args>::type
|
---|
793 | >::type lf_type;
|
---|
794 |
|
---|
795 | typedef typename lf_type::inherited::template sig<SigArgs>::type type;
|
---|
796 | };
|
---|
797 |
|
---|
798 | template<class RET, CALL_TEMPLATE_ARGS>
|
---|
799 | RET call(CALL_FORMAL_ARGS) const {
|
---|
800 | try
|
---|
801 | {
|
---|
802 | return detail::select(::boost::tuples::get<0>(args), CALL_ACTUAL_ARGS);
|
---|
803 | }
|
---|
804 | catch (Catch1& e)
|
---|
805 | {
|
---|
806 | return
|
---|
807 | detail::return_or_throw<RET, typename ::boost::tuples::element<1, Args>::type>
|
---|
808 | ::call(::boost::tuples::get<1>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
809 | }
|
---|
810 | catch (Catch2& e)
|
---|
811 | {
|
---|
812 | return
|
---|
813 | detail::return_or_throw<RET, typename ::boost::tuples::element<2, Args>::type>
|
---|
814 | ::call(::boost::tuples::get<2>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
815 | }
|
---|
816 | }
|
---|
817 | };
|
---|
818 |
|
---|
819 | template<class Args, class Catch1>
|
---|
820 | class lambda_functor_base<action<3, try_catch_action<catch_action<detail::catch_block<Catch1>,detail::catch_all_block> > >, Args> {
|
---|
821 | public:
|
---|
822 | Args args;
|
---|
823 | public:
|
---|
824 | explicit lambda_functor_base(const Args& a) : args(a) {}
|
---|
825 |
|
---|
826 | template <class SigArgs> struct sig {
|
---|
827 | typedef typename
|
---|
828 | as_lambda_functor<
|
---|
829 | typename boost::tuples::element<0, Args>::type
|
---|
830 | >::type lf_type;
|
---|
831 |
|
---|
832 | typedef typename lf_type::inherited::template sig<SigArgs>::type type;
|
---|
833 | };
|
---|
834 |
|
---|
835 | template<class RET, CALL_TEMPLATE_ARGS>
|
---|
836 | RET call(CALL_FORMAL_ARGS) const {
|
---|
837 | try
|
---|
838 | {
|
---|
839 | return detail::select(::boost::tuples::get<0>(args), CALL_ACTUAL_ARGS);
|
---|
840 | }
|
---|
841 | catch (Catch1& e)
|
---|
842 | {
|
---|
843 | return
|
---|
844 | detail::return_or_throw<RET, typename ::boost::tuples::element<1, Args>::type>
|
---|
845 | ::call(::boost::tuples::get<1>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
846 | }
|
---|
847 | catch (...)
|
---|
848 | {
|
---|
849 | return
|
---|
850 | detail::return_or_throw<RET, typename ::boost::tuples::element<2, Args>::type>
|
---|
851 | ::call(::boost::tuples::get<2>(args), CALL_ACTUAL_ARGS);
|
---|
852 | }
|
---|
853 | }
|
---|
854 | };
|
---|
855 |
|
---|
856 | // 3 catch types case
|
---|
857 | template<class Args, class Catch1, class Catch2, class Catch3>
|
---|
858 | class lambda_functor_base<action<4, try_catch_action<catch_action<detail::catch_block<Catch1>, detail::catch_block<Catch2>, detail::catch_block<Catch3> > > >, Args> {
|
---|
859 | public:
|
---|
860 | Args args;
|
---|
861 | public:
|
---|
862 | explicit lambda_functor_base(const Args& a) : args(a) {}
|
---|
863 |
|
---|
864 | template <class SigArgs> struct sig {
|
---|
865 | typedef typename
|
---|
866 | as_lambda_functor<
|
---|
867 | typename boost::tuples::element<0, Args>::type
|
---|
868 | >::type lf_type;
|
---|
869 |
|
---|
870 | typedef typename lf_type::inherited::template sig<SigArgs>::type type;
|
---|
871 | };
|
---|
872 |
|
---|
873 | template<class RET, CALL_TEMPLATE_ARGS>
|
---|
874 | RET call(CALL_FORMAL_ARGS) const {
|
---|
875 | try
|
---|
876 | {
|
---|
877 | return detail::select(::boost::tuples::get<0>(args), CALL_ACTUAL_ARGS);
|
---|
878 | }
|
---|
879 | catch (Catch1& e)
|
---|
880 | {
|
---|
881 | return
|
---|
882 | detail::return_or_throw<RET, typename ::boost::tuples::element<1, Args>::type>
|
---|
883 | ::call(::boost::tuples::get<1>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
884 |
|
---|
885 | }
|
---|
886 | catch (Catch2& e)
|
---|
887 | {
|
---|
888 | return
|
---|
889 | detail::return_or_throw<RET, typename ::boost::tuples::element<2, Args>::type>
|
---|
890 | ::call(::boost::tuples::get<2>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
891 |
|
---|
892 | }
|
---|
893 | catch (Catch3& e)
|
---|
894 | {
|
---|
895 | return
|
---|
896 | detail::return_or_throw<RET, typename ::boost::tuples::element<3, Args>::type>
|
---|
897 | ::call(::boost::tuples::get<3>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
898 | }
|
---|
899 | }
|
---|
900 | };
|
---|
901 |
|
---|
902 | template<class Args, class Catch1, class Catch2>
|
---|
903 | class lambda_functor_base<action<4, try_catch_action<catch_action<detail::catch_block<Catch1>, detail::catch_block<Catch2>,detail::catch_all_block> > >, Args> {
|
---|
904 | public:
|
---|
905 | Args args;
|
---|
906 | public:
|
---|
907 | explicit lambda_functor_base(const Args& a) : args(a) {}
|
---|
908 |
|
---|
909 | template <class SigArgs> struct sig {
|
---|
910 | typedef typename
|
---|
911 | as_lambda_functor<
|
---|
912 | typename boost::tuples::element<0, Args>::type
|
---|
913 | >::type lf_type;
|
---|
914 |
|
---|
915 | typedef typename lf_type::inherited::template sig<SigArgs>::type type;
|
---|
916 | };
|
---|
917 |
|
---|
918 | template<class RET, CALL_TEMPLATE_ARGS>
|
---|
919 | RET call(CALL_FORMAL_ARGS) const {
|
---|
920 | try
|
---|
921 | {
|
---|
922 | return detail::select(::boost::tuples::get<0>(args), CALL_ACTUAL_ARGS);
|
---|
923 | }
|
---|
924 | catch (Catch1& e)
|
---|
925 | {
|
---|
926 | return
|
---|
927 | detail::return_or_throw<RET, typename ::boost::tuples::element<1, Args>::type>
|
---|
928 | ::call(::boost::tuples::get<1>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
929 | }
|
---|
930 | catch (Catch2& e)
|
---|
931 | {
|
---|
932 | return
|
---|
933 | detail::return_or_throw<RET, typename ::boost::tuples::element<2, Args>::type>
|
---|
934 | ::call(::boost::tuples::get<2>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
935 | }
|
---|
936 | catch (...)
|
---|
937 | {
|
---|
938 | return
|
---|
939 | detail::return_or_throw<RET, typename ::boost::tuples::element<3, Args>::type>
|
---|
940 | ::call(::boost::tuples::get<3>(args), CALL_ACTUAL_ARGS);
|
---|
941 | }
|
---|
942 | }
|
---|
943 | };
|
---|
944 |
|
---|
945 | // 4 catch types case
|
---|
946 | template<class Args, class Catch1, class Catch2, class Catch3, class Catch4>
|
---|
947 | class lambda_functor_base<action<5, try_catch_action<catch_action<detail::catch_block<Catch1>, detail::catch_block<Catch2>, detail::catch_block<Catch3>, detail::catch_block<Catch4> > > >, Args> {
|
---|
948 | public:
|
---|
949 | Args args;
|
---|
950 | public:
|
---|
951 | explicit lambda_functor_base(const Args& a) : args(a) {}
|
---|
952 |
|
---|
953 | template <class SigArgs> struct sig {
|
---|
954 | typedef typename
|
---|
955 | as_lambda_functor<
|
---|
956 | typename boost::tuples::element<0, Args>::type
|
---|
957 | >::type lf_type;
|
---|
958 |
|
---|
959 | typedef typename lf_type::inherited::template sig<SigArgs>::type type;
|
---|
960 | };
|
---|
961 |
|
---|
962 | template<class RET, CALL_TEMPLATE_ARGS>
|
---|
963 | RET call(CALL_FORMAL_ARGS) const {
|
---|
964 | try
|
---|
965 | {
|
---|
966 | return detail::select(::boost::tuples::get<0>(args), CALL_ACTUAL_ARGS);
|
---|
967 | }
|
---|
968 | catch (Catch1& e)
|
---|
969 | {
|
---|
970 | return
|
---|
971 | detail::return_or_throw<RET, typename ::boost::tuples::element<1, Args>::type>
|
---|
972 | ::call(::boost::tuples::get<1>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
973 | }
|
---|
974 | catch (Catch2& e)
|
---|
975 | {
|
---|
976 | return
|
---|
977 | detail::return_or_throw<RET, typename ::boost::tuples::element<2, Args>::type>
|
---|
978 | ::call(::boost::tuples::get<2>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
979 | }
|
---|
980 | catch (Catch3& e)
|
---|
981 | {
|
---|
982 | return
|
---|
983 | detail::return_or_throw<RET, typename ::boost::tuples::element<3, Args>::type>
|
---|
984 | ::call(::boost::tuples::get<3>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
985 | }
|
---|
986 | catch (Catch4& e)
|
---|
987 | {
|
---|
988 | return
|
---|
989 | detail::return_or_throw<RET, typename ::boost::tuples::element<4, Args>::type>
|
---|
990 | ::call(::boost::tuples::get<4>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
991 | }
|
---|
992 | }
|
---|
993 | };
|
---|
994 |
|
---|
995 | template<class Args, class Catch1, class Catch2, class Catch3>
|
---|
996 | class lambda_functor_base<action<5, try_catch_action<catch_action<detail::catch_block<Catch1>, detail::catch_block<Catch2>, detail::catch_block<Catch3>,detail::catch_all_block> > >, Args> {
|
---|
997 | public:
|
---|
998 | Args args;
|
---|
999 | public:
|
---|
1000 | explicit lambda_functor_base(const Args& a) : args(a) {}
|
---|
1001 |
|
---|
1002 | template <class SigArgs> struct sig {
|
---|
1003 | typedef typename
|
---|
1004 | as_lambda_functor<
|
---|
1005 | typename boost::tuples::element<0, Args>::type
|
---|
1006 | >::type lf_type;
|
---|
1007 |
|
---|
1008 | typedef typename lf_type::inherited::template sig<SigArgs>::type type;
|
---|
1009 | };
|
---|
1010 |
|
---|
1011 | template<class RET, CALL_TEMPLATE_ARGS>
|
---|
1012 | RET call(CALL_FORMAL_ARGS) const {
|
---|
1013 | try
|
---|
1014 | {
|
---|
1015 | return detail::select(::boost::tuples::get<0>(args), CALL_ACTUAL_ARGS);
|
---|
1016 | }
|
---|
1017 | catch (Catch1& e)
|
---|
1018 | {
|
---|
1019 | return
|
---|
1020 | detail::return_or_throw<RET, typename ::boost::tuples::element<1, Args>::type>
|
---|
1021 | ::call(::boost::tuples::get<1>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1022 | }
|
---|
1023 | catch (Catch2& e)
|
---|
1024 | {
|
---|
1025 | return
|
---|
1026 | detail::return_or_throw<RET, typename ::boost::tuples::element<2, Args>::type>
|
---|
1027 | ::call(::boost::tuples::get<2>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1028 | }
|
---|
1029 | catch (Catch3& e)
|
---|
1030 | {
|
---|
1031 | return
|
---|
1032 | detail::return_or_throw<RET, typename ::boost::tuples::element<3, Args>::type>
|
---|
1033 | ::call(::boost::tuples::get<3>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1034 | }
|
---|
1035 | catch (...)
|
---|
1036 | {
|
---|
1037 | return
|
---|
1038 | detail::return_or_throw<RET, typename ::boost::tuples::element<4, Args>::type>
|
---|
1039 | ::call(::boost::tuples::get<4>(args), CALL_ACTUAL_ARGS);
|
---|
1040 | }
|
---|
1041 | }
|
---|
1042 | };
|
---|
1043 |
|
---|
1044 | // 5 catch types case
|
---|
1045 | template<class Args, class Catch1, class Catch2, class Catch3, class Catch4, class Catch5>
|
---|
1046 | class lambda_functor_base<action<6, try_catch_action<catch_action<detail::catch_block<Catch1>, detail::catch_block<Catch2>, detail::catch_block<Catch3>, detail::catch_block<Catch4>, detail::catch_block<Catch5> > > >, Args> {
|
---|
1047 | public:
|
---|
1048 | Args args;
|
---|
1049 | public:
|
---|
1050 | explicit lambda_functor_base(const Args& a) : args(a) {}
|
---|
1051 |
|
---|
1052 | template <class SigArgs> struct sig {
|
---|
1053 | typedef typename
|
---|
1054 | as_lambda_functor<
|
---|
1055 | typename boost::tuples::element<0, Args>::type
|
---|
1056 | >::type lf_type;
|
---|
1057 |
|
---|
1058 | typedef typename lf_type::inherited::template sig<SigArgs>::type type;
|
---|
1059 | };
|
---|
1060 |
|
---|
1061 | template<class RET, CALL_TEMPLATE_ARGS>
|
---|
1062 | RET call(CALL_FORMAL_ARGS) const {
|
---|
1063 | try
|
---|
1064 | {
|
---|
1065 | return detail::select(::boost::tuples::get<0>(args), CALL_ACTUAL_ARGS);
|
---|
1066 | }
|
---|
1067 | catch (Catch1& e)
|
---|
1068 | {
|
---|
1069 | return
|
---|
1070 | detail::return_or_throw<RET, typename ::boost::tuples::element<1, Args>::type>
|
---|
1071 | ::call(::boost::tuples::get<1>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1072 | }
|
---|
1073 | catch (Catch2& e)
|
---|
1074 | {
|
---|
1075 | return
|
---|
1076 | detail::return_or_throw<RET, typename ::boost::tuples::element<2, Args>::type>
|
---|
1077 | ::call(::boost::tuples::get<2>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1078 | }
|
---|
1079 | catch (Catch3& e)
|
---|
1080 | {
|
---|
1081 | return
|
---|
1082 | detail::return_or_throw<RET, typename ::boost::tuples::element<3, Args>::type>
|
---|
1083 | ::call(::boost::tuples::get<3>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1084 | }
|
---|
1085 | catch (Catch4& e)
|
---|
1086 | {
|
---|
1087 | return
|
---|
1088 | detail::return_or_throw<RET, typename ::boost::tuples::element<4, Args>::type>
|
---|
1089 | ::call(::boost::tuples::get<4>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1090 | }
|
---|
1091 | catch (Catch5& e)
|
---|
1092 | {
|
---|
1093 | return
|
---|
1094 | detail::return_or_throw<RET, typename ::boost::tuples::element<4, Args>::type>
|
---|
1095 | ::call(::boost::tuples::get<5>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1096 | }
|
---|
1097 | }
|
---|
1098 | };
|
---|
1099 |
|
---|
1100 | template<class Args, class Catch1, class Catch2, class Catch3, class Catch4>
|
---|
1101 | class lambda_functor_base<action<6, try_catch_action<catch_action<detail::catch_block<Catch1>, detail::catch_block<Catch2>, detail::catch_block<Catch3>, detail::catch_block<Catch4>,detail::catch_all_block> > >, Args> {
|
---|
1102 | public:
|
---|
1103 | Args args;
|
---|
1104 | public:
|
---|
1105 | explicit lambda_functor_base(const Args& a) : args(a) {}
|
---|
1106 |
|
---|
1107 | template <class SigArgs> struct sig {
|
---|
1108 | typedef typename
|
---|
1109 | as_lambda_functor<
|
---|
1110 | typename boost::tuples::element<0, Args>::type
|
---|
1111 | >::type lf_type;
|
---|
1112 |
|
---|
1113 | typedef typename lf_type::inherited::template sig<SigArgs>::type type;
|
---|
1114 | };
|
---|
1115 |
|
---|
1116 | template<class RET, CALL_TEMPLATE_ARGS>
|
---|
1117 | RET call(CALL_FORMAL_ARGS) const {
|
---|
1118 | try
|
---|
1119 | {
|
---|
1120 | return detail::select(::boost::tuples::get<0>(args), CALL_ACTUAL_ARGS);
|
---|
1121 | }
|
---|
1122 | catch (Catch1& e)
|
---|
1123 | {
|
---|
1124 | return
|
---|
1125 | detail::return_or_throw<RET, typename ::boost::tuples::element<1, Args>::type>
|
---|
1126 | ::call(::boost::tuples::get<1>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1127 | }
|
---|
1128 | catch (Catch2& e)
|
---|
1129 | {
|
---|
1130 | return
|
---|
1131 | detail::return_or_throw<RET, typename ::boost::tuples::element<2, Args>::type>
|
---|
1132 | ::call(::boost::tuples::get<2>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1133 | }
|
---|
1134 | catch (Catch3& e)
|
---|
1135 | {
|
---|
1136 | return
|
---|
1137 | detail::return_or_throw<RET, typename ::boost::tuples::element<3, Args>::type>
|
---|
1138 | ::call(::boost::tuples::get<3>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1139 | }
|
---|
1140 | catch (Catch4& e)
|
---|
1141 | {
|
---|
1142 | return
|
---|
1143 | detail::return_or_throw<RET, typename ::boost::tuples::element<4, Args>::type>
|
---|
1144 | ::call(::boost::tuples::get<4>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1145 | }
|
---|
1146 | catch (...)
|
---|
1147 | {
|
---|
1148 | return
|
---|
1149 | detail::return_or_throw<RET, typename ::boost::tuples::element<5, Args>::type>
|
---|
1150 | ::call(::boost::tuples::get<5>(args), CALL_ACTUAL_ARGS);
|
---|
1151 | }
|
---|
1152 | }
|
---|
1153 | };
|
---|
1154 |
|
---|
1155 | // 6 catch types case
|
---|
1156 | template<class Args, class Catch1, class Catch2, class Catch3, class Catch4, class Catch5, class Catch6>
|
---|
1157 | class lambda_functor_base<action<7, try_catch_action<catch_action<detail::catch_block<Catch1>, detail::catch_block<Catch2>, detail::catch_block<Catch3>, detail::catch_block<Catch4>, detail::catch_block<Catch5>, detail::catch_block<Catch6> > > >, Args> {
|
---|
1158 | public:
|
---|
1159 | Args args;
|
---|
1160 | public:
|
---|
1161 | explicit lambda_functor_base(const Args& a) : args(a) {}
|
---|
1162 |
|
---|
1163 | template <class SigArgs> struct sig {
|
---|
1164 | typedef typename
|
---|
1165 | as_lambda_functor<
|
---|
1166 | typename boost::tuples::element<0, Args>::type
|
---|
1167 | >::type lf_type;
|
---|
1168 |
|
---|
1169 | typedef typename lf_type::inherited::template sig<SigArgs>::type type;
|
---|
1170 | };
|
---|
1171 |
|
---|
1172 | template<class RET, CALL_TEMPLATE_ARGS>
|
---|
1173 | RET call(CALL_FORMAL_ARGS) const {
|
---|
1174 | try
|
---|
1175 | {
|
---|
1176 | return detail::select(::boost::tuples::get<0>(args), CALL_ACTUAL_ARGS);
|
---|
1177 | }
|
---|
1178 | catch (Catch1& e)
|
---|
1179 | {
|
---|
1180 | return
|
---|
1181 | detail::return_or_throw<RET, typename ::boost::tuples::element<1, Args>::type>
|
---|
1182 | ::call(::boost::tuples::get<1>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1183 | }
|
---|
1184 | catch (Catch2& e)
|
---|
1185 | {
|
---|
1186 | return
|
---|
1187 | detail::return_or_throw<RET, typename ::boost::tuples::element<2, Args>::type>
|
---|
1188 | ::call(::boost::tuples::get<2>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1189 | }
|
---|
1190 | catch (Catch3& e)
|
---|
1191 | {
|
---|
1192 | return
|
---|
1193 | detail::return_or_throw<RET, typename ::boost::tuples::element<3, Args>::type>
|
---|
1194 | ::call(::boost::tuples::get<3>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1195 | }
|
---|
1196 | catch (Catch4& e)
|
---|
1197 | {
|
---|
1198 | return
|
---|
1199 | detail::return_or_throw<RET, typename ::boost::tuples::element<4, Args>::type>
|
---|
1200 | ::call(::boost::tuples::get<4>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1201 | }
|
---|
1202 | catch (Catch5& e)
|
---|
1203 | {
|
---|
1204 | return
|
---|
1205 | detail::return_or_throw<RET, typename ::boost::tuples::element<5, Args>::type>
|
---|
1206 | ::call(::boost::tuples::get<5>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1207 | }
|
---|
1208 | catch (Catch6& e)
|
---|
1209 | {
|
---|
1210 | return
|
---|
1211 | detail::return_or_throw<RET, typename ::boost::tuples::element<6, Args>::type>
|
---|
1212 | ::call(::boost::tuples::get<6>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1213 | }
|
---|
1214 | }
|
---|
1215 | };
|
---|
1216 |
|
---|
1217 | template<class Args, class Catch1, class Catch2, class Catch3, class Catch4, class Catch5>
|
---|
1218 | class lambda_functor_base<action<7, try_catch_action<catch_action<detail::catch_block<Catch1>, detail::catch_block<Catch2>, detail::catch_block<Catch3>, detail::catch_block<Catch4>, detail::catch_block<Catch5>,detail::catch_all_block> > >, Args> {
|
---|
1219 | public:
|
---|
1220 | Args args;
|
---|
1221 | public:
|
---|
1222 | explicit lambda_functor_base(const Args& a) : args(a) {}
|
---|
1223 |
|
---|
1224 | template <class SigArgs> struct sig {
|
---|
1225 | typedef typename
|
---|
1226 | as_lambda_functor<
|
---|
1227 | typename boost::tuples::element<0, Args>::type
|
---|
1228 | >::type lf_type;
|
---|
1229 |
|
---|
1230 | typedef typename lf_type::inherited::template sig<SigArgs>::type type;
|
---|
1231 | };
|
---|
1232 |
|
---|
1233 | template<class RET, CALL_TEMPLATE_ARGS>
|
---|
1234 | RET call(CALL_FORMAL_ARGS) const {
|
---|
1235 | try
|
---|
1236 | {
|
---|
1237 | return detail::select(::boost::tuples::get<0>(args), CALL_ACTUAL_ARGS);
|
---|
1238 | }
|
---|
1239 | catch (Catch1& e)
|
---|
1240 | {
|
---|
1241 | return
|
---|
1242 | detail::return_or_throw<RET, typename ::boost::tuples::element<1, Args>::type>
|
---|
1243 | ::call(::boost::tuples::get<1>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1244 | }
|
---|
1245 | catch (Catch2& e)
|
---|
1246 | {
|
---|
1247 | return
|
---|
1248 | detail::return_or_throw<RET, typename ::boost::tuples::element<2, Args>::type>
|
---|
1249 | ::call(::boost::tuples::get<2>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1250 | }
|
---|
1251 | catch (Catch3& e)
|
---|
1252 | {
|
---|
1253 | return
|
---|
1254 | detail::return_or_throw<RET, typename ::boost::tuples::element<3, Args>::type>
|
---|
1255 | ::call(::boost::tuples::get<3>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1256 | }
|
---|
1257 | catch (Catch4& e)
|
---|
1258 | {
|
---|
1259 | return
|
---|
1260 | detail::return_or_throw<RET, typename ::boost::tuples::element<4, Args>::type>
|
---|
1261 | ::call(::boost::tuples::get<4>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1262 | }
|
---|
1263 | catch (Catch5& e)
|
---|
1264 | {
|
---|
1265 | return
|
---|
1266 | detail::return_or_throw<RET, typename ::boost::tuples::element<5, Args>::type>
|
---|
1267 | ::call(::boost::tuples::get<5>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1268 | }
|
---|
1269 | catch (...)
|
---|
1270 | {
|
---|
1271 | return
|
---|
1272 | detail::return_or_throw<RET, typename ::boost::tuples::element<6, Args>::type>
|
---|
1273 | ::call(::boost::tuples::get<6>(args), CALL_ACTUAL_ARGS);
|
---|
1274 | }
|
---|
1275 | }
|
---|
1276 | };
|
---|
1277 |
|
---|
1278 | // 7 catch types case
|
---|
1279 | template<class Args, class Catch1, class Catch2, class Catch3, class Catch4, class Catch5, class Catch6,
|
---|
1280 | class Catch7>
|
---|
1281 | class lambda_functor_base<action<8, try_catch_action<catch_action<detail::catch_block<Catch1>, detail::catch_block<Catch2>, detail::catch_block<Catch3>, detail::catch_block<Catch4>, detail::catch_block<Catch5>, detail::catch_block<Catch6>, detail::catch_block<Catch7> > > >, Args> {
|
---|
1282 | public:
|
---|
1283 | Args args;
|
---|
1284 | public:
|
---|
1285 | explicit lambda_functor_base(const Args& a) : args(a) {}
|
---|
1286 |
|
---|
1287 | template <class SigArgs> struct sig {
|
---|
1288 | typedef typename
|
---|
1289 | as_lambda_functor<
|
---|
1290 | typename boost::tuples::element<0, Args>::type
|
---|
1291 | >::type lf_type;
|
---|
1292 |
|
---|
1293 | typedef typename lf_type::inherited::template sig<SigArgs>::type type;
|
---|
1294 | };
|
---|
1295 |
|
---|
1296 | template<class RET, CALL_TEMPLATE_ARGS>
|
---|
1297 | RET call(CALL_FORMAL_ARGS) const {
|
---|
1298 | try
|
---|
1299 | {
|
---|
1300 | return detail::select(::boost::tuples::get<0>(args), CALL_ACTUAL_ARGS);
|
---|
1301 | }
|
---|
1302 | catch (Catch1& e)
|
---|
1303 | {
|
---|
1304 | return
|
---|
1305 | detail::return_or_throw<RET, typename ::boost::tuples::element<1, Args>::type>
|
---|
1306 | ::call(::boost::tuples::get<1>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1307 | }
|
---|
1308 | catch (Catch2& e)
|
---|
1309 | {
|
---|
1310 | return
|
---|
1311 | detail::return_or_throw<RET, typename ::boost::tuples::element<2, Args>::type>
|
---|
1312 | ::call(::boost::tuples::get<2>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1313 | }
|
---|
1314 | catch (Catch3& e)
|
---|
1315 | {
|
---|
1316 | return
|
---|
1317 | detail::return_or_throw<RET, typename ::boost::tuples::element<3, Args>::type>
|
---|
1318 | ::call(::boost::tuples::get<3>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1319 | }
|
---|
1320 | catch (Catch4& e)
|
---|
1321 | {
|
---|
1322 | return
|
---|
1323 | detail::return_or_throw<RET, typename ::boost::tuples::element<4, Args>::type>
|
---|
1324 | ::call(::boost::tuples::get<4>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1325 | }
|
---|
1326 | catch (Catch5& e)
|
---|
1327 | {
|
---|
1328 | return
|
---|
1329 | detail::return_or_throw<RET, typename ::boost::tuples::element<5, Args>::type>
|
---|
1330 | ::call(::boost::tuples::get<5>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1331 | }
|
---|
1332 | catch (Catch6& e)
|
---|
1333 | {
|
---|
1334 | return
|
---|
1335 | detail::return_or_throw<RET, typename ::boost::tuples::element<6, Args>::type>
|
---|
1336 | ::call(::boost::tuples::get<6>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1337 | }
|
---|
1338 | catch (Catch7& e)
|
---|
1339 | {
|
---|
1340 | return
|
---|
1341 | detail::return_or_throw<RET, typename ::boost::tuples::element<7, Args>::type>
|
---|
1342 | ::call(::boost::tuples::get<7>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1343 | }
|
---|
1344 | }
|
---|
1345 | };
|
---|
1346 |
|
---|
1347 | template<class Args, class Catch1, class Catch2, class Catch3, class Catch4, class Catch5, class Catch6>
|
---|
1348 | class lambda_functor_base<action<8, try_catch_action<catch_action<detail::catch_block<Catch1>, detail::catch_block<Catch2>, detail::catch_block<Catch3>, detail::catch_block<Catch4>, detail::catch_block<Catch5>, detail::catch_block<Catch6>,
|
---|
1349 | detail::catch_all_block> > >, Args> {
|
---|
1350 | public:
|
---|
1351 | Args args;
|
---|
1352 | public:
|
---|
1353 | explicit lambda_functor_base(const Args& a) : args(a) {}
|
---|
1354 |
|
---|
1355 | template <class SigArgs> struct sig {
|
---|
1356 | typedef typename
|
---|
1357 | as_lambda_functor<
|
---|
1358 | typename boost::tuples::element<0, Args>::type
|
---|
1359 | >::type lf_type;
|
---|
1360 |
|
---|
1361 | typedef typename lf_type::inherited::template sig<SigArgs>::type type;
|
---|
1362 | };
|
---|
1363 |
|
---|
1364 | template<class RET, CALL_TEMPLATE_ARGS>
|
---|
1365 | RET call(CALL_FORMAL_ARGS) const {
|
---|
1366 | try
|
---|
1367 | {
|
---|
1368 | return detail::select(::boost::tuples::get<0>(args), CALL_ACTUAL_ARGS);
|
---|
1369 | }
|
---|
1370 | catch (Catch1& e)
|
---|
1371 | {
|
---|
1372 | return
|
---|
1373 | detail::return_or_throw<RET, typename ::boost::tuples::element<1, Args>::type>
|
---|
1374 | ::call(::boost::tuples::get<1>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1375 | }
|
---|
1376 | catch (Catch2& e)
|
---|
1377 | {
|
---|
1378 | return
|
---|
1379 | detail::return_or_throw<RET, typename ::boost::tuples::element<2, Args>::type>
|
---|
1380 | ::call(::boost::tuples::get<2>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1381 | }
|
---|
1382 | catch (Catch3& e)
|
---|
1383 | {
|
---|
1384 | return
|
---|
1385 | detail::return_or_throw<RET, typename ::boost::tuples::element<3, Args>::type>
|
---|
1386 | ::call(::boost::tuples::get<3>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1387 | }
|
---|
1388 | catch (Catch4& e)
|
---|
1389 | {
|
---|
1390 | return
|
---|
1391 | detail::return_or_throw<RET, typename ::boost::tuples::element<4, Args>::type>
|
---|
1392 | ::call(::boost::tuples::get<4>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1393 | }
|
---|
1394 | catch (Catch5& e)
|
---|
1395 | {
|
---|
1396 | return
|
---|
1397 | detail::return_or_throw<RET, typename ::boost::tuples::element<5, Args>::type>
|
---|
1398 | ::call(::boost::tuples::get<5>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1399 | }
|
---|
1400 | catch (Catch6& e)
|
---|
1401 | {
|
---|
1402 | return
|
---|
1403 | detail::return_or_throw<RET, typename ::boost::tuples::element<6, Args>::type>
|
---|
1404 | ::call(::boost::tuples::get<6>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1405 | }
|
---|
1406 | catch (...)
|
---|
1407 | {
|
---|
1408 | return
|
---|
1409 | detail::return_or_throw<RET, typename ::boost::tuples::element<7, Args>::type>
|
---|
1410 | ::call(::boost::tuples::get<7>(args), CALL_ACTUAL_ARGS);
|
---|
1411 | }
|
---|
1412 | }
|
---|
1413 | };
|
---|
1414 |
|
---|
1415 | // 8 catch types case
|
---|
1416 | template<class Args, class Catch1, class Catch2, class Catch3, class Catch4, class Catch5, class Catch6,
|
---|
1417 | class Catch7, class Catch8>
|
---|
1418 | class lambda_functor_base<action<9, try_catch_action<catch_action<detail::catch_block<Catch1>, detail::catch_block<Catch2>, detail::catch_block<Catch3>, detail::catch_block<Catch4>, detail::catch_block<Catch5>, detail::catch_block<Catch6>,
|
---|
1419 | detail::catch_block<Catch7>, detail::catch_block<Catch8> > > >, Args> {
|
---|
1420 | public:
|
---|
1421 | Args args;
|
---|
1422 | public:
|
---|
1423 | explicit lambda_functor_base(const Args& a) : args(a) {}
|
---|
1424 |
|
---|
1425 | template <class SigArgs> struct sig {
|
---|
1426 | typedef typename
|
---|
1427 | as_lambda_functor<
|
---|
1428 | typename boost::tuples::element<0, Args>::type
|
---|
1429 | >::type lf_type;
|
---|
1430 |
|
---|
1431 | typedef typename lf_type::inherited::template sig<SigArgs>::type type;
|
---|
1432 | };
|
---|
1433 |
|
---|
1434 | template<class RET, CALL_TEMPLATE_ARGS>
|
---|
1435 | RET call(CALL_FORMAL_ARGS) const {
|
---|
1436 | try
|
---|
1437 | {
|
---|
1438 | return detail::select(::boost::tuples::get<0>(args), CALL_ACTUAL_ARGS);
|
---|
1439 | }
|
---|
1440 | catch (Catch1& e)
|
---|
1441 | {
|
---|
1442 | return
|
---|
1443 | detail::return_or_throw<RET, typename ::boost::tuples::element<1, Args>::type>
|
---|
1444 | ::call(::boost::tuples::get<1>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1445 | }
|
---|
1446 | catch (Catch2& e)
|
---|
1447 | {
|
---|
1448 | return
|
---|
1449 | detail::return_or_throw<RET, typename ::boost::tuples::element<2, Args>::type>
|
---|
1450 | ::call(::boost::tuples::get<2>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1451 | }
|
---|
1452 | catch (Catch3& e)
|
---|
1453 | {
|
---|
1454 | return
|
---|
1455 | detail::return_or_throw<RET, typename ::boost::tuples::element<3, Args>::type>
|
---|
1456 | ::call(::boost::tuples::get<3>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1457 | }
|
---|
1458 | catch (Catch4& e)
|
---|
1459 | {
|
---|
1460 | return
|
---|
1461 | detail::return_or_throw<RET, typename ::boost::tuples::element<4, Args>::type>
|
---|
1462 | ::call(::boost::tuples::get<4>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1463 | }
|
---|
1464 | catch (Catch5& e)
|
---|
1465 | {
|
---|
1466 | return
|
---|
1467 | detail::return_or_throw<RET, typename ::boost::tuples::element<5, Args>::type>
|
---|
1468 | ::call(::boost::tuples::get<5>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1469 | }
|
---|
1470 | catch (Catch6& e)
|
---|
1471 | {
|
---|
1472 | return
|
---|
1473 | detail::return_or_throw<RET, typename ::boost::tuples::element<6, Args>::type>
|
---|
1474 | ::call(::boost::tuples::get<6>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1475 | }
|
---|
1476 | catch (Catch7& e)
|
---|
1477 | {
|
---|
1478 | return
|
---|
1479 | detail::return_or_throw<RET, typename ::boost::tuples::element<7, Args>::type>
|
---|
1480 | ::call(::boost::tuples::get<7>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1481 | }
|
---|
1482 | catch (Catch8& e)
|
---|
1483 | {
|
---|
1484 | return
|
---|
1485 | detail::return_or_throw<RET, typename ::boost::tuples::element<8, Args>::type>
|
---|
1486 | ::call(::boost::tuples::get<8>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1487 | }
|
---|
1488 | }
|
---|
1489 | };
|
---|
1490 |
|
---|
1491 | template<class Args, class Catch1, class Catch2, class Catch3, class Catch4, class Catch5, class Catch6,
|
---|
1492 | class Catch7>
|
---|
1493 | class lambda_functor_base<action<9, try_catch_action<catch_action<detail::catch_block<Catch1>, detail::catch_block<Catch2>, detail::catch_block<Catch3>, detail::catch_block<Catch4>, detail::catch_block<Catch5>, detail::catch_block<Catch6>,
|
---|
1494 | detail::catch_block<Catch7>,detail::catch_all_block> > >, Args> {
|
---|
1495 | public:
|
---|
1496 | Args args;
|
---|
1497 | public:
|
---|
1498 | explicit lambda_functor_base(const Args& a) : args(a) {}
|
---|
1499 |
|
---|
1500 | template <class SigArgs> struct sig {
|
---|
1501 | typedef typename
|
---|
1502 | as_lambda_functor<
|
---|
1503 | typename boost::tuples::element<0, Args>::type
|
---|
1504 | >::type lf_type;
|
---|
1505 |
|
---|
1506 | typedef typename lf_type::inherited::template sig<SigArgs>::type type;
|
---|
1507 | };
|
---|
1508 |
|
---|
1509 | template<class RET, CALL_TEMPLATE_ARGS>
|
---|
1510 | RET call(CALL_FORMAL_ARGS) const {
|
---|
1511 | try
|
---|
1512 | {
|
---|
1513 | return detail::select(::boost::tuples::get<0>(args), CALL_ACTUAL_ARGS);
|
---|
1514 | }
|
---|
1515 | catch (Catch1& e)
|
---|
1516 | {
|
---|
1517 | return
|
---|
1518 | detail::return_or_throw<RET, typename ::boost::tuples::element<1, Args>::type>
|
---|
1519 | ::call(::boost::tuples::get<1>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1520 | }
|
---|
1521 | catch (Catch2& e)
|
---|
1522 | {
|
---|
1523 | return
|
---|
1524 | detail::return_or_throw<RET, typename ::boost::tuples::element<2, Args>::type>
|
---|
1525 | ::call(::boost::tuples::get<2>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1526 | }
|
---|
1527 | catch (Catch3& e)
|
---|
1528 | {
|
---|
1529 | return
|
---|
1530 | detail::return_or_throw<RET, typename ::boost::tuples::element<3, Args>::type>
|
---|
1531 | ::call(::boost::tuples::get<3>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1532 | }
|
---|
1533 | catch (Catch4& e)
|
---|
1534 | {
|
---|
1535 | return
|
---|
1536 | detail::return_or_throw<RET, typename ::boost::tuples::element<4, Args>::type>
|
---|
1537 | ::call(::boost::tuples::get<4>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1538 | }
|
---|
1539 | catch (Catch5& e)
|
---|
1540 | {
|
---|
1541 | return
|
---|
1542 | detail::return_or_throw<RET, typename ::boost::tuples::element<5, Args>::type>
|
---|
1543 | ::call(::boost::tuples::get<5>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1544 | }
|
---|
1545 | catch (Catch6& e)
|
---|
1546 | {
|
---|
1547 | return
|
---|
1548 | detail::return_or_throw<RET, typename ::boost::tuples::element<6, Args>::type>
|
---|
1549 | ::call(::boost::tuples::get<6>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1550 | }
|
---|
1551 | catch (Catch7& e)
|
---|
1552 | {
|
---|
1553 | return
|
---|
1554 | detail::return_or_throw<RET, typename ::boost::tuples::element<7, Args>::type>
|
---|
1555 | ::call(::boost::tuples::get<7>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1556 | }
|
---|
1557 | catch (...)
|
---|
1558 | {
|
---|
1559 | return
|
---|
1560 | detail::return_or_throw<RET, typename ::boost::tuples::element<8, Args>::type>
|
---|
1561 | ::call(::boost::tuples::get<8>(args), CALL_ACTUAL_ARGS);
|
---|
1562 | }
|
---|
1563 | }
|
---|
1564 | };
|
---|
1565 |
|
---|
1566 | // 9 catch types case
|
---|
1567 | template<class Args, class Catch1, class Catch2, class Catch3, class Catch4, class Catch5, class Catch6,
|
---|
1568 | class Catch7, class Catch8, class Catch9>
|
---|
1569 | class lambda_functor_base<action<10, try_catch_action<catch_action<detail::catch_block<Catch1>, detail::catch_block<Catch2>, detail::catch_block<Catch3>, detail::catch_block<Catch4>, detail::catch_block<Catch5>, detail::catch_block<Catch6>,
|
---|
1570 | detail::catch_block<Catch7>, detail::catch_block<Catch8>, detail::catch_block<Catch9> > > >, Args> {
|
---|
1571 | public:
|
---|
1572 | Args args;
|
---|
1573 | public:
|
---|
1574 | explicit lambda_functor_base(const Args& a) : args(a) {}
|
---|
1575 |
|
---|
1576 | template <class SigArgs> struct sig {
|
---|
1577 | typedef typename
|
---|
1578 | as_lambda_functor<
|
---|
1579 | typename boost::tuples::element<0, Args>::type
|
---|
1580 | >::type lf_type;
|
---|
1581 |
|
---|
1582 | typedef typename lf_type::inherited::template sig<SigArgs>::type type;
|
---|
1583 | };
|
---|
1584 |
|
---|
1585 | template<class RET, CALL_TEMPLATE_ARGS>
|
---|
1586 | RET call(CALL_FORMAL_ARGS) const {
|
---|
1587 | try
|
---|
1588 | {
|
---|
1589 | return detail::select(::boost::tuples::get<0>(args), CALL_ACTUAL_ARGS);
|
---|
1590 | }
|
---|
1591 | catch (Catch1& e)
|
---|
1592 | {
|
---|
1593 | return
|
---|
1594 | detail::return_or_throw<RET, typename ::boost::tuples::element<1, Args>::type>
|
---|
1595 | ::call(::boost::tuples::get<1>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1596 | }
|
---|
1597 | catch (Catch2& e)
|
---|
1598 | {
|
---|
1599 | return
|
---|
1600 | detail::return_or_throw<RET, typename ::boost::tuples::element<2, Args>::type>
|
---|
1601 | ::call(::boost::tuples::get<2>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1602 | }
|
---|
1603 | catch (Catch3& e)
|
---|
1604 | {
|
---|
1605 | return
|
---|
1606 | detail::return_or_throw<RET, typename ::boost::tuples::element<3, Args>::type>
|
---|
1607 | ::call(::boost::tuples::get<3>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1608 | }
|
---|
1609 | catch (Catch4& e)
|
---|
1610 | {
|
---|
1611 | return
|
---|
1612 | detail::return_or_throw<RET, typename ::boost::tuples::element<4, Args>::type>
|
---|
1613 | ::call(::boost::tuples::get<4>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1614 | }
|
---|
1615 | catch (Catch5& e)
|
---|
1616 | {
|
---|
1617 | return
|
---|
1618 | detail::return_or_throw<RET, typename ::boost::tuples::element<5, Args>::type>
|
---|
1619 | ::call(::boost::tuples::get<5>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1620 | }
|
---|
1621 | catch (Catch6& e)
|
---|
1622 | {
|
---|
1623 | return
|
---|
1624 | detail::return_or_throw<RET, typename ::boost::tuples::element<6, Args>::type>
|
---|
1625 | ::call(::boost::tuples::get<6>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1626 | }
|
---|
1627 | catch (Catch7& e)
|
---|
1628 | {
|
---|
1629 | return
|
---|
1630 | detail::return_or_throw<RET, typename ::boost::tuples::element<7, Args>::type>
|
---|
1631 | ::call(::boost::tuples::get<7>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1632 | }
|
---|
1633 | catch (Catch8& e)
|
---|
1634 | {
|
---|
1635 | return
|
---|
1636 | detail::return_or_throw<RET, typename ::boost::tuples::element<8, Args>::type>
|
---|
1637 | ::call(::boost::tuples::get<8>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1638 | }
|
---|
1639 | catch (Catch9& e)
|
---|
1640 | {
|
---|
1641 | return
|
---|
1642 | detail::return_or_throw<RET, typename ::boost::tuples::element<9, Args>::type>
|
---|
1643 | ::call(::boost::tuples::get<9>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1644 | }
|
---|
1645 | }
|
---|
1646 | };
|
---|
1647 |
|
---|
1648 | template<class Args, class Catch1, class Catch2, class Catch3, class Catch4, class Catch5, class Catch6,
|
---|
1649 | class Catch7, class Catch8>
|
---|
1650 | class lambda_functor_base<action<10, try_catch_action<catch_action<detail::catch_block<Catch1>, detail::catch_block<Catch2>, detail::catch_block<Catch3>, detail::catch_block<Catch4>, detail::catch_block<Catch5>, detail::catch_block<Catch6>,
|
---|
1651 | detail::catch_block<Catch7>, detail::catch_block<Catch8>,detail::catch_all_block> > >, Args> {
|
---|
1652 | public:
|
---|
1653 | Args args;
|
---|
1654 | public:
|
---|
1655 | explicit lambda_functor_base(const Args& a) : args(a) {}
|
---|
1656 |
|
---|
1657 | template <class SigArgs> struct sig {
|
---|
1658 | typedef typename
|
---|
1659 | as_lambda_functor<
|
---|
1660 | typename boost::tuples::element<0, Args>::type
|
---|
1661 | >::type lf_type;
|
---|
1662 |
|
---|
1663 | typedef typename lf_type::inherited::template sig<SigArgs>::type type;
|
---|
1664 | };
|
---|
1665 |
|
---|
1666 | template<class RET, CALL_TEMPLATE_ARGS>
|
---|
1667 | RET call(CALL_FORMAL_ARGS) const {
|
---|
1668 | try
|
---|
1669 | {
|
---|
1670 | return detail::select(::boost::tuples::get<0>(args), CALL_ACTUAL_ARGS);
|
---|
1671 | }
|
---|
1672 | catch (Catch1& e)
|
---|
1673 | {
|
---|
1674 | return
|
---|
1675 | detail::return_or_throw<RET, typename ::boost::tuples::element<1, Args>::type>
|
---|
1676 | ::call(::boost::tuples::get<1>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1677 | }
|
---|
1678 | catch (Catch2& e)
|
---|
1679 | {
|
---|
1680 | return
|
---|
1681 | detail::return_or_throw<RET, typename ::boost::tuples::element<2, Args>::type>
|
---|
1682 | ::call(::boost::tuples::get<2>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1683 | }
|
---|
1684 | catch (Catch3& e)
|
---|
1685 | {
|
---|
1686 | return
|
---|
1687 | detail::return_or_throw<RET, typename ::boost::tuples::element<3, Args>::type>
|
---|
1688 | ::call(::boost::tuples::get<3>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1689 | }
|
---|
1690 | catch (Catch4& e)
|
---|
1691 | {
|
---|
1692 | return
|
---|
1693 | detail::return_or_throw<RET, typename ::boost::tuples::element<4, Args>::type>
|
---|
1694 | ::call(::boost::tuples::get<4>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1695 | }
|
---|
1696 | catch (Catch5& e)
|
---|
1697 | {
|
---|
1698 | return
|
---|
1699 | detail::return_or_throw<RET, typename ::boost::tuples::element<5, Args>::type>
|
---|
1700 | ::call(::boost::tuples::get<5>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1701 | }
|
---|
1702 | catch (Catch6& e)
|
---|
1703 | {
|
---|
1704 | return
|
---|
1705 | detail::return_or_throw<RET, typename ::boost::tuples::element<6, Args>::type>
|
---|
1706 | ::call(::boost::tuples::get<6>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1707 | }
|
---|
1708 | catch (Catch7& e)
|
---|
1709 | {
|
---|
1710 | return
|
---|
1711 | detail::return_or_throw<RET, typename ::boost::tuples::element<7, Args>::type>
|
---|
1712 | ::call(::boost::tuples::get<7>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1713 | }
|
---|
1714 | catch (Catch8& e)
|
---|
1715 | {
|
---|
1716 | return
|
---|
1717 | detail::return_or_throw<RET, typename ::boost::tuples::element<8, Args>::type>
|
---|
1718 | ::call(::boost::tuples::get<8>(args), CALL_ACTUAL_ARGS_NO_ENV, e);
|
---|
1719 | }
|
---|
1720 | catch (...)
|
---|
1721 | {
|
---|
1722 | return
|
---|
1723 | detail::return_or_throw<RET, typename ::boost::tuples::element<9, Args>::type>
|
---|
1724 | ::call(::boost::tuples::get<9>(args), CALL_ACTUAL_ARGS);
|
---|
1725 | }
|
---|
1726 | }
|
---|
1727 | };
|
---|
1728 |
|
---|
1729 |
|
---|
1730 | } // namespace lambda
|
---|
1731 | } // namespace boost
|
---|
1732 |
|
---|
1733 |
|
---|
1734 | #endif
|
---|
1735 |
|
---|
1736 |
|
---|
1737 |
|
---|
1738 |
|
---|
1739 |
|
---|
1740 |
|
---|