Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 1 | |
| 2 | // Copyright Aleksey Gurtovoy 2000-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 | |
| 9 | // Preprocessed version of "ndnboost/mpl/aux_/reverse_iter_fold_impl.hpp" header |
| 10 | // -- DO NOT modify by hand! |
| 11 | |
| 12 | namespace ndnboost { namespace mpl { namespace aux { |
| 13 | |
| 14 | /// forward declaration |
| 15 | |
| 16 | template< |
| 17 | long N |
| 18 | , typename First |
| 19 | , typename Last |
| 20 | , typename State |
| 21 | , typename BackwardOp |
| 22 | , typename ForwardOp |
| 23 | > |
| 24 | struct reverse_iter_fold_impl; |
| 25 | |
| 26 | template< long N > |
| 27 | struct reverse_iter_fold_chunk; |
| 28 | |
| 29 | template<> struct reverse_iter_fold_chunk<0> |
| 30 | { |
| 31 | template< |
| 32 | typename First |
| 33 | , typename Last |
| 34 | , typename State |
| 35 | , typename BackwardOp |
| 36 | , typename ForwardOp |
| 37 | > |
| 38 | struct result_ |
| 39 | { |
| 40 | typedef First iter0; |
| 41 | typedef State fwd_state0; |
| 42 | typedef fwd_state0 bkwd_state0; |
| 43 | typedef bkwd_state0 state; |
| 44 | typedef iter0 iterator; |
| 45 | }; |
| 46 | |
| 47 | /// ETI workaround |
| 48 | template<> struct result_< int,int,int,int,int > |
| 49 | { |
| 50 | typedef int state; |
| 51 | typedef int iterator; |
| 52 | }; |
| 53 | |
| 54 | }; |
| 55 | |
| 56 | template<> struct reverse_iter_fold_chunk<1> |
| 57 | { |
| 58 | template< |
| 59 | typename First |
| 60 | , typename Last |
| 61 | , typename State |
| 62 | , typename BackwardOp |
| 63 | , typename ForwardOp |
| 64 | > |
| 65 | struct result_ |
| 66 | { |
| 67 | typedef First iter0; |
| 68 | typedef State fwd_state0; |
| 69 | typedef typename apply2< ForwardOp,fwd_state0,iter0 >::type fwd_state1; |
| 70 | typedef typename mpl::next<iter0>::type iter1; |
| 71 | |
| 72 | |
| 73 | typedef fwd_state1 bkwd_state1; |
| 74 | typedef typename apply2< BackwardOp,bkwd_state1,iter0 >::type bkwd_state0; |
| 75 | typedef bkwd_state0 state; |
| 76 | typedef iter1 iterator; |
| 77 | }; |
| 78 | |
| 79 | /// ETI workaround |
| 80 | template<> struct result_< int,int,int,int,int > |
| 81 | { |
| 82 | typedef int state; |
| 83 | typedef int iterator; |
| 84 | }; |
| 85 | |
| 86 | }; |
| 87 | |
| 88 | template<> struct reverse_iter_fold_chunk<2> |
| 89 | { |
| 90 | template< |
| 91 | typename First |
| 92 | , typename Last |
| 93 | , typename State |
| 94 | , typename BackwardOp |
| 95 | , typename ForwardOp |
| 96 | > |
| 97 | struct result_ |
| 98 | { |
| 99 | typedef First iter0; |
| 100 | typedef State fwd_state0; |
| 101 | typedef typename apply2< ForwardOp,fwd_state0,iter0 >::type fwd_state1; |
| 102 | typedef typename mpl::next<iter0>::type iter1; |
| 103 | typedef typename apply2< ForwardOp,fwd_state1,iter1 >::type fwd_state2; |
| 104 | typedef typename mpl::next<iter1>::type iter2; |
| 105 | |
| 106 | |
| 107 | typedef fwd_state2 bkwd_state2; |
| 108 | typedef typename apply2< BackwardOp,bkwd_state2,iter1 >::type bkwd_state1; |
| 109 | typedef typename apply2< BackwardOp,bkwd_state1,iter0 >::type bkwd_state0; |
| 110 | |
| 111 | |
| 112 | typedef bkwd_state0 state; |
| 113 | typedef iter2 iterator; |
| 114 | }; |
| 115 | |
| 116 | /// ETI workaround |
| 117 | template<> struct result_< int,int,int,int,int > |
| 118 | { |
| 119 | typedef int state; |
| 120 | typedef int iterator; |
| 121 | }; |
| 122 | |
| 123 | }; |
| 124 | |
| 125 | template<> struct reverse_iter_fold_chunk<3> |
| 126 | { |
| 127 | template< |
| 128 | typename First |
| 129 | , typename Last |
| 130 | , typename State |
| 131 | , typename BackwardOp |
| 132 | , typename ForwardOp |
| 133 | > |
| 134 | struct result_ |
| 135 | { |
| 136 | typedef First iter0; |
| 137 | typedef State fwd_state0; |
| 138 | typedef typename apply2< ForwardOp,fwd_state0,iter0 >::type fwd_state1; |
| 139 | typedef typename mpl::next<iter0>::type iter1; |
| 140 | typedef typename apply2< ForwardOp,fwd_state1,iter1 >::type fwd_state2; |
| 141 | typedef typename mpl::next<iter1>::type iter2; |
| 142 | typedef typename apply2< ForwardOp,fwd_state2,iter2 >::type fwd_state3; |
| 143 | typedef typename mpl::next<iter2>::type iter3; |
| 144 | |
| 145 | |
| 146 | typedef fwd_state3 bkwd_state3; |
| 147 | typedef typename apply2< BackwardOp,bkwd_state3,iter2 >::type bkwd_state2; |
| 148 | typedef typename apply2< BackwardOp,bkwd_state2,iter1 >::type bkwd_state1; |
| 149 | typedef typename apply2< BackwardOp,bkwd_state1,iter0 >::type bkwd_state0; |
| 150 | |
| 151 | |
| 152 | typedef bkwd_state0 state; |
| 153 | typedef iter3 iterator; |
| 154 | }; |
| 155 | |
| 156 | /// ETI workaround |
| 157 | template<> struct result_< int,int,int,int,int > |
| 158 | { |
| 159 | typedef int state; |
| 160 | typedef int iterator; |
| 161 | }; |
| 162 | |
| 163 | }; |
| 164 | |
| 165 | template<> struct reverse_iter_fold_chunk<4> |
| 166 | { |
| 167 | template< |
| 168 | typename First |
| 169 | , typename Last |
| 170 | , typename State |
| 171 | , typename BackwardOp |
| 172 | , typename ForwardOp |
| 173 | > |
| 174 | struct result_ |
| 175 | { |
| 176 | typedef First iter0; |
| 177 | typedef State fwd_state0; |
| 178 | typedef typename apply2< ForwardOp,fwd_state0,iter0 >::type fwd_state1; |
| 179 | typedef typename mpl::next<iter0>::type iter1; |
| 180 | typedef typename apply2< ForwardOp,fwd_state1,iter1 >::type fwd_state2; |
| 181 | typedef typename mpl::next<iter1>::type iter2; |
| 182 | typedef typename apply2< ForwardOp,fwd_state2,iter2 >::type fwd_state3; |
| 183 | typedef typename mpl::next<iter2>::type iter3; |
| 184 | typedef typename apply2< ForwardOp,fwd_state3,iter3 >::type fwd_state4; |
| 185 | typedef typename mpl::next<iter3>::type iter4; |
| 186 | |
| 187 | |
| 188 | typedef fwd_state4 bkwd_state4; |
| 189 | typedef typename apply2< BackwardOp,bkwd_state4,iter3 >::type bkwd_state3; |
| 190 | typedef typename apply2< BackwardOp,bkwd_state3,iter2 >::type bkwd_state2; |
| 191 | typedef typename apply2< BackwardOp,bkwd_state2,iter1 >::type bkwd_state1; |
| 192 | typedef typename apply2< BackwardOp,bkwd_state1,iter0 >::type bkwd_state0; |
| 193 | |
| 194 | |
| 195 | typedef bkwd_state0 state; |
| 196 | typedef iter4 iterator; |
| 197 | }; |
| 198 | |
| 199 | /// ETI workaround |
| 200 | template<> struct result_< int,int,int,int,int > |
| 201 | { |
| 202 | typedef int state; |
| 203 | typedef int iterator; |
| 204 | }; |
| 205 | |
| 206 | }; |
| 207 | |
| 208 | template< long N > |
| 209 | struct reverse_iter_fold_chunk |
| 210 | { |
| 211 | template< |
| 212 | typename First |
| 213 | , typename Last |
| 214 | , typename State |
| 215 | , typename BackwardOp |
| 216 | , typename ForwardOp |
| 217 | > |
| 218 | struct result_ |
| 219 | { |
| 220 | typedef First iter0; |
| 221 | typedef State fwd_state0; |
| 222 | typedef typename apply2< ForwardOp,fwd_state0,iter0 >::type fwd_state1; |
| 223 | typedef typename mpl::next<iter0>::type iter1; |
| 224 | typedef typename apply2< ForwardOp,fwd_state1,iter1 >::type fwd_state2; |
| 225 | typedef typename mpl::next<iter1>::type iter2; |
| 226 | typedef typename apply2< ForwardOp,fwd_state2,iter2 >::type fwd_state3; |
| 227 | typedef typename mpl::next<iter2>::type iter3; |
| 228 | typedef typename apply2< ForwardOp,fwd_state3,iter3 >::type fwd_state4; |
| 229 | typedef typename mpl::next<iter3>::type iter4; |
| 230 | |
| 231 | |
| 232 | typedef reverse_iter_fold_impl< |
| 233 | ( (N - 4) < 0 ? 0 : N - 4 ) |
| 234 | , iter4 |
| 235 | , Last |
| 236 | , fwd_state4 |
| 237 | , BackwardOp |
| 238 | , ForwardOp |
| 239 | > nested_chunk; |
| 240 | |
| 241 | typedef typename nested_chunk::state bkwd_state4; |
| 242 | typedef typename apply2< BackwardOp,bkwd_state4,iter3 >::type bkwd_state3; |
| 243 | typedef typename apply2< BackwardOp,bkwd_state3,iter2 >::type bkwd_state2; |
| 244 | typedef typename apply2< BackwardOp,bkwd_state2,iter1 >::type bkwd_state1; |
| 245 | typedef typename apply2< BackwardOp,bkwd_state1,iter0 >::type bkwd_state0; |
| 246 | |
| 247 | |
| 248 | typedef bkwd_state0 state; |
| 249 | typedef typename nested_chunk::iterator iterator; |
| 250 | }; |
| 251 | }; |
| 252 | |
| 253 | template< |
| 254 | typename First |
| 255 | , typename Last |
| 256 | , typename State |
| 257 | , typename BackwardOp |
| 258 | , typename ForwardOp |
| 259 | > |
| 260 | struct reverse_iter_fold_step; |
| 261 | |
| 262 | template< |
| 263 | typename Last |
| 264 | , typename State |
| 265 | > |
| 266 | struct reverse_iter_fold_null_step |
| 267 | { |
| 268 | typedef Last iterator; |
| 269 | typedef State state; |
| 270 | }; |
| 271 | |
| 272 | template<> |
| 273 | struct reverse_iter_fold_chunk< -1 > |
| 274 | { |
| 275 | template< |
| 276 | typename First |
| 277 | , typename Last |
| 278 | , typename State |
| 279 | , typename BackwardOp |
| 280 | , typename ForwardOp |
| 281 | > |
| 282 | struct result_ |
| 283 | { |
| 284 | typedef typename if_< |
| 285 | typename is_same< First,Last >::type |
| 286 | , reverse_iter_fold_null_step< Last,State > |
| 287 | , reverse_iter_fold_step< First,Last,State,BackwardOp,ForwardOp > |
| 288 | >::type res_; |
| 289 | |
| 290 | typedef typename res_::state state; |
| 291 | typedef typename res_::iterator iterator; |
| 292 | }; |
| 293 | |
| 294 | /// ETI workaround |
| 295 | template<> struct result_< int,int,int,int,int > |
| 296 | { |
| 297 | typedef int state; |
| 298 | typedef int iterator; |
| 299 | }; |
| 300 | |
| 301 | }; |
| 302 | |
| 303 | template< |
| 304 | typename First |
| 305 | , typename Last |
| 306 | , typename State |
| 307 | , typename BackwardOp |
| 308 | , typename ForwardOp |
| 309 | > |
| 310 | struct reverse_iter_fold_step |
| 311 | { |
| 312 | typedef reverse_iter_fold_chunk< -1 >::template result_< |
| 313 | typename mpl::next<First>::type |
| 314 | , Last |
| 315 | , typename apply2< ForwardOp,State,First >::type |
| 316 | , BackwardOp |
| 317 | , ForwardOp |
| 318 | > nested_step; |
| 319 | |
| 320 | typedef typename apply2< |
| 321 | BackwardOp |
| 322 | , typename nested_step::state |
| 323 | , First |
| 324 | >::type state; |
| 325 | |
| 326 | typedef typename nested_step::iterator iterator; |
| 327 | }; |
| 328 | |
| 329 | template< |
| 330 | long N |
| 331 | , typename First |
| 332 | , typename Last |
| 333 | , typename State |
| 334 | , typename BackwardOp |
| 335 | , typename ForwardOp |
| 336 | > |
| 337 | struct reverse_iter_fold_impl |
| 338 | : reverse_iter_fold_chunk<N> |
| 339 | ::template result_< First,Last,State,BackwardOp,ForwardOp > |
| 340 | { |
| 341 | }; |
| 342 | |
| 343 | }}} |