9
3

exceptions.hpp 58 KB

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