1 /*============================================================================= 2 Copyright (c) 2010 Christopher Schmidt 3 Copyright (c) 2001-2011 Joel de Guzman 4 5 Distributed under the Boost Software License, Version 1.0. (See accompanying 6 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 8 This is an auto-generated file. Do not edit! 9 ==============================================================================*/ 10 namespace boost { namespace fusion 11 { 12 namespace detail 13 { 14 template<typename State, typename It, typename F> 15 struct reverse_iter_fold_lvalue_state 16 : fusion::detail::result_of_with_decltype< 17 F( 18 typename add_reference<typename add_const<State>::type>::type, 19 It&) 20 > 21 {}; 22 template<typename Result,int N> 23 struct unrolled_reverse_iter_fold 24 { 25 template<typename State3, typename It3, typename F> 26 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED 27 static Result call_3boost::fusion::detail::unrolled_reverse_iter_fold28 call_3(State3 const& state3,It3 const& it3,F& f) 29 { 30 return unrolled_reverse_iter_fold< 31 Result 32 , N-4 33 >::call( 34 f(state3,it3), 35 fusion::prior(it3), 36 f); 37 } 38 template<typename State2, typename It2, typename F> 39 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED 40 static Result call_2boost::fusion::detail::unrolled_reverse_iter_fold41 call_2(State2 const& state2,It2 const& it2,F& f) 42 { 43 return call_3( 44 f(state2,it2), 45 fusion::prior(it2), 46 f); 47 } 48 template<typename State1, typename It1, typename F> 49 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED 50 static Result call_1boost::fusion::detail::unrolled_reverse_iter_fold51 call_1(State1 const& state1,It1 const& it1,F& f) 52 { 53 return call_2( 54 f(state1,it1), 55 fusion::prior(it1), 56 f); 57 } 58 template<typename State, typename It0, typename F> 59 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED 60 static Result callboost::fusion::detail::unrolled_reverse_iter_fold61 call(State const& state,It0 const& it0,F f) 62 { 63 return call_1( 64 f(state,it0), 65 fusion::prior(it0), 66 f); 67 } 68 }; 69 template<typename Result> 70 struct unrolled_reverse_iter_fold<Result,3> 71 { 72 template<typename State2, typename It2, typename F> 73 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED 74 static Result call_2boost::fusion::detail::unrolled_reverse_iter_fold75 call_2(State2 const& state2,It2 const& it2,F& f) 76 { 77 return f(state2,it2); 78 } 79 template<typename State1, typename It1, typename F> 80 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED 81 static Result call_1boost::fusion::detail::unrolled_reverse_iter_fold82 call_1(State1 const& state1,It1 const& it1,F& f) 83 { 84 return call_2( 85 f(state1,it1), 86 fusion::prior(it1), 87 f); 88 } 89 template<typename State, typename It0, typename F> 90 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED 91 static Result callboost::fusion::detail::unrolled_reverse_iter_fold92 call(State const& state,It0 const& it0,F f) 93 { 94 return call_1( 95 f(state,it0), 96 fusion::prior(it0), 97 f); 98 } 99 }; 100 template<typename Result> 101 struct unrolled_reverse_iter_fold<Result,2> 102 { 103 template<typename State1, typename It1, typename F> 104 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED 105 static Result call_1boost::fusion::detail::unrolled_reverse_iter_fold106 call_1(State1 const& state1,It1 const& it1,F& f) 107 { 108 return f(state1,it1); 109 } 110 template<typename State, typename It0, typename F> 111 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED 112 static Result callboost::fusion::detail::unrolled_reverse_iter_fold113 call(State const& state,It0 const& it0,F f) 114 { 115 return call_1( 116 f(state,it0), 117 fusion::prior(it0), 118 f); 119 } 120 }; 121 template<typename Result> 122 struct unrolled_reverse_iter_fold<Result,1> 123 { 124 template<typename State, typename It0, typename F> 125 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED 126 static Result callboost::fusion::detail::unrolled_reverse_iter_fold127 call(State const& state,It0 const& it0,F f) 128 { 129 return f(state, 130 it0); 131 } 132 }; 133 template<typename Result> 134 struct unrolled_reverse_iter_fold<Result,0> 135 { 136 template<typename State, typename It0, typename F> 137 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED 138 static Result callboost::fusion::detail::unrolled_reverse_iter_fold139 call(State const& state,It0 const&, F) 140 { 141 return static_cast<Result>(state); 142 } 143 }; 144 template<typename StateRef, typename It0, typename F, int N> 145 struct result_of_unrolled_reverse_iter_fold 146 { 147 typedef typename 148 reverse_iter_fold_lvalue_state< 149 StateRef 150 , It0 const 151 , F 152 >::type 153 rest1; 154 typedef typename 155 result_of::prior< 156 It0 const 157 >::type 158 it1; 159 typedef typename 160 reverse_iter_fold_lvalue_state< 161 rest1 162 , it1 163 , F 164 >::type 165 rest2; 166 typedef typename 167 result_of::prior<it1>::type 168 it2; 169 typedef typename 170 reverse_iter_fold_lvalue_state< 171 rest2 172 , it2 173 , F 174 >::type 175 rest3; 176 typedef typename 177 result_of::prior<it2>::type 178 it3; 179 typedef typename 180 result_of_unrolled_reverse_iter_fold< 181 typename reverse_iter_fold_lvalue_state< 182 rest3 183 , it3 184 , F 185 >::type 186 , typename result_of::prior< 187 it3 188 >::type 189 , F 190 , N-4 191 >::type 192 type; 193 }; 194 template<typename StateRef, typename It0, typename F> 195 struct result_of_unrolled_reverse_iter_fold< 196 StateRef 197 , It0 198 , F 199 , 3 200 > 201 { 202 typedef typename 203 reverse_iter_fold_lvalue_state< 204 StateRef 205 , It0 const 206 , F 207 >::type 208 rest1; 209 typedef typename 210 result_of::prior< 211 It0 const 212 >::type 213 it1; 214 typedef typename 215 reverse_iter_fold_lvalue_state< 216 typename reverse_iter_fold_lvalue_state< 217 rest1 218 , it1 219 , F 220 >::type 221 , typename result_of::prior< 222 it1 const 223 >::type const 224 , F 225 >::type 226 type; 227 }; 228 template<typename StateRef, typename It0, typename F> 229 struct result_of_unrolled_reverse_iter_fold< 230 StateRef 231 , It0 232 , F 233 , 2 234 > 235 : reverse_iter_fold_lvalue_state< 236 typename reverse_iter_fold_lvalue_state< 237 StateRef 238 , It0 const 239 , F 240 >::type 241 , typename result_of::prior< 242 It0 const 243 >::type const 244 , F 245 > 246 {}; 247 template<typename StateRef, typename It0, typename F> 248 struct result_of_unrolled_reverse_iter_fold< 249 StateRef 250 , It0 251 , F 252 , 1 253 > 254 : reverse_iter_fold_lvalue_state< 255 StateRef 256 , It0 const 257 , F 258 > 259 {}; 260 template<typename StateRef, typename It0, typename F> 261 struct result_of_unrolled_reverse_iter_fold< 262 StateRef 263 , It0 264 , F 265 , 0 266 > 267 { 268 typedef StateRef type; 269 }; 270 template<typename StateRef, typename It0, typename F, int SeqSize> 271 struct result_of_first_unrolledreverse_iter_fold 272 { 273 typedef typename 274 result_of_unrolled_reverse_iter_fold< 275 typename fusion::detail::result_of_with_decltype< 276 F( 277 StateRef, 278 It0 const& 279 ) 280 >::type 281 , typename result_of::prior< 282 It0 const 283 >::type 284 , F 285 , SeqSize-1 286 >::type 287 type; 288 }; 289 template<int SeqSize, typename StateRef, typename Seq, typename F> 290 struct reverse_iter_fold_impl 291 { 292 typedef typename 293 result_of_first_unrolledreverse_iter_fold< 294 StateRef 295 , typename fusion::result_of::prior< typename result_of::end<Seq>::type >::type 296 , F 297 , SeqSize 298 >::type 299 type; 300 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED 301 static type callboost::fusion::detail::reverse_iter_fold_impl302 call(StateRef state, Seq& seq, F f) 303 { 304 typedef 305 unrolled_reverse_iter_fold< 306 type 307 , SeqSize 308 > 309 unrolled_impl; 310 return unrolled_impl::call( 311 state, 312 fusion::prior( fusion::end(seq)), 313 f); 314 } 315 }; 316 template<typename StateRef, typename Seq, typename F> 317 struct reverse_iter_fold_impl<0,StateRef,Seq,F> 318 { 319 typedef StateRef type; 320 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED 321 static StateRef callboost::fusion::detail::reverse_iter_fold_impl322 call(StateRef state, Seq&, F) 323 { 324 return static_cast<StateRef>(state); 325 } 326 }; 327 template<typename Seq, typename State, typename F, bool IsSegmented> 328 struct result_of_reverse_iter_fold 329 : reverse_iter_fold_impl< 330 result_of::size<Seq>::value 331 , typename add_reference< 332 typename add_const<State>::type 333 >::type 334 , Seq 335 , F 336 > 337 {}; 338 } 339 namespace result_of 340 { 341 template<typename Seq, typename State, typename F> 342 struct reverse_iter_fold 343 : detail::result_of_reverse_iter_fold< 344 Seq 345 , State 346 , F 347 , traits::is_segmented<Seq>::type::value 348 > 349 {}; 350 } 351 template<typename Seq, typename State, typename F> 352 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED 353 inline typename result_of::reverse_iter_fold< 354 Seq 355 , State const 356 , F 357 >::type reverse_iter_fold(Seq & seq,State const & state,F f)358 reverse_iter_fold(Seq& seq, State const& state, F f) 359 { 360 return result_of::reverse_iter_fold<Seq,State const,F>::call( 361 state, 362 seq, 363 f); 364 } 365 template<typename Seq, typename State, typename F> 366 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED 367 inline typename result_of::reverse_iter_fold< 368 Seq const 369 , State const 370 , F 371 >::type reverse_iter_fold(Seq const & seq,State const & state,F f)372 reverse_iter_fold(Seq const& seq, State const& state, F f) 373 { 374 return result_of::reverse_iter_fold<Seq const,State const,F>::call( 375 state, 376 seq, 377 f); 378 } 379 template<typename Seq, typename State, typename F> 380 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED 381 inline typename result_of::reverse_iter_fold< 382 Seq 383 , State const 384 , F 385 >::type reverse_iter_fold(Seq & seq,State & state,F f)386 reverse_iter_fold(Seq& seq, State& state, F f) 387 { 388 return result_of::reverse_iter_fold<Seq,State,F>::call( 389 state, 390 seq, 391 f); 392 } 393 template<typename Seq, typename State, typename F> 394 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED 395 inline typename result_of::reverse_iter_fold< 396 Seq const 397 , State const 398 , F 399 >::type reverse_iter_fold(Seq const & seq,State & state,F f)400 reverse_iter_fold(Seq const& seq, State& state, F f) 401 { 402 return result_of::reverse_iter_fold<Seq const,State,F>::call( 403 state, 404 seq, 405 f); 406 } 407 }} 408