iter_fold_impl.hpp 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. // Copyright Aleksey Gurtovoy 2000-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 "boost/mpl/aux_/iter_fold_impl.hpp" header
  8. // -- DO NOT modify by hand!
  9. namespace boost { namespace mpl { namespace aux {
  10. /// forward declaration
  11. template<
  12. int N
  13. , typename First
  14. , typename Last
  15. , typename State
  16. , typename ForwardOp
  17. >
  18. struct iter_fold_impl;
  19. template< int N >
  20. struct iter_fold_chunk;
  21. template<> struct iter_fold_chunk<0>
  22. {
  23. template<
  24. typename First
  25. , typename Last
  26. , typename State
  27. , typename ForwardOp
  28. >
  29. struct result_
  30. {
  31. typedef First iter0;
  32. typedef State state0;
  33. typedef state0 state;
  34. typedef iter0 iterator;
  35. };
  36. /// ETI workaround
  37. template<> struct result_< int,int,int,int >
  38. {
  39. typedef int state;
  40. typedef int iterator;
  41. };
  42. };
  43. template<> struct iter_fold_chunk<1>
  44. {
  45. template<
  46. typename First
  47. , typename Last
  48. , typename State
  49. , typename ForwardOp
  50. >
  51. struct result_
  52. {
  53. typedef First iter0;
  54. typedef State state0;
  55. typedef typename apply2< ForwardOp,state0,iter0 >::type state1;
  56. typedef typename mpl::next<iter0>::type iter1;
  57. typedef state1 state;
  58. typedef iter1 iterator;
  59. };
  60. /// ETI workaround
  61. template<> struct result_< int,int,int,int >
  62. {
  63. typedef int state;
  64. typedef int iterator;
  65. };
  66. };
  67. template<> struct iter_fold_chunk<2>
  68. {
  69. template<
  70. typename First
  71. , typename Last
  72. , typename State
  73. , typename ForwardOp
  74. >
  75. struct result_
  76. {
  77. typedef First iter0;
  78. typedef State state0;
  79. typedef typename apply2< ForwardOp,state0,iter0 >::type state1;
  80. typedef typename mpl::next<iter0>::type iter1;
  81. typedef typename apply2< ForwardOp,state1,iter1 >::type state2;
  82. typedef typename mpl::next<iter1>::type iter2;
  83. typedef state2 state;
  84. typedef iter2 iterator;
  85. };
  86. /// ETI workaround
  87. template<> struct result_< int,int,int,int >
  88. {
  89. typedef int state;
  90. typedef int iterator;
  91. };
  92. };
  93. template<> struct iter_fold_chunk<3>
  94. {
  95. template<
  96. typename First
  97. , typename Last
  98. , typename State
  99. , typename ForwardOp
  100. >
  101. struct result_
  102. {
  103. typedef First iter0;
  104. typedef State state0;
  105. typedef typename apply2< ForwardOp,state0,iter0 >::type state1;
  106. typedef typename mpl::next<iter0>::type iter1;
  107. typedef typename apply2< ForwardOp,state1,iter1 >::type state2;
  108. typedef typename mpl::next<iter1>::type iter2;
  109. typedef typename apply2< ForwardOp,state2,iter2 >::type state3;
  110. typedef typename mpl::next<iter2>::type iter3;
  111. typedef state3 state;
  112. typedef iter3 iterator;
  113. };
  114. /// ETI workaround
  115. template<> struct result_< int,int,int,int >
  116. {
  117. typedef int state;
  118. typedef int iterator;
  119. };
  120. };
  121. template<> struct iter_fold_chunk<4>
  122. {
  123. template<
  124. typename First
  125. , typename Last
  126. , typename State
  127. , typename ForwardOp
  128. >
  129. struct result_
  130. {
  131. typedef First iter0;
  132. typedef State state0;
  133. typedef typename apply2< ForwardOp,state0,iter0 >::type state1;
  134. typedef typename mpl::next<iter0>::type iter1;
  135. typedef typename apply2< ForwardOp,state1,iter1 >::type state2;
  136. typedef typename mpl::next<iter1>::type iter2;
  137. typedef typename apply2< ForwardOp,state2,iter2 >::type state3;
  138. typedef typename mpl::next<iter2>::type iter3;
  139. typedef typename apply2< ForwardOp,state3,iter3 >::type state4;
  140. typedef typename mpl::next<iter3>::type iter4;
  141. typedef state4 state;
  142. typedef iter4 iterator;
  143. };
  144. /// ETI workaround
  145. template<> struct result_< int,int,int,int >
  146. {
  147. typedef int state;
  148. typedef int iterator;
  149. };
  150. };
  151. template< int N >
  152. struct iter_fold_chunk
  153. {
  154. template<
  155. typename First
  156. , typename Last
  157. , typename State
  158. , typename ForwardOp
  159. >
  160. struct result_
  161. {
  162. typedef iter_fold_impl<
  163. 4
  164. , First
  165. , Last
  166. , State
  167. , ForwardOp
  168. > chunk_;
  169. typedef iter_fold_impl<
  170. ( (N - 4) < 0 ? 0 : N - 4 )
  171. , typename chunk_::iterator
  172. , Last
  173. , typename chunk_::state
  174. , ForwardOp
  175. > res_;
  176. typedef typename res_::state state;
  177. typedef typename res_::iterator iterator;
  178. };
  179. };
  180. template<
  181. typename First
  182. , typename Last
  183. , typename State
  184. , typename ForwardOp
  185. >
  186. struct iter_fold_step;
  187. template<
  188. typename Last
  189. , typename State
  190. >
  191. struct iter_fold_null_step
  192. {
  193. typedef Last iterator;
  194. typedef State state;
  195. };
  196. template<>
  197. struct iter_fold_chunk< -1 >
  198. {
  199. template<
  200. typename First
  201. , typename Last
  202. , typename State
  203. , typename ForwardOp
  204. >
  205. struct result_
  206. {
  207. typedef typename if_<
  208. typename is_same< First,Last >::type
  209. , iter_fold_null_step< Last,State >
  210. , iter_fold_step< First,Last,State,ForwardOp >
  211. >::type res_;
  212. typedef typename res_::state state;
  213. typedef typename res_::iterator iterator;
  214. };
  215. /// ETI workaround
  216. template<> struct result_< int,int,int,int >
  217. {
  218. typedef int state;
  219. typedef int iterator;
  220. };
  221. };
  222. template<
  223. typename First
  224. , typename Last
  225. , typename State
  226. , typename ForwardOp
  227. >
  228. struct iter_fold_step
  229. {
  230. typedef iter_fold_chunk< -1 >::template result_<
  231. typename mpl::next<First>::type
  232. , Last
  233. , typename apply2< ForwardOp,State,First >::type
  234. , ForwardOp
  235. > chunk_;
  236. typedef typename chunk_::state state;
  237. typedef typename chunk_::iterator iterator;
  238. };
  239. template<
  240. int N
  241. , typename First
  242. , typename Last
  243. , typename State
  244. , typename ForwardOp
  245. >
  246. struct iter_fold_impl
  247. : iter_fold_chunk<N>
  248. ::template result_< First,Last,State,ForwardOp >
  249. {
  250. };
  251. }}}