functions.hpp 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760
  1. /*=============================================================================
  2. Phoenix V1.2.1
  3. Copyright (c) 2001-2002 Joel de Guzman
  4. Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. ==============================================================================*/
  7. #ifndef PHOENIX_FUNCTIONS_HPP
  8. #define PHOENIX_FUNCTIONS_HPP
  9. ///////////////////////////////////////////////////////////////////////////////
  10. #include <boost/spirit/home/classic/phoenix/actor.hpp>
  11. #include <boost/spirit/home/classic/phoenix/composite.hpp>
  12. ///////////////////////////////////////////////////////////////////////////////
  13. namespace phoenix {
  14. ///////////////////////////////////////////////////////////////////////////////
  15. //
  16. // function class
  17. //
  18. // Lazy functions
  19. //
  20. // This class provides a mechanism for lazily evaluating functions.
  21. // Syntactically, a lazy function looks like an ordinary C/C++
  22. // function. The function call looks the same. However, unlike
  23. // ordinary functions, the actual function execution is deferred.
  24. // (see actor.hpp, primitives.hpp and composite.hpp for an
  25. // overview). For example here are sample factorial function calls:
  26. //
  27. // factorial(4)
  28. // factorial(arg1)
  29. // factorial(arg1 * 6)
  30. //
  31. // These functions are automatically lazily bound unlike ordinary
  32. // function pointers or functor objects that need to be explicitly
  33. // bound through the bind function (see binders.hpp).
  34. //
  35. // A lazy function works in conjunction with a user defined functor
  36. // (as usual with a member operator()). Only special forms of
  37. // functor objects are allowed. This is required to enable true
  38. // polymorphism (STL style monomorphic functors and function
  39. // pointers can still be used through the bind facility in
  40. // binders.hpp).
  41. //
  42. // This special functor is expected to have a nested template class
  43. // result<A...TN> (where N is the number of arguments of its
  44. // member operator()). The nested template class result should have
  45. // a typedef 'type' that reflects the return type of its member
  46. // operator(). This is essentially a type computer that answers the
  47. // metaprogramming question "Given arguments of type A...TN, what
  48. // will be the operator()'s return type?".
  49. //
  50. // There is a special case for functors that accept no arguments.
  51. // Such nullary functors are only required to define a typedef
  52. // result_type that reflects the return type of its operator().
  53. //
  54. // Here's an example of a simple functor that computes the
  55. // factorial of a number:
  56. //
  57. // struct factorial_impl {
  58. //
  59. // template <typename Arg>
  60. // struct result { typedef Arg type; };
  61. //
  62. // template <typename Arg>
  63. // Arg operator()(Arg n) const
  64. // { return (n <= 0) ? 1 : n * this->operator()(n-1); }
  65. // };
  66. //
  67. // As can be seen, the functor can be polymorphic. Its arguments
  68. // and return type are not fixed to a particular type. The example
  69. // above for example, can handle any type as long as it can carry
  70. // out the required operations (i.e. <=, * and -).
  71. //
  72. // We can now declare and instantiate a lazy 'factorial' function:
  73. //
  74. // function<factorial_impl> factorial;
  75. //
  76. // Invoking a lazy function 'factorial' does not immediately
  77. // execute the functor factorial_impl. Instead, a composite (see
  78. // composite.hpp) object is created and returned to the caller.
  79. // Example:
  80. //
  81. // factorial(arg1)
  82. //
  83. // does nothing more than return a composite. A second function
  84. // call will invoke the actual factorial function. Example:
  85. //
  86. // int i = 4;
  87. // cout << factorial(arg1)(i);
  88. //
  89. // will print out "24".
  90. //
  91. // Take note that in certain cases (e.g. for functors with state),
  92. // an instance may be passed on to the constructor. Example:
  93. //
  94. // function<factorial_impl> factorial(ftor);
  95. //
  96. // where ftor is an instance of factorial_impl (this is not
  97. // necessary in this case since factorial is a simple stateless
  98. // functor). Take care though when using functors with state
  99. // because the functors are taken in by value. It is best to keep
  100. // the data manipulated by a functor outside the functor itself and
  101. // keep a reference to this data inside the functor. Also, it is
  102. // best to keep functors as small as possible.
  103. //
  104. ///////////////////////////////////////////////////////////////////////////////
  105. template <typename OperationT>
  106. struct function {
  107. function() : op() {}
  108. function(OperationT const& op_) : op(op_) {}
  109. actor<composite<OperationT> >
  110. operator()() const;
  111. template <typename A>
  112. typename impl::make_composite<OperationT, A>::type
  113. operator()(A const& a) const;
  114. template <typename A, typename B>
  115. typename impl::make_composite<OperationT, A, B>::type
  116. operator()(A const& a, B const& b) const;
  117. template <typename A, typename B, typename C>
  118. typename impl::make_composite<OperationT, A, B, C>::type
  119. operator()(A const& a, B const& b, C const& c) const;
  120. #if PHOENIX_LIMIT > 3
  121. template <typename A, typename B, typename C, typename D>
  122. typename impl::make_composite<OperationT, A, B, C, D>::type
  123. operator()(A const& a, B const& b, C const& c, D const& d) const;
  124. template <typename A, typename B, typename C, typename D, typename E>
  125. typename impl::make_composite<
  126. OperationT, A, B, C, D, E
  127. >::type
  128. operator()(
  129. A const& a, B const& b, C const& c, D const& d, E const& e
  130. ) const;
  131. template <
  132. typename A, typename B, typename C, typename D, typename E,
  133. typename F
  134. >
  135. typename impl::make_composite<
  136. OperationT, A, B, C, D, E, F
  137. >::type
  138. operator()(
  139. A const& a, B const& b, C const& c, D const& d, E const& e,
  140. F const& f
  141. ) const;
  142. #if PHOENIX_LIMIT > 6
  143. template <
  144. typename A, typename B, typename C, typename D, typename E,
  145. typename F, typename G
  146. >
  147. typename impl::make_composite<
  148. OperationT, A, B, C, D, E, F, G
  149. >::type
  150. operator()(
  151. A const& a, B const& b, C const& c, D const& d, E const& e,
  152. F const& f, G const& g
  153. ) const;
  154. template <
  155. typename A, typename B, typename C, typename D, typename E,
  156. typename F, typename G, typename H
  157. >
  158. typename impl::make_composite<
  159. OperationT, A, B, C, D, E, F, G, H
  160. >::type
  161. operator()(
  162. A const& a, B const& b, C const& c, D const& d, E const& e,
  163. F const& f, G const& g, H const& h
  164. ) const;
  165. template <
  166. typename A, typename B, typename C, typename D, typename E,
  167. typename F, typename G, typename H, typename I
  168. >
  169. typename impl::make_composite<
  170. OperationT, A, B, C, D, E, F, G, H, I
  171. >::type
  172. operator()(
  173. A const& a, B const& b, C const& c, D const& d, E const& e,
  174. F const& f, G const& g, H const& h, I const& i
  175. ) const;
  176. #if PHOENIX_LIMIT > 9
  177. template <
  178. typename A, typename B, typename C, typename D, typename E,
  179. typename F, typename G, typename H, typename I, typename J
  180. >
  181. typename impl::make_composite<
  182. OperationT, A, B, C, D, E, F, G, H, I, J
  183. >::type
  184. operator()(
  185. A const& a, B const& b, C const& c, D const& d, E const& e,
  186. F const& f, G const& g, H const& h, I const& i, J const& j
  187. ) const;
  188. template <
  189. typename A, typename B, typename C, typename D, typename E,
  190. typename F, typename G, typename H, typename I, typename J,
  191. typename K
  192. >
  193. typename impl::make_composite<
  194. OperationT, A, B, C, D, E, F, G, H, I, J, K
  195. >::type
  196. operator()(
  197. A const& a, B const& b, C const& c, D const& d, E const& e,
  198. F const& f, G const& g, H const& h, I const& i, J const& j,
  199. K const& k
  200. ) const;
  201. template <
  202. typename A, typename B, typename C, typename D, typename E,
  203. typename F, typename G, typename H, typename I, typename J,
  204. typename K, typename L
  205. >
  206. typename impl::make_composite<
  207. OperationT, A, B, C, D, E, F, G, H, I, J, K, L
  208. >::type
  209. operator()(
  210. A const& a, B const& b, C const& c, D const& d, E const& e,
  211. F const& f, G const& g, H const& h, I const& i, J const& j,
  212. K const& k, L const& l
  213. ) const;
  214. #if PHOENIX_LIMIT > 12
  215. template <
  216. typename A, typename B, typename C, typename D, typename E,
  217. typename F, typename G, typename H, typename I, typename J,
  218. typename K, typename L, typename M
  219. >
  220. typename impl::make_composite<
  221. OperationT, A, B, C, D, E, F, G, H, I, J, K, L, M
  222. >::type
  223. operator()(
  224. A const& a, B const& b, C const& c, D const& d, E const& e,
  225. F const& f, G const& g, H const& h, I const& i, J const& j,
  226. K const& k, L const& l, M const& m
  227. ) const;
  228. template <
  229. typename A, typename B, typename C, typename D, typename E,
  230. typename F, typename G, typename H, typename I, typename J,
  231. typename K, typename L, typename M, typename N
  232. >
  233. typename impl::make_composite<
  234. OperationT, A, B, C, D, E, F, G, H, I, J, K, L, M, N
  235. >::type
  236. operator()(
  237. A const& a, B const& b, C const& c, D const& d, E const& e,
  238. F const& f, G const& g, H const& h, I const& i, J const& j,
  239. K const& k, L const& l, M const& m, N const& n
  240. ) const;
  241. template <
  242. typename A, typename B, typename C, typename D, typename E,
  243. typename F, typename G, typename H, typename I, typename J,
  244. typename K, typename L, typename M, typename N, typename O
  245. >
  246. typename impl::make_composite<
  247. OperationT, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O
  248. >::type
  249. operator()(
  250. A const& a, B const& b, C const& c, D const& d, E const& e,
  251. F const& f, G const& g, H const& h, I const& i, J const& j,
  252. K const& k, L const& l, M const& m, N const& n, O const& o
  253. ) const;
  254. #endif
  255. #endif
  256. #endif
  257. #endif
  258. OperationT op;
  259. };
  260. ///////////////////////////////////////////////////////////////////////////////
  261. //
  262. // function class implementation
  263. //
  264. ///////////////////////////////////////////////////////////////////////////////
  265. template <typename OperationT>
  266. inline actor<composite<OperationT> >
  267. function<OperationT>::operator()() const
  268. {
  269. return actor<composite<OperationT> >(op);
  270. }
  271. //////////////////////////////////
  272. template <typename OperationT>
  273. template <typename A>
  274. inline typename impl::make_composite<OperationT, A>::type
  275. function<OperationT>::operator()(A const& a) const
  276. {
  277. typedef typename impl::make_composite<OperationT, A>::composite_type ret_t;
  278. return ret_t
  279. (
  280. op,
  281. as_actor<A>::convert(a)
  282. );
  283. }
  284. //////////////////////////////////
  285. template <typename OperationT>
  286. template <typename A, typename B>
  287. inline typename impl::make_composite<OperationT, A, B>::type
  288. function<OperationT>::operator()(A const& a, B const& b) const
  289. {
  290. typedef
  291. typename impl::make_composite<OperationT, A, B>::composite_type
  292. ret_t;
  293. return ret_t(
  294. op,
  295. as_actor<A>::convert(a),
  296. as_actor<B>::convert(b)
  297. );
  298. }
  299. //////////////////////////////////
  300. template <typename OperationT>
  301. template <typename A, typename B, typename C>
  302. inline typename impl::make_composite<OperationT, A, B, C>::type
  303. function<OperationT>::operator()(A const& a, B const& b, C const& c) const
  304. {
  305. typedef
  306. typename impl::make_composite<OperationT, A, B, C>::composite_type
  307. ret_t;
  308. return ret_t(
  309. op,
  310. as_actor<A>::convert(a),
  311. as_actor<B>::convert(b),
  312. as_actor<C>::convert(c)
  313. );
  314. }
  315. #if PHOENIX_LIMIT > 3
  316. //////////////////////////////////
  317. template <typename OperationT>
  318. template <
  319. typename A, typename B, typename C, typename D
  320. >
  321. inline typename impl::make_composite<
  322. OperationT, A, B, C, D
  323. >::type
  324. function<OperationT>::operator()(
  325. A const& a, B const& b, C const& c, D const& d
  326. ) const
  327. {
  328. typedef typename impl::make_composite<
  329. OperationT, A, B, C, D
  330. >::composite_type ret_t;
  331. return ret_t(
  332. op,
  333. as_actor<A>::convert(a),
  334. as_actor<B>::convert(b),
  335. as_actor<C>::convert(c),
  336. as_actor<D>::convert(d)
  337. );
  338. }
  339. //////////////////////////////////
  340. template <typename OperationT>
  341. template <
  342. typename A, typename B, typename C, typename D, typename E
  343. >
  344. inline typename impl::make_composite<
  345. OperationT, A, B, C, D, E
  346. >::type
  347. function<OperationT>::operator()(
  348. A const& a, B const& b, C const& c, D const& d, E const& e
  349. ) const
  350. {
  351. typedef typename impl::make_composite<
  352. OperationT, A, B, C, D, E
  353. >::composite_type ret_t;
  354. return ret_t(
  355. op,
  356. as_actor<A>::convert(a),
  357. as_actor<B>::convert(b),
  358. as_actor<C>::convert(c),
  359. as_actor<D>::convert(d),
  360. as_actor<E>::convert(e)
  361. );
  362. }
  363. //////////////////////////////////
  364. template <typename OperationT>
  365. template <
  366. typename A, typename B, typename C, typename D, typename E,
  367. typename F
  368. >
  369. inline typename impl::make_composite<
  370. OperationT, A, B, C, D, E, F
  371. >::type
  372. function<OperationT>::operator()(
  373. A const& a, B const& b, C const& c, D const& d, E const& e,
  374. F const& f
  375. ) const
  376. {
  377. typedef typename impl::make_composite<
  378. OperationT, A, B, C, D, E, F
  379. >::composite_type ret_t;
  380. return ret_t(
  381. op,
  382. as_actor<A>::convert(a),
  383. as_actor<B>::convert(b),
  384. as_actor<C>::convert(c),
  385. as_actor<D>::convert(d),
  386. as_actor<E>::convert(e),
  387. as_actor<F>::convert(f)
  388. );
  389. }
  390. #if PHOENIX_LIMIT > 6
  391. //////////////////////////////////
  392. template <typename OperationT>
  393. template <
  394. typename A, typename B, typename C, typename D, typename E,
  395. typename F, typename G
  396. >
  397. inline typename impl::make_composite<
  398. OperationT, A, B, C, D, E, F, G
  399. >::type
  400. function<OperationT>::operator()(
  401. A const& a, B const& b, C const& c, D const& d, E const& e,
  402. F const& f, G const& g
  403. ) const
  404. {
  405. typedef typename impl::make_composite<
  406. OperationT, A, B, C, D, E, F, G
  407. >::composite_type ret_t;
  408. return ret_t(
  409. op,
  410. as_actor<A>::convert(a),
  411. as_actor<B>::convert(b),
  412. as_actor<C>::convert(c),
  413. as_actor<D>::convert(d),
  414. as_actor<E>::convert(e),
  415. as_actor<F>::convert(f),
  416. as_actor<G>::convert(g)
  417. );
  418. }
  419. //////////////////////////////////
  420. template <typename OperationT>
  421. template <
  422. typename A, typename B, typename C, typename D, typename E,
  423. typename F, typename G, typename H
  424. >
  425. inline typename impl::make_composite<
  426. OperationT, A, B, C, D, E, F, G, H
  427. >::type
  428. function<OperationT>::operator()(
  429. A const& a, B const& b, C const& c, D const& d, E const& e,
  430. F const& f, G const& g, H const& h
  431. ) const
  432. {
  433. typedef typename impl::make_composite<
  434. OperationT, A, B, C, D, E, F, G, H
  435. >::composite_type ret_t;
  436. return ret_t(
  437. op,
  438. as_actor<A>::convert(a),
  439. as_actor<B>::convert(b),
  440. as_actor<C>::convert(c),
  441. as_actor<D>::convert(d),
  442. as_actor<E>::convert(e),
  443. as_actor<F>::convert(f),
  444. as_actor<G>::convert(g),
  445. as_actor<H>::convert(h)
  446. );
  447. }
  448. //////////////////////////////////
  449. template <typename OperationT>
  450. template <
  451. typename A, typename B, typename C, typename D, typename E,
  452. typename F, typename G, typename H, typename I
  453. >
  454. inline typename impl::make_composite<
  455. OperationT, A, B, C, D, E, F, G, H, I
  456. >::type
  457. function<OperationT>::operator()(
  458. A const& a, B const& b, C const& c, D const& d, E const& e,
  459. F const& f, G const& g, H const& h, I const& i
  460. ) const
  461. {
  462. typedef typename impl::make_composite<
  463. OperationT, A, B, C, D, E, F, G, H, I
  464. >::composite_type ret_t;
  465. return ret_t(
  466. op,
  467. as_actor<A>::convert(a),
  468. as_actor<B>::convert(b),
  469. as_actor<C>::convert(c),
  470. as_actor<D>::convert(d),
  471. as_actor<E>::convert(e),
  472. as_actor<F>::convert(f),
  473. as_actor<G>::convert(g),
  474. as_actor<H>::convert(h),
  475. as_actor<I>::convert(i)
  476. );
  477. }
  478. #if PHOENIX_LIMIT > 9
  479. //////////////////////////////////
  480. template <typename OperationT>
  481. template <
  482. typename A, typename B, typename C, typename D, typename E,
  483. typename F, typename G, typename H, typename I, typename J
  484. >
  485. inline typename impl::make_composite<
  486. OperationT, A, B, C, D, E, F, G, H, I, J
  487. >::type
  488. function<OperationT>::operator()(
  489. A const& a, B const& b, C const& c, D const& d, E const& e,
  490. F const& f, G const& g, H const& h, I const& i, J const& j
  491. ) const
  492. {
  493. typedef typename impl::make_composite<
  494. OperationT, A, B, C, D, E, F, G, H, I, J
  495. >::composite_type ret_t;
  496. return ret_t(
  497. op,
  498. as_actor<A>::convert(a),
  499. as_actor<B>::convert(b),
  500. as_actor<C>::convert(c),
  501. as_actor<D>::convert(d),
  502. as_actor<E>::convert(e),
  503. as_actor<F>::convert(f),
  504. as_actor<G>::convert(g),
  505. as_actor<H>::convert(h),
  506. as_actor<I>::convert(i),
  507. as_actor<J>::convert(j)
  508. );
  509. }
  510. //////////////////////////////////
  511. template <typename OperationT>
  512. template <
  513. typename A, typename B, typename C, typename D, typename E,
  514. typename F, typename G, typename H, typename I, typename J,
  515. typename K
  516. >
  517. inline typename impl::make_composite<
  518. OperationT, A, B, C, D, E, F, G, H, I, J, K
  519. >::type
  520. function<OperationT>::operator()(
  521. A const& a, B const& b, C const& c, D const& d, E const& e,
  522. F const& f, G const& g, H const& h, I const& i, J const& j,
  523. K const& k
  524. ) const
  525. {
  526. typedef typename impl::make_composite<
  527. OperationT, A, B, C, D, E, F, G, H, I, J, K
  528. >::composite_type ret_t;
  529. return ret_t(
  530. op,
  531. as_actor<A>::convert(a),
  532. as_actor<B>::convert(b),
  533. as_actor<C>::convert(c),
  534. as_actor<D>::convert(d),
  535. as_actor<E>::convert(e),
  536. as_actor<F>::convert(f),
  537. as_actor<G>::convert(g),
  538. as_actor<H>::convert(h),
  539. as_actor<I>::convert(i),
  540. as_actor<J>::convert(j),
  541. as_actor<K>::convert(k)
  542. );
  543. }
  544. //////////////////////////////////
  545. template <typename OperationT>
  546. template <
  547. typename A, typename B, typename C, typename D, typename E,
  548. typename F, typename G, typename H, typename I, typename J,
  549. typename K, typename L
  550. >
  551. inline typename impl::make_composite<
  552. OperationT, A, B, C, D, E, F, G, H, I, J, K, L
  553. >::type
  554. function<OperationT>::operator()(
  555. A const& a, B const& b, C const& c, D const& d, E const& e,
  556. F const& f, G const& g, H const& h, I const& i, J const& j,
  557. K const& k, L const& l
  558. ) const
  559. {
  560. typedef typename impl::make_composite<
  561. OperationT, A, B, C, D, E, F, G, H, I, J, K, L
  562. >::composite_type ret_t;
  563. return ret_t(
  564. op,
  565. as_actor<A>::convert(a),
  566. as_actor<B>::convert(b),
  567. as_actor<C>::convert(c),
  568. as_actor<D>::convert(d),
  569. as_actor<E>::convert(e),
  570. as_actor<F>::convert(f),
  571. as_actor<G>::convert(g),
  572. as_actor<H>::convert(h),
  573. as_actor<I>::convert(i),
  574. as_actor<J>::convert(j),
  575. as_actor<K>::convert(k),
  576. as_actor<L>::convert(l)
  577. );
  578. }
  579. #if PHOENIX_LIMIT > 12
  580. //////////////////////////////////
  581. template <typename OperationT>
  582. template <
  583. typename A, typename B, typename C, typename D, typename E,
  584. typename F, typename G, typename H, typename I, typename J,
  585. typename K, typename L, typename M
  586. >
  587. inline typename impl::make_composite<
  588. OperationT, A, B, C, D, E, F, G, H, I, J, K, L, M
  589. >::type
  590. function<OperationT>::operator()(
  591. A const& a, B const& b, C const& c, D const& d, E const& e,
  592. F const& f, G const& g, H const& h, I const& i, J const& j,
  593. K const& k, L const& l, M const& m
  594. ) const
  595. {
  596. typedef typename impl::make_composite<
  597. OperationT, A, B, C, D, E, F, G, H, I, J, K, L, M
  598. >::composite_type ret_t;
  599. return ret_t(
  600. op,
  601. as_actor<A>::convert(a),
  602. as_actor<B>::convert(b),
  603. as_actor<C>::convert(c),
  604. as_actor<D>::convert(d),
  605. as_actor<E>::convert(e),
  606. as_actor<F>::convert(f),
  607. as_actor<G>::convert(g),
  608. as_actor<H>::convert(h),
  609. as_actor<I>::convert(i),
  610. as_actor<J>::convert(j),
  611. as_actor<K>::convert(k),
  612. as_actor<L>::convert(l),
  613. as_actor<M>::convert(m)
  614. );
  615. }
  616. //////////////////////////////////
  617. template <typename OperationT>
  618. template <
  619. typename A, typename B, typename C, typename D, typename E,
  620. typename F, typename G, typename H, typename I, typename J,
  621. typename K, typename L, typename M, typename N
  622. >
  623. inline typename impl::make_composite<
  624. OperationT, A, B, C, D, E, F, G, H, I, J, K, L, M, N
  625. >::type
  626. function<OperationT>::operator()(
  627. A const& a, B const& b, C const& c, D const& d, E const& e,
  628. F const& f, G const& g, H const& h, I const& i, J const& j,
  629. K const& k, L const& l, M const& m, N const& n
  630. ) const
  631. {
  632. typedef typename impl::make_composite<
  633. OperationT, A, B, C, D, E, F, G, H, I, J, K, L, M, N
  634. >::composite_type ret_t;
  635. return ret_t(
  636. op,
  637. as_actor<A>::convert(a),
  638. as_actor<B>::convert(b),
  639. as_actor<C>::convert(c),
  640. as_actor<D>::convert(d),
  641. as_actor<E>::convert(e),
  642. as_actor<F>::convert(f),
  643. as_actor<G>::convert(g),
  644. as_actor<H>::convert(h),
  645. as_actor<I>::convert(i),
  646. as_actor<J>::convert(j),
  647. as_actor<K>::convert(k),
  648. as_actor<L>::convert(l),
  649. as_actor<M>::convert(m),
  650. as_actor<N>::convert(n)
  651. );
  652. }
  653. //////////////////////////////////
  654. template <typename OperationT>
  655. template <
  656. typename A, typename B, typename C, typename D, typename E,
  657. typename F, typename G, typename H, typename I, typename J,
  658. typename K, typename L, typename M, typename N, typename O
  659. >
  660. inline typename impl::make_composite<
  661. OperationT, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O
  662. >::type
  663. function<OperationT>::operator()(
  664. A const& a, B const& b, C const& c, D const& d, E const& e,
  665. F const& f, G const& g, H const& h, I const& i, J const& j,
  666. K const& k, L const& l, M const& m, N const& n, O const& o
  667. ) const
  668. {
  669. typedef typename impl::make_composite<
  670. OperationT, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O
  671. >::composite_type ret_t;
  672. return ret_t(
  673. op,
  674. as_actor<A>::convert(a),
  675. as_actor<B>::convert(b),
  676. as_actor<C>::convert(c),
  677. as_actor<D>::convert(d),
  678. as_actor<E>::convert(e),
  679. as_actor<F>::convert(f),
  680. as_actor<G>::convert(g),
  681. as_actor<H>::convert(h),
  682. as_actor<I>::convert(i),
  683. as_actor<J>::convert(j),
  684. as_actor<K>::convert(k),
  685. as_actor<L>::convert(l),
  686. as_actor<M>::convert(m),
  687. as_actor<N>::convert(n),
  688. as_actor<O>::convert(o)
  689. );
  690. }
  691. #endif
  692. #endif
  693. #endif
  694. #endif
  695. ///////////////////////////////////////////////////////////////////////////////
  696. } // namespace phoenix
  697. #endif