lambda_functor_base.hpp 22 KB

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