bind.hpp 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561
  1. // Copyright Peter Dimov 2001
  2. // Copyright Aleksey Gurtovoy 2001-2004
  3. //
  4. // Distributed under the Boost Software License, Version 1.0.
  5. // (See accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt)
  7. //
  8. // Preprocessed version of "boost/mpl/bind.hpp" header
  9. // -- DO NOT modify by hand!
  10. namespace boost { namespace mpl {
  11. namespace aux {
  12. template<
  13. typename T, typename U1, typename U2, typename U3, typename U4
  14. , typename U5
  15. >
  16. struct resolve_bind_arg
  17. {
  18. typedef T type;
  19. };
  20. template<
  21. typename T
  22. , typename Arg
  23. >
  24. struct replace_unnamed_arg
  25. {
  26. typedef Arg next;
  27. typedef T type;
  28. };
  29. template<
  30. typename Arg
  31. >
  32. struct replace_unnamed_arg< arg< -1 >, Arg >
  33. {
  34. typedef typename Arg::next next;
  35. typedef Arg type;
  36. };
  37. template<
  38. int N, typename U1, typename U2, typename U3, typename U4, typename U5
  39. >
  40. struct resolve_bind_arg< arg<N>, U1, U2, U3, U4, U5 >
  41. {
  42. typedef typename apply_wrap5<mpl::arg<N>, U1, U2, U3, U4, U5>::type type;
  43. };
  44. template<
  45. typename F, typename T1, typename T2, typename T3, typename T4
  46. , typename T5, typename U1, typename U2, typename U3, typename U4
  47. , typename U5
  48. >
  49. struct resolve_bind_arg< bind< F,T1,T2,T3,T4,T5 >, U1, U2, U3, U4, U5 >
  50. {
  51. typedef bind< F,T1,T2,T3,T4,T5 > f_;
  52. typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type;
  53. };
  54. } // namespace aux
  55. template<
  56. typename F
  57. >
  58. struct bind0
  59. {
  60. template<
  61. typename U1 = na, typename U2 = na, typename U3 = na
  62. , typename U4 = na, typename U5 = na
  63. >
  64. struct apply
  65. {
  66. private:
  67. typedef aux::replace_unnamed_arg< F, mpl::arg<1> > r0;
  68. typedef typename r0::type a0;
  69. typedef typename r0::next n1;
  70. typedef typename aux::resolve_bind_arg< a0,U1,U2,U3,U4,U5 >::type f_;
  71. ///
  72. public:
  73. typedef typename apply_wrap0<
  74. f_
  75. >::type type;
  76. };
  77. };
  78. namespace aux {
  79. template<
  80. typename F, typename U1, typename U2, typename U3, typename U4
  81. , typename U5
  82. >
  83. struct resolve_bind_arg<
  84. bind0<F>, U1, U2, U3, U4, U5
  85. >
  86. {
  87. typedef bind0<F> f_;
  88. typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type;
  89. };
  90. } // namespace aux
  91. BOOST_MPL_AUX_ARITY_SPEC(1, bind0)
  92. BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(1, bind0)
  93. template<
  94. typename F
  95. >
  96. struct bind< F,na,na,na,na,na >
  97. : bind0<F>
  98. {
  99. };
  100. template<
  101. typename F, typename T1
  102. >
  103. struct bind1
  104. {
  105. template<
  106. typename U1 = na, typename U2 = na, typename U3 = na
  107. , typename U4 = na, typename U5 = na
  108. >
  109. struct apply
  110. {
  111. private:
  112. typedef aux::replace_unnamed_arg< F, mpl::arg<1> > r0;
  113. typedef typename r0::type a0;
  114. typedef typename r0::next n1;
  115. typedef typename aux::resolve_bind_arg< a0,U1,U2,U3,U4,U5 >::type f_;
  116. ///
  117. typedef aux::replace_unnamed_arg< T1,n1 > r1;
  118. typedef typename r1::type a1;
  119. typedef typename r1::next n2;
  120. typedef aux::resolve_bind_arg< a1,U1,U2,U3,U4,U5 > t1;
  121. ///
  122. public:
  123. typedef typename apply_wrap1<
  124. f_
  125. , typename t1::type
  126. >::type type;
  127. };
  128. };
  129. namespace aux {
  130. template<
  131. typename F, typename T1, typename U1, typename U2, typename U3
  132. , typename U4, typename U5
  133. >
  134. struct resolve_bind_arg<
  135. bind1< F,T1 >, U1, U2, U3, U4, U5
  136. >
  137. {
  138. typedef bind1< F,T1 > f_;
  139. typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type;
  140. };
  141. } // namespace aux
  142. BOOST_MPL_AUX_ARITY_SPEC(2, bind1)
  143. BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(2, bind1)
  144. template<
  145. typename F, typename T1
  146. >
  147. struct bind< F,T1,na,na,na,na >
  148. : bind1< F,T1 >
  149. {
  150. };
  151. template<
  152. typename F, typename T1, typename T2
  153. >
  154. struct bind2
  155. {
  156. template<
  157. typename U1 = na, typename U2 = na, typename U3 = na
  158. , typename U4 = na, typename U5 = na
  159. >
  160. struct apply
  161. {
  162. private:
  163. typedef aux::replace_unnamed_arg< F, mpl::arg<1> > r0;
  164. typedef typename r0::type a0;
  165. typedef typename r0::next n1;
  166. typedef typename aux::resolve_bind_arg< a0,U1,U2,U3,U4,U5 >::type f_;
  167. ///
  168. typedef aux::replace_unnamed_arg< T1,n1 > r1;
  169. typedef typename r1::type a1;
  170. typedef typename r1::next n2;
  171. typedef aux::resolve_bind_arg< a1,U1,U2,U3,U4,U5 > t1;
  172. ///
  173. typedef aux::replace_unnamed_arg< T2,n2 > r2;
  174. typedef typename r2::type a2;
  175. typedef typename r2::next n3;
  176. typedef aux::resolve_bind_arg< a2,U1,U2,U3,U4,U5 > t2;
  177. ///
  178. public:
  179. typedef typename apply_wrap2<
  180. f_
  181. , typename t1::type, typename t2::type
  182. >::type type;
  183. };
  184. };
  185. namespace aux {
  186. template<
  187. typename F, typename T1, typename T2, typename U1, typename U2
  188. , typename U3, typename U4, typename U5
  189. >
  190. struct resolve_bind_arg<
  191. bind2< F,T1,T2 >, U1, U2, U3, U4, U5
  192. >
  193. {
  194. typedef bind2< F,T1,T2 > f_;
  195. typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type;
  196. };
  197. } // namespace aux
  198. BOOST_MPL_AUX_ARITY_SPEC(3, bind2)
  199. BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(3, bind2)
  200. template<
  201. typename F, typename T1, typename T2
  202. >
  203. struct bind< F,T1,T2,na,na,na >
  204. : bind2< F,T1,T2 >
  205. {
  206. };
  207. template<
  208. typename F, typename T1, typename T2, typename T3
  209. >
  210. struct bind3
  211. {
  212. template<
  213. typename U1 = na, typename U2 = na, typename U3 = na
  214. , typename U4 = na, typename U5 = na
  215. >
  216. struct apply
  217. {
  218. private:
  219. typedef aux::replace_unnamed_arg< F, mpl::arg<1> > r0;
  220. typedef typename r0::type a0;
  221. typedef typename r0::next n1;
  222. typedef typename aux::resolve_bind_arg< a0,U1,U2,U3,U4,U5 >::type f_;
  223. ///
  224. typedef aux::replace_unnamed_arg< T1,n1 > r1;
  225. typedef typename r1::type a1;
  226. typedef typename r1::next n2;
  227. typedef aux::resolve_bind_arg< a1,U1,U2,U3,U4,U5 > t1;
  228. ///
  229. typedef aux::replace_unnamed_arg< T2,n2 > r2;
  230. typedef typename r2::type a2;
  231. typedef typename r2::next n3;
  232. typedef aux::resolve_bind_arg< a2,U1,U2,U3,U4,U5 > t2;
  233. ///
  234. typedef aux::replace_unnamed_arg< T3,n3 > r3;
  235. typedef typename r3::type a3;
  236. typedef typename r3::next n4;
  237. typedef aux::resolve_bind_arg< a3,U1,U2,U3,U4,U5 > t3;
  238. ///
  239. public:
  240. typedef typename apply_wrap3<
  241. f_
  242. , typename t1::type, typename t2::type, typename t3::type
  243. >::type type;
  244. };
  245. };
  246. namespace aux {
  247. template<
  248. typename F, typename T1, typename T2, typename T3, typename U1
  249. , typename U2, typename U3, typename U4, typename U5
  250. >
  251. struct resolve_bind_arg<
  252. bind3< F,T1,T2,T3 >, U1, U2, U3, U4, U5
  253. >
  254. {
  255. typedef bind3< F,T1,T2,T3 > f_;
  256. typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type;
  257. };
  258. } // namespace aux
  259. BOOST_MPL_AUX_ARITY_SPEC(4, bind3)
  260. BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(4, bind3)
  261. template<
  262. typename F, typename T1, typename T2, typename T3
  263. >
  264. struct bind< F,T1,T2,T3,na,na >
  265. : bind3< F,T1,T2,T3 >
  266. {
  267. };
  268. template<
  269. typename F, typename T1, typename T2, typename T3, typename T4
  270. >
  271. struct bind4
  272. {
  273. template<
  274. typename U1 = na, typename U2 = na, typename U3 = na
  275. , typename U4 = na, typename U5 = na
  276. >
  277. struct apply
  278. {
  279. private:
  280. typedef aux::replace_unnamed_arg< F, mpl::arg<1> > r0;
  281. typedef typename r0::type a0;
  282. typedef typename r0::next n1;
  283. typedef typename aux::resolve_bind_arg< a0,U1,U2,U3,U4,U5 >::type f_;
  284. ///
  285. typedef aux::replace_unnamed_arg< T1,n1 > r1;
  286. typedef typename r1::type a1;
  287. typedef typename r1::next n2;
  288. typedef aux::resolve_bind_arg< a1,U1,U2,U3,U4,U5 > t1;
  289. ///
  290. typedef aux::replace_unnamed_arg< T2,n2 > r2;
  291. typedef typename r2::type a2;
  292. typedef typename r2::next n3;
  293. typedef aux::resolve_bind_arg< a2,U1,U2,U3,U4,U5 > t2;
  294. ///
  295. typedef aux::replace_unnamed_arg< T3,n3 > r3;
  296. typedef typename r3::type a3;
  297. typedef typename r3::next n4;
  298. typedef aux::resolve_bind_arg< a3,U1,U2,U3,U4,U5 > t3;
  299. ///
  300. typedef aux::replace_unnamed_arg< T4,n4 > r4;
  301. typedef typename r4::type a4;
  302. typedef typename r4::next n5;
  303. typedef aux::resolve_bind_arg< a4,U1,U2,U3,U4,U5 > t4;
  304. ///
  305. public:
  306. typedef typename apply_wrap4<
  307. f_
  308. , typename t1::type, typename t2::type, typename t3::type
  309. , typename t4::type
  310. >::type type;
  311. };
  312. };
  313. namespace aux {
  314. template<
  315. typename F, typename T1, typename T2, typename T3, typename T4
  316. , typename U1, typename U2, typename U3, typename U4, typename U5
  317. >
  318. struct resolve_bind_arg<
  319. bind4< F,T1,T2,T3,T4 >, U1, U2, U3, U4, U5
  320. >
  321. {
  322. typedef bind4< F,T1,T2,T3,T4 > f_;
  323. typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type;
  324. };
  325. } // namespace aux
  326. BOOST_MPL_AUX_ARITY_SPEC(5, bind4)
  327. BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(5, bind4)
  328. template<
  329. typename F, typename T1, typename T2, typename T3, typename T4
  330. >
  331. struct bind< F,T1,T2,T3,T4,na >
  332. : bind4< F,T1,T2,T3,T4 >
  333. {
  334. };
  335. template<
  336. typename F, typename T1, typename T2, typename T3, typename T4
  337. , typename T5
  338. >
  339. struct bind5
  340. {
  341. template<
  342. typename U1 = na, typename U2 = na, typename U3 = na
  343. , typename U4 = na, typename U5 = na
  344. >
  345. struct apply
  346. {
  347. private:
  348. typedef aux::replace_unnamed_arg< F, mpl::arg<1> > r0;
  349. typedef typename r0::type a0;
  350. typedef typename r0::next n1;
  351. typedef typename aux::resolve_bind_arg< a0,U1,U2,U3,U4,U5 >::type f_;
  352. ///
  353. typedef aux::replace_unnamed_arg< T1,n1 > r1;
  354. typedef typename r1::type a1;
  355. typedef typename r1::next n2;
  356. typedef aux::resolve_bind_arg< a1,U1,U2,U3,U4,U5 > t1;
  357. ///
  358. typedef aux::replace_unnamed_arg< T2,n2 > r2;
  359. typedef typename r2::type a2;
  360. typedef typename r2::next n3;
  361. typedef aux::resolve_bind_arg< a2,U1,U2,U3,U4,U5 > t2;
  362. ///
  363. typedef aux::replace_unnamed_arg< T3,n3 > r3;
  364. typedef typename r3::type a3;
  365. typedef typename r3::next n4;
  366. typedef aux::resolve_bind_arg< a3,U1,U2,U3,U4,U5 > t3;
  367. ///
  368. typedef aux::replace_unnamed_arg< T4,n4 > r4;
  369. typedef typename r4::type a4;
  370. typedef typename r4::next n5;
  371. typedef aux::resolve_bind_arg< a4,U1,U2,U3,U4,U5 > t4;
  372. ///
  373. typedef aux::replace_unnamed_arg< T5,n5 > r5;
  374. typedef typename r5::type a5;
  375. typedef typename r5::next n6;
  376. typedef aux::resolve_bind_arg< a5,U1,U2,U3,U4,U5 > t5;
  377. ///
  378. public:
  379. typedef typename apply_wrap5<
  380. f_
  381. , typename t1::type, typename t2::type, typename t3::type
  382. , typename t4::type, typename t5::type
  383. >::type type;
  384. };
  385. };
  386. namespace aux {
  387. template<
  388. typename F, typename T1, typename T2, typename T3, typename T4
  389. , typename T5, typename U1, typename U2, typename U3, typename U4
  390. , typename U5
  391. >
  392. struct resolve_bind_arg<
  393. bind5< F,T1,T2,T3,T4,T5 >, U1, U2, U3, U4, U5
  394. >
  395. {
  396. typedef bind5< F,T1,T2,T3,T4,T5 > f_;
  397. typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type;
  398. };
  399. } // namespace aux
  400. BOOST_MPL_AUX_ARITY_SPEC(6, bind5)
  401. BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(6, bind5)
  402. /// primary template (not a specialization!)
  403. template<
  404. typename F, typename T1, typename T2, typename T3, typename T4
  405. , typename T5
  406. >
  407. struct bind
  408. : bind5< F,T1,T2,T3,T4,T5 >
  409. {
  410. };
  411. /// if_/eval_if specializations
  412. template< template< typename T1, typename T2, typename T3 > class F, typename Tag >
  413. struct quote3;
  414. template< typename T1, typename T2, typename T3 > struct if_;
  415. template<
  416. typename Tag, typename T1, typename T2, typename T3
  417. >
  418. struct bind3<
  419. quote3< if_,Tag >
  420. , T1, T2, T3
  421. >
  422. {
  423. template<
  424. typename U1 = na, typename U2 = na, typename U3 = na
  425. , typename U4 = na, typename U5 = na
  426. >
  427. struct apply
  428. {
  429. private:
  430. typedef mpl::arg<1> n1;
  431. typedef aux::replace_unnamed_arg< T1,n1 > r1;
  432. typedef typename r1::type a1;
  433. typedef typename r1::next n2;
  434. typedef aux::resolve_bind_arg< a1,U1,U2,U3,U4,U5 > t1;
  435. ///
  436. typedef aux::replace_unnamed_arg< T2,n2 > r2;
  437. typedef typename r2::type a2;
  438. typedef typename r2::next n3;
  439. typedef aux::resolve_bind_arg< a2,U1,U2,U3,U4,U5 > t2;
  440. ///
  441. typedef aux::replace_unnamed_arg< T3,n3 > r3;
  442. typedef typename r3::type a3;
  443. typedef typename r3::next n4;
  444. typedef aux::resolve_bind_arg< a3,U1,U2,U3,U4,U5 > t3;
  445. ///
  446. typedef typename if_<
  447. typename t1::type
  448. , t2, t3
  449. >::type f_;
  450. public:
  451. typedef typename f_::type type;
  452. };
  453. };
  454. template<
  455. template< typename T1, typename T2, typename T3 > class F, typename Tag
  456. >
  457. struct quote3;
  458. template< typename T1, typename T2, typename T3 > struct eval_if;
  459. template<
  460. typename Tag, typename T1, typename T2, typename T3
  461. >
  462. struct bind3<
  463. quote3< eval_if,Tag >
  464. , T1, T2, T3
  465. >
  466. {
  467. template<
  468. typename U1 = na, typename U2 = na, typename U3 = na
  469. , typename U4 = na, typename U5 = na
  470. >
  471. struct apply
  472. {
  473. private:
  474. typedef mpl::arg<1> n1;
  475. typedef aux::replace_unnamed_arg< T1,n1 > r1;
  476. typedef typename r1::type a1;
  477. typedef typename r1::next n2;
  478. typedef aux::resolve_bind_arg< a1,U1,U2,U3,U4,U5 > t1;
  479. ///
  480. typedef aux::replace_unnamed_arg< T2,n2 > r2;
  481. typedef typename r2::type a2;
  482. typedef typename r2::next n3;
  483. typedef aux::resolve_bind_arg< a2,U1,U2,U3,U4,U5 > t2;
  484. ///
  485. typedef aux::replace_unnamed_arg< T3,n3 > r3;
  486. typedef typename r3::type a3;
  487. typedef typename r3::next n4;
  488. typedef aux::resolve_bind_arg< a3,U1,U2,U3,U4,U5 > t3;
  489. ///
  490. typedef typename eval_if<
  491. typename t1::type
  492. , t2, t3
  493. >::type f_;
  494. public:
  495. typedef typename f_::type type;
  496. };
  497. };
  498. }}