basic_bind.hpp 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441
  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/aux_/basic_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. int N, typename U1, typename U2, typename U3, typename U4, typename U5
  22. >
  23. struct resolve_bind_arg< arg<N>, U1, U2, U3, U4, U5 >
  24. {
  25. typedef typename apply_wrap5<mpl::arg<N>, U1, U2, U3, U4, U5>::type type;
  26. };
  27. template<
  28. typename F, typename T1, typename T2, typename T3, typename T4
  29. , typename T5, typename U1, typename U2, typename U3, typename U4
  30. , typename U5
  31. >
  32. struct resolve_bind_arg< bind< F,T1,T2,T3,T4,T5 >, U1, U2, U3, U4, U5 >
  33. {
  34. typedef bind< F,T1,T2,T3,T4,T5 > f_;
  35. typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type;
  36. };
  37. } // namespace aux
  38. template<
  39. typename F
  40. >
  41. struct bind0
  42. {
  43. template<
  44. typename U1 = na, typename U2 = na, typename U3 = na
  45. , typename U4 = na, typename U5 = na
  46. >
  47. struct apply
  48. {
  49. private:
  50. typedef typename aux::resolve_bind_arg< F,U1,U2,U3,U4,U5 >::type f_;
  51. public:
  52. typedef typename apply_wrap0<
  53. f_
  54. >::type type;
  55. };
  56. };
  57. namespace aux {
  58. template<
  59. typename F, typename U1, typename U2, typename U3, typename U4
  60. , typename U5
  61. >
  62. struct resolve_bind_arg<
  63. bind0<F>, U1, U2, U3, U4, U5
  64. >
  65. {
  66. typedef bind0<F> f_;
  67. typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type;
  68. };
  69. } // namespace aux
  70. BOOST_MPL_AUX_ARITY_SPEC(1, bind0)
  71. BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(1, bind0)
  72. template<
  73. typename F
  74. >
  75. struct bind< F,na,na,na,na,na >
  76. : bind0<F>
  77. {
  78. };
  79. template<
  80. typename F, typename T1
  81. >
  82. struct bind1
  83. {
  84. template<
  85. typename U1 = na, typename U2 = na, typename U3 = na
  86. , typename U4 = na, typename U5 = na
  87. >
  88. struct apply
  89. {
  90. private:
  91. typedef typename aux::resolve_bind_arg< F,U1,U2,U3,U4,U5 >::type f_;
  92. typedef aux::resolve_bind_arg< T1,U1,U2,U3,U4,U5 > t1;
  93. public:
  94. typedef typename apply_wrap1<
  95. f_
  96. , typename t1::type
  97. >::type type;
  98. };
  99. };
  100. namespace aux {
  101. template<
  102. typename F, typename T1, typename U1, typename U2, typename U3
  103. , typename U4, typename U5
  104. >
  105. struct resolve_bind_arg<
  106. bind1< F,T1 >, U1, U2, U3, U4, U5
  107. >
  108. {
  109. typedef bind1< F,T1 > f_;
  110. typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type;
  111. };
  112. } // namespace aux
  113. BOOST_MPL_AUX_ARITY_SPEC(2, bind1)
  114. BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(2, bind1)
  115. template<
  116. typename F, typename T1
  117. >
  118. struct bind< F,T1,na,na,na,na >
  119. : bind1< F,T1 >
  120. {
  121. };
  122. template<
  123. typename F, typename T1, typename T2
  124. >
  125. struct bind2
  126. {
  127. template<
  128. typename U1 = na, typename U2 = na, typename U3 = na
  129. , typename U4 = na, typename U5 = na
  130. >
  131. struct apply
  132. {
  133. private:
  134. typedef typename aux::resolve_bind_arg< F,U1,U2,U3,U4,U5 >::type f_;
  135. typedef aux::resolve_bind_arg< T1,U1,U2,U3,U4,U5 > t1;
  136. typedef aux::resolve_bind_arg< T2,U1,U2,U3,U4,U5 > t2;
  137. public:
  138. typedef typename apply_wrap2<
  139. f_
  140. , typename t1::type, typename t2::type
  141. >::type type;
  142. };
  143. };
  144. namespace aux {
  145. template<
  146. typename F, typename T1, typename T2, typename U1, typename U2
  147. , typename U3, typename U4, typename U5
  148. >
  149. struct resolve_bind_arg<
  150. bind2< F,T1,T2 >, U1, U2, U3, U4, U5
  151. >
  152. {
  153. typedef bind2< F,T1,T2 > f_;
  154. typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type;
  155. };
  156. } // namespace aux
  157. BOOST_MPL_AUX_ARITY_SPEC(3, bind2)
  158. BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(3, bind2)
  159. template<
  160. typename F, typename T1, typename T2
  161. >
  162. struct bind< F,T1,T2,na,na,na >
  163. : bind2< F,T1,T2 >
  164. {
  165. };
  166. template<
  167. typename F, typename T1, typename T2, typename T3
  168. >
  169. struct bind3
  170. {
  171. template<
  172. typename U1 = na, typename U2 = na, typename U3 = na
  173. , typename U4 = na, typename U5 = na
  174. >
  175. struct apply
  176. {
  177. private:
  178. typedef typename aux::resolve_bind_arg< F,U1,U2,U3,U4,U5 >::type f_;
  179. typedef aux::resolve_bind_arg< T1,U1,U2,U3,U4,U5 > t1;
  180. typedef aux::resolve_bind_arg< T2,U1,U2,U3,U4,U5 > t2;
  181. typedef aux::resolve_bind_arg< T3,U1,U2,U3,U4,U5 > t3;
  182. public:
  183. typedef typename apply_wrap3<
  184. f_
  185. , typename t1::type, typename t2::type, typename t3::type
  186. >::type type;
  187. };
  188. };
  189. namespace aux {
  190. template<
  191. typename F, typename T1, typename T2, typename T3, typename U1
  192. , typename U2, typename U3, typename U4, typename U5
  193. >
  194. struct resolve_bind_arg<
  195. bind3< F,T1,T2,T3 >, U1, U2, U3, U4, U5
  196. >
  197. {
  198. typedef bind3< F,T1,T2,T3 > f_;
  199. typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type;
  200. };
  201. } // namespace aux
  202. BOOST_MPL_AUX_ARITY_SPEC(4, bind3)
  203. BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(4, bind3)
  204. template<
  205. typename F, typename T1, typename T2, typename T3
  206. >
  207. struct bind< F,T1,T2,T3,na,na >
  208. : bind3< F,T1,T2,T3 >
  209. {
  210. };
  211. template<
  212. typename F, typename T1, typename T2, typename T3, typename T4
  213. >
  214. struct bind4
  215. {
  216. template<
  217. typename U1 = na, typename U2 = na, typename U3 = na
  218. , typename U4 = na, typename U5 = na
  219. >
  220. struct apply
  221. {
  222. private:
  223. typedef typename aux::resolve_bind_arg< F,U1,U2,U3,U4,U5 >::type f_;
  224. typedef aux::resolve_bind_arg< T1,U1,U2,U3,U4,U5 > t1;
  225. typedef aux::resolve_bind_arg< T2,U1,U2,U3,U4,U5 > t2;
  226. typedef aux::resolve_bind_arg< T3,U1,U2,U3,U4,U5 > t3;
  227. typedef aux::resolve_bind_arg< T4,U1,U2,U3,U4,U5 > t4;
  228. public:
  229. typedef typename apply_wrap4<
  230. f_
  231. , typename t1::type, typename t2::type, typename t3::type
  232. , typename t4::type
  233. >::type type;
  234. };
  235. };
  236. namespace aux {
  237. template<
  238. typename F, typename T1, typename T2, typename T3, typename T4
  239. , typename U1, typename U2, typename U3, typename U4, typename U5
  240. >
  241. struct resolve_bind_arg<
  242. bind4< F,T1,T2,T3,T4 >, U1, U2, U3, U4, U5
  243. >
  244. {
  245. typedef bind4< F,T1,T2,T3,T4 > f_;
  246. typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type;
  247. };
  248. } // namespace aux
  249. BOOST_MPL_AUX_ARITY_SPEC(5, bind4)
  250. BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(5, bind4)
  251. template<
  252. typename F, typename T1, typename T2, typename T3, typename T4
  253. >
  254. struct bind< F,T1,T2,T3,T4,na >
  255. : bind4< F,T1,T2,T3,T4 >
  256. {
  257. };
  258. template<
  259. typename F, typename T1, typename T2, typename T3, typename T4
  260. , typename T5
  261. >
  262. struct bind5
  263. {
  264. template<
  265. typename U1 = na, typename U2 = na, typename U3 = na
  266. , typename U4 = na, typename U5 = na
  267. >
  268. struct apply
  269. {
  270. private:
  271. typedef typename aux::resolve_bind_arg< F,U1,U2,U3,U4,U5 >::type f_;
  272. typedef aux::resolve_bind_arg< T1,U1,U2,U3,U4,U5 > t1;
  273. typedef aux::resolve_bind_arg< T2,U1,U2,U3,U4,U5 > t2;
  274. typedef aux::resolve_bind_arg< T3,U1,U2,U3,U4,U5 > t3;
  275. typedef aux::resolve_bind_arg< T4,U1,U2,U3,U4,U5 > t4;
  276. typedef aux::resolve_bind_arg< T5,U1,U2,U3,U4,U5 > t5;
  277. public:
  278. typedef typename apply_wrap5<
  279. f_
  280. , typename t1::type, typename t2::type, typename t3::type
  281. , typename t4::type, typename t5::type
  282. >::type type;
  283. };
  284. };
  285. namespace aux {
  286. template<
  287. typename F, typename T1, typename T2, typename T3, typename T4
  288. , typename T5, typename U1, typename U2, typename U3, typename U4
  289. , typename U5
  290. >
  291. struct resolve_bind_arg<
  292. bind5< F,T1,T2,T3,T4,T5 >, U1, U2, U3, U4, U5
  293. >
  294. {
  295. typedef bind5< F,T1,T2,T3,T4,T5 > f_;
  296. typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type;
  297. };
  298. } // namespace aux
  299. BOOST_MPL_AUX_ARITY_SPEC(6, bind5)
  300. BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(6, bind5)
  301. /// primary template (not a specialization!)
  302. template<
  303. typename F, typename T1, typename T2, typename T3, typename T4
  304. , typename T5
  305. >
  306. struct bind
  307. : bind5< F,T1,T2,T3,T4,T5 >
  308. {
  309. };
  310. /// if_/eval_if specializations
  311. template< template< typename T1, typename T2, typename T3 > class F, typename Tag >
  312. struct quote3;
  313. template< typename T1, typename T2, typename T3 > struct if_;
  314. template<
  315. typename Tag, typename T1, typename T2, typename T3
  316. >
  317. struct bind3<
  318. quote3< if_,Tag >
  319. , T1, T2, T3
  320. >
  321. {
  322. template<
  323. typename U1 = na, typename U2 = na, typename U3 = na
  324. , typename U4 = na, typename U5 = na
  325. >
  326. struct apply
  327. {
  328. private:
  329. typedef mpl::arg<1> n1;
  330. typedef aux::resolve_bind_arg< T1,U1,U2,U3,U4,U5 > t1;
  331. typedef aux::resolve_bind_arg< T2,U1,U2,U3,U4,U5 > t2;
  332. typedef aux::resolve_bind_arg< T3,U1,U2,U3,U4,U5 > t3;
  333. typedef typename if_<
  334. typename t1::type
  335. , t2, t3
  336. >::type f_;
  337. public:
  338. typedef typename f_::type type;
  339. };
  340. };
  341. template<
  342. template< typename T1, typename T2, typename T3 > class F, typename Tag
  343. >
  344. struct quote3;
  345. template< typename T1, typename T2, typename T3 > struct eval_if;
  346. template<
  347. typename Tag, typename T1, typename T2, typename T3
  348. >
  349. struct bind3<
  350. quote3< eval_if,Tag >
  351. , T1, T2, T3
  352. >
  353. {
  354. template<
  355. typename U1 = na, typename U2 = na, typename U3 = na
  356. , typename U4 = na, typename U5 = na
  357. >
  358. struct apply
  359. {
  360. private:
  361. typedef mpl::arg<1> n1;
  362. typedef aux::resolve_bind_arg< T1,U1,U2,U3,U4,U5 > t1;
  363. typedef aux::resolve_bind_arg< T2,U1,U2,U3,U4,U5 > t2;
  364. typedef aux::resolve_bind_arg< T3,U1,U2,U3,U4,U5 > t3;
  365. typedef typename eval_if<
  366. typename t1::type
  367. , t2, t3
  368. >::type f_;
  369. public:
  370. typedef typename f_::type type;
  371. };
  372. };
  373. }}