full_lambda.hpp 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  1. // Copyright Aleksey Gurtovoy 2001-2004
  2. //
  3. // Distributed under the Boost Software License, Version 1.0.
  4. // (See accompanying file LICENSE_1_0.txt or copy at
  5. // http://www.boost.org/LICENSE_1_0.txt)
  6. //
  7. // *Preprocessed* version of the main "full_lambda.hpp" header
  8. // -- DO NOT modify by hand!
  9. namespace boost { namespace mpl {
  10. namespace aux {
  11. template<
  12. bool C1 = false, bool C2 = false, bool C3 = false, bool C4 = false
  13. , bool C5 = false
  14. >
  15. struct lambda_or
  16. : true_
  17. {
  18. };
  19. template<>
  20. struct lambda_or< false,false,false,false,false >
  21. : false_
  22. {
  23. };
  24. } // namespace aux
  25. template<
  26. typename T
  27. , typename Tag
  28. , typename Arity
  29. >
  30. struct lambda
  31. {
  32. typedef false_ is_le;
  33. typedef T result_;
  34. typedef T type;
  35. };
  36. template<
  37. typename T
  38. >
  39. struct is_lambda_expression
  40. : lambda<T>::is_le
  41. {
  42. };
  43. template< int N, typename Tag >
  44. struct lambda< arg<N>,Tag, int_< -1 > >
  45. {
  46. typedef true_ is_le;
  47. typedef mpl::arg<N> result_; // qualified for the sake of MIPSpro 7.41
  48. typedef mpl::protect<result_> type;
  49. };
  50. template<
  51. typename F
  52. , typename Tag
  53. >
  54. struct lambda<
  55. bind0<F>
  56. , Tag
  57. , int_<1>
  58. >
  59. {
  60. typedef false_ is_le;
  61. typedef bind0<
  62. F
  63. > result_;
  64. typedef result_ type;
  65. };
  66. namespace aux {
  67. template<
  68. typename IsLE, typename Tag
  69. , template< typename P1 > class F
  70. , typename L1
  71. >
  72. struct le_result1
  73. {
  74. typedef F<
  75. typename L1::type
  76. > result_;
  77. typedef result_ type;
  78. };
  79. template<
  80. typename Tag
  81. , template< typename P1 > class F
  82. , typename L1
  83. >
  84. struct le_result1< true_,Tag,F,L1 >
  85. {
  86. typedef bind1<
  87. quote1< F,Tag >
  88. , typename L1::result_
  89. > result_;
  90. typedef mpl::protect<result_> type;
  91. };
  92. } // namespace aux
  93. template<
  94. template< typename P1 > class F
  95. , typename T1
  96. , typename Tag
  97. >
  98. struct lambda<
  99. F<T1>
  100. , Tag
  101. , int_<1>
  102. >
  103. {
  104. typedef lambda< T1,Tag > l1;
  105. typedef typename l1::is_le is_le1;
  106. typedef typename aux::lambda_or<
  107. is_le1::value
  108. >::type is_le;
  109. typedef aux::le_result1<
  110. is_le, Tag, F, l1
  111. > le_result_;
  112. typedef typename le_result_::result_ result_;
  113. typedef typename le_result_::type type;
  114. };
  115. template<
  116. typename F, typename T1
  117. , typename Tag
  118. >
  119. struct lambda<
  120. bind1< F,T1 >
  121. , Tag
  122. , int_<2>
  123. >
  124. {
  125. typedef false_ is_le;
  126. typedef bind1<
  127. F
  128. , T1
  129. > result_;
  130. typedef result_ type;
  131. };
  132. namespace aux {
  133. template<
  134. typename IsLE, typename Tag
  135. , template< typename P1, typename P2 > class F
  136. , typename L1, typename L2
  137. >
  138. struct le_result2
  139. {
  140. typedef F<
  141. typename L1::type, typename L2::type
  142. > result_;
  143. typedef result_ type;
  144. };
  145. template<
  146. typename Tag
  147. , template< typename P1, typename P2 > class F
  148. , typename L1, typename L2
  149. >
  150. struct le_result2< true_,Tag,F,L1,L2 >
  151. {
  152. typedef bind2<
  153. quote2< F,Tag >
  154. , typename L1::result_, typename L2::result_
  155. > result_;
  156. typedef mpl::protect<result_> type;
  157. };
  158. } // namespace aux
  159. template<
  160. template< typename P1, typename P2 > class F
  161. , typename T1, typename T2
  162. , typename Tag
  163. >
  164. struct lambda<
  165. F< T1,T2 >
  166. , Tag
  167. , int_<2>
  168. >
  169. {
  170. typedef lambda< T1,Tag > l1;
  171. typedef lambda< T2,Tag > l2;
  172. typedef typename l1::is_le is_le1;
  173. typedef typename l2::is_le is_le2;
  174. typedef typename aux::lambda_or<
  175. is_le1::value, is_le2::value
  176. >::type is_le;
  177. typedef aux::le_result2<
  178. is_le, Tag, F, l1, l2
  179. > le_result_;
  180. typedef typename le_result_::result_ result_;
  181. typedef typename le_result_::type type;
  182. };
  183. template<
  184. typename F, typename T1, typename T2
  185. , typename Tag
  186. >
  187. struct lambda<
  188. bind2< F,T1,T2 >
  189. , Tag
  190. , int_<3>
  191. >
  192. {
  193. typedef false_ is_le;
  194. typedef bind2<
  195. F
  196. , T1, T2
  197. > result_;
  198. typedef result_ type;
  199. };
  200. namespace aux {
  201. template<
  202. typename IsLE, typename Tag
  203. , template< typename P1, typename P2, typename P3 > class F
  204. , typename L1, typename L2, typename L3
  205. >
  206. struct le_result3
  207. {
  208. typedef F<
  209. typename L1::type, typename L2::type, typename L3::type
  210. > result_;
  211. typedef result_ type;
  212. };
  213. template<
  214. typename Tag
  215. , template< typename P1, typename P2, typename P3 > class F
  216. , typename L1, typename L2, typename L3
  217. >
  218. struct le_result3< true_,Tag,F,L1,L2,L3 >
  219. {
  220. typedef bind3<
  221. quote3< F,Tag >
  222. , typename L1::result_, typename L2::result_, typename L3::result_
  223. > result_;
  224. typedef mpl::protect<result_> type;
  225. };
  226. } // namespace aux
  227. template<
  228. template< typename P1, typename P2, typename P3 > class F
  229. , typename T1, typename T2, typename T3
  230. , typename Tag
  231. >
  232. struct lambda<
  233. F< T1,T2,T3 >
  234. , Tag
  235. , int_<3>
  236. >
  237. {
  238. typedef lambda< T1,Tag > l1;
  239. typedef lambda< T2,Tag > l2;
  240. typedef lambda< T3,Tag > l3;
  241. typedef typename l1::is_le is_le1;
  242. typedef typename l2::is_le is_le2;
  243. typedef typename l3::is_le is_le3;
  244. typedef typename aux::lambda_or<
  245. is_le1::value, is_le2::value, is_le3::value
  246. >::type is_le;
  247. typedef aux::le_result3<
  248. is_le, Tag, F, l1, l2, l3
  249. > le_result_;
  250. typedef typename le_result_::result_ result_;
  251. typedef typename le_result_::type type;
  252. };
  253. template<
  254. typename F, typename T1, typename T2, typename T3
  255. , typename Tag
  256. >
  257. struct lambda<
  258. bind3< F,T1,T2,T3 >
  259. , Tag
  260. , int_<4>
  261. >
  262. {
  263. typedef false_ is_le;
  264. typedef bind3<
  265. F
  266. , T1, T2, T3
  267. > result_;
  268. typedef result_ type;
  269. };
  270. namespace aux {
  271. template<
  272. typename IsLE, typename Tag
  273. , template< typename P1, typename P2, typename P3, typename P4 > class F
  274. , typename L1, typename L2, typename L3, typename L4
  275. >
  276. struct le_result4
  277. {
  278. typedef F<
  279. typename L1::type, typename L2::type, typename L3::type
  280. , typename L4::type
  281. > result_;
  282. typedef result_ type;
  283. };
  284. template<
  285. typename Tag
  286. , template< typename P1, typename P2, typename P3, typename P4 > class F
  287. , typename L1, typename L2, typename L3, typename L4
  288. >
  289. struct le_result4< true_,Tag,F,L1,L2,L3,L4 >
  290. {
  291. typedef bind4<
  292. quote4< F,Tag >
  293. , typename L1::result_, typename L2::result_, typename L3::result_
  294. , typename L4::result_
  295. > result_;
  296. typedef mpl::protect<result_> type;
  297. };
  298. } // namespace aux
  299. template<
  300. template< typename P1, typename P2, typename P3, typename P4 > class F
  301. , typename T1, typename T2, typename T3, typename T4
  302. , typename Tag
  303. >
  304. struct lambda<
  305. F< T1,T2,T3,T4 >
  306. , Tag
  307. , int_<4>
  308. >
  309. {
  310. typedef lambda< T1,Tag > l1;
  311. typedef lambda< T2,Tag > l2;
  312. typedef lambda< T3,Tag > l3;
  313. typedef lambda< T4,Tag > l4;
  314. typedef typename l1::is_le is_le1;
  315. typedef typename l2::is_le is_le2;
  316. typedef typename l3::is_le is_le3;
  317. typedef typename l4::is_le is_le4;
  318. typedef typename aux::lambda_or<
  319. is_le1::value, is_le2::value, is_le3::value, is_le4::value
  320. >::type is_le;
  321. typedef aux::le_result4<
  322. is_le, Tag, F, l1, l2, l3, l4
  323. > le_result_;
  324. typedef typename le_result_::result_ result_;
  325. typedef typename le_result_::type type;
  326. };
  327. template<
  328. typename F, typename T1, typename T2, typename T3, typename T4
  329. , typename Tag
  330. >
  331. struct lambda<
  332. bind4< F,T1,T2,T3,T4 >
  333. , Tag
  334. , int_<5>
  335. >
  336. {
  337. typedef false_ is_le;
  338. typedef bind4<
  339. F
  340. , T1, T2, T3, T4
  341. > result_;
  342. typedef result_ type;
  343. };
  344. namespace aux {
  345. template<
  346. typename IsLE, typename Tag
  347. , template< typename P1, typename P2, typename P3, typename P4, typename P5 > class F
  348. , typename L1, typename L2, typename L3, typename L4, typename L5
  349. >
  350. struct le_result5
  351. {
  352. typedef F<
  353. typename L1::type, typename L2::type, typename L3::type
  354. , typename L4::type, typename L5::type
  355. > result_;
  356. typedef result_ type;
  357. };
  358. template<
  359. typename Tag
  360. , template< typename P1, typename P2, typename P3, typename P4, typename P5 > class F
  361. , typename L1, typename L2, typename L3, typename L4, typename L5
  362. >
  363. struct le_result5< true_,Tag,F,L1,L2,L3,L4,L5 >
  364. {
  365. typedef bind5<
  366. quote5< F,Tag >
  367. , typename L1::result_, typename L2::result_, typename L3::result_
  368. , typename L4::result_, typename L5::result_
  369. > result_;
  370. typedef mpl::protect<result_> type;
  371. };
  372. } // namespace aux
  373. template<
  374. template<
  375. typename P1, typename P2, typename P3, typename P4
  376. , typename P5
  377. >
  378. class F
  379. , typename T1, typename T2, typename T3, typename T4, typename T5
  380. , typename Tag
  381. >
  382. struct lambda<
  383. F< T1,T2,T3,T4,T5 >
  384. , Tag
  385. , int_<5>
  386. >
  387. {
  388. typedef lambda< T1,Tag > l1;
  389. typedef lambda< T2,Tag > l2;
  390. typedef lambda< T3,Tag > l3;
  391. typedef lambda< T4,Tag > l4;
  392. typedef lambda< T5,Tag > l5;
  393. typedef typename l1::is_le is_le1;
  394. typedef typename l2::is_le is_le2;
  395. typedef typename l3::is_le is_le3;
  396. typedef typename l4::is_le is_le4;
  397. typedef typename l5::is_le is_le5;
  398. typedef typename aux::lambda_or<
  399. is_le1::value, is_le2::value, is_le3::value, is_le4::value
  400. , is_le5::value
  401. >::type is_le;
  402. typedef aux::le_result5<
  403. is_le, Tag, F, l1, l2, l3, l4, l5
  404. > le_result_;
  405. typedef typename le_result_::result_ result_;
  406. typedef typename le_result_::type type;
  407. };
  408. template<
  409. typename F, typename T1, typename T2, typename T3, typename T4
  410. , typename T5
  411. , typename Tag
  412. >
  413. struct lambda<
  414. bind5< F,T1,T2,T3,T4,T5 >
  415. , Tag
  416. , int_<6>
  417. >
  418. {
  419. typedef false_ is_le;
  420. typedef bind5<
  421. F
  422. , T1, T2, T3, T4, T5
  423. > result_;
  424. typedef result_ type;
  425. };
  426. /// special case for 'protect'
  427. template< typename T, typename Tag >
  428. struct lambda< mpl::protect<T>,Tag, int_<1> >
  429. {
  430. typedef false_ is_le;
  431. typedef mpl::protect<T> result_;
  432. typedef result_ type;
  433. };
  434. /// specializations for the main 'bind' form
  435. template<
  436. typename F, typename T1, typename T2, typename T3, typename T4
  437. , typename T5
  438. , typename Tag
  439. >
  440. struct lambda<
  441. bind< F,T1,T2,T3,T4,T5 >
  442. , Tag
  443. , int_<6>
  444. >
  445. {
  446. typedef false_ is_le;
  447. typedef bind< F,T1,T2,T3,T4,T5 > result_;
  448. typedef result_ type;
  449. };
  450. template<
  451. typename F
  452. , typename Tag1
  453. , typename Tag2
  454. , typename Arity
  455. >
  456. struct lambda<
  457. lambda< F,Tag1,Arity >
  458. , Tag2
  459. , int_<3>
  460. >
  461. {
  462. typedef lambda< F,Tag2 > l1;
  463. typedef lambda< Tag1,Tag2 > l2;
  464. typedef typename l1::is_le is_le;
  465. typedef bind1< quote1<aux::template_arity>, typename l1::result_ > arity_;
  466. typedef lambda< typename if_< is_le,arity_,Arity >::type, Tag2 > l3;
  467. typedef aux::le_result3<is_le, Tag2, mpl::lambda, l1, l2, l3> le_result_;
  468. typedef typename le_result_::result_ result_;
  469. typedef typename le_result_::type type;
  470. };
  471. BOOST_MPL_AUX_NA_SPEC2(2, 3, lambda)
  472. }}