bind.hpp 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515
  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, int dummy_
  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, int dummy_
  95. >
  96. struct bind< F,na,na,na,na,na >
  97. : bind0<F>
  98. {
  99. };
  100. template<
  101. typename F, typename T1, int dummy_
  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, int dummy_
  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, int dummy_
  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, int dummy_
  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, int dummy_
  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, int dummy_
  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. , int dummy_
  271. >
  272. struct bind4
  273. {
  274. template<
  275. typename U1 = na, typename U2 = na, typename U3 = na
  276. , typename U4 = na, typename U5 = na
  277. >
  278. struct apply
  279. {
  280. private:
  281. typedef aux::replace_unnamed_arg< F, mpl::arg<1> > r0;
  282. typedef typename r0::type a0;
  283. typedef typename r0::next n1;
  284. typedef typename aux::resolve_bind_arg< a0,U1,U2,U3,U4,U5 >::type f_;
  285. ///
  286. typedef aux::replace_unnamed_arg< T1,n1 > r1;
  287. typedef typename r1::type a1;
  288. typedef typename r1::next n2;
  289. typedef aux::resolve_bind_arg< a1,U1,U2,U3,U4,U5 > t1;
  290. ///
  291. typedef aux::replace_unnamed_arg< T2,n2 > r2;
  292. typedef typename r2::type a2;
  293. typedef typename r2::next n3;
  294. typedef aux::resolve_bind_arg< a2,U1,U2,U3,U4,U5 > t2;
  295. ///
  296. typedef aux::replace_unnamed_arg< T3,n3 > r3;
  297. typedef typename r3::type a3;
  298. typedef typename r3::next n4;
  299. typedef aux::resolve_bind_arg< a3,U1,U2,U3,U4,U5 > t3;
  300. ///
  301. typedef aux::replace_unnamed_arg< T4,n4 > r4;
  302. typedef typename r4::type a4;
  303. typedef typename r4::next n5;
  304. typedef aux::resolve_bind_arg< a4,U1,U2,U3,U4,U5 > t4;
  305. ///
  306. public:
  307. typedef typename apply_wrap4<
  308. f_
  309. , typename t1::type, typename t2::type, typename t3::type
  310. , typename t4::type
  311. >::type type;
  312. };
  313. };
  314. namespace aux {
  315. template<
  316. typename F, typename T1, typename T2, typename T3, typename T4
  317. , typename U1, typename U2, typename U3, typename U4, typename U5
  318. >
  319. struct resolve_bind_arg<
  320. bind4< F,T1,T2,T3,T4 >, U1, U2, U3, U4, U5
  321. >
  322. {
  323. typedef bind4< F,T1,T2,T3,T4 > f_;
  324. typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type;
  325. };
  326. } // namespace aux
  327. BOOST_MPL_AUX_ARITY_SPEC(5, bind4)
  328. BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(5, bind4)
  329. template<
  330. typename F, typename T1, typename T2, typename T3, typename T4
  331. , int dummy_
  332. >
  333. struct bind< F,T1,T2,T3,T4,na >
  334. : bind4< F,T1,T2,T3,T4 >
  335. {
  336. };
  337. template<
  338. typename F, typename T1, typename T2, typename T3, typename T4
  339. , typename T5, int dummy_
  340. >
  341. struct bind5
  342. {
  343. template<
  344. typename U1 = na, typename U2 = na, typename U3 = na
  345. , typename U4 = na, typename U5 = na
  346. >
  347. struct apply
  348. {
  349. private:
  350. typedef aux::replace_unnamed_arg< F, mpl::arg<1> > r0;
  351. typedef typename r0::type a0;
  352. typedef typename r0::next n1;
  353. typedef typename aux::resolve_bind_arg< a0,U1,U2,U3,U4,U5 >::type f_;
  354. ///
  355. typedef aux::replace_unnamed_arg< T1,n1 > r1;
  356. typedef typename r1::type a1;
  357. typedef typename r1::next n2;
  358. typedef aux::resolve_bind_arg< a1,U1,U2,U3,U4,U5 > t1;
  359. ///
  360. typedef aux::replace_unnamed_arg< T2,n2 > r2;
  361. typedef typename r2::type a2;
  362. typedef typename r2::next n3;
  363. typedef aux::resolve_bind_arg< a2,U1,U2,U3,U4,U5 > t2;
  364. ///
  365. typedef aux::replace_unnamed_arg< T3,n3 > r3;
  366. typedef typename r3::type a3;
  367. typedef typename r3::next n4;
  368. typedef aux::resolve_bind_arg< a3,U1,U2,U3,U4,U5 > t3;
  369. ///
  370. typedef aux::replace_unnamed_arg< T4,n4 > r4;
  371. typedef typename r4::type a4;
  372. typedef typename r4::next n5;
  373. typedef aux::resolve_bind_arg< a4,U1,U2,U3,U4,U5 > t4;
  374. ///
  375. typedef aux::replace_unnamed_arg< T5,n5 > r5;
  376. typedef typename r5::type a5;
  377. typedef typename r5::next n6;
  378. typedef aux::resolve_bind_arg< a5,U1,U2,U3,U4,U5 > t5;
  379. ///
  380. public:
  381. typedef typename apply_wrap5<
  382. f_
  383. , typename t1::type, typename t2::type, typename t3::type
  384. , typename t4::type, typename t5::type
  385. >::type type;
  386. };
  387. };
  388. namespace aux {
  389. template<
  390. typename F, typename T1, typename T2, typename T3, typename T4
  391. , typename T5, typename U1, typename U2, typename U3, typename U4
  392. , typename U5
  393. >
  394. struct resolve_bind_arg<
  395. bind5< F,T1,T2,T3,T4,T5 >, U1, U2, U3, U4, U5
  396. >
  397. {
  398. typedef bind5< F,T1,T2,T3,T4,T5 > f_;
  399. typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type;
  400. };
  401. } // namespace aux
  402. BOOST_MPL_AUX_ARITY_SPEC(6, bind5)
  403. BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(6, bind5)
  404. /// primary template (not a specialization!)
  405. template<
  406. typename F, typename T1, typename T2, typename T3, typename T4
  407. , typename T5, int dummy_
  408. >
  409. struct bind
  410. : bind5< F,T1,T2,T3,T4,T5 >
  411. {
  412. };
  413. /// if_/eval_if specializations
  414. template< template< typename T1, typename T2, typename T3 > class F, typename Tag >
  415. struct quote3;
  416. template< typename T1, typename T2, typename T3 > struct if_;
  417. template<
  418. typename Tag, typename T1, typename T2, typename T3
  419. >
  420. struct bind3<
  421. quote3< if_,Tag >
  422. , T1, T2, T3
  423. >
  424. {
  425. template<
  426. typename U1 = na, typename U2 = na, typename U3 = na
  427. , typename U4 = na, typename U5 = na
  428. >
  429. struct apply
  430. {
  431. private:
  432. typedef mpl::arg<1> n1;
  433. typedef aux::replace_unnamed_arg< T1,n1 > r1;
  434. typedef typename r1::type a1;
  435. typedef typename r1::next n2;
  436. typedef aux::resolve_bind_arg< a1,U1,U2,U3,U4,U5 > t1;
  437. ///
  438. typedef aux::replace_unnamed_arg< T2,n2 > r2;
  439. typedef typename r2::type a2;
  440. typedef typename r2::next n3;
  441. typedef aux::resolve_bind_arg< a2,U1,U2,U3,U4,U5 > t2;
  442. ///
  443. typedef aux::replace_unnamed_arg< T3,n3 > r3;
  444. typedef typename r3::type a3;
  445. typedef typename r3::next n4;
  446. typedef aux::resolve_bind_arg< a3,U1,U2,U3,U4,U5 > t3;
  447. ///
  448. typedef typename if_<
  449. typename t1::type
  450. , t2, t3
  451. >::type f_;
  452. public:
  453. typedef typename f_::type type;
  454. };
  455. };
  456. }}