1 /*=============================================================================
2 Copyright (c) 2010 Christopher Schmidt
3 Copyright (c) 2001-2011 Joel de Guzman
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)
8 This is an auto-generated file. Do not edit!
9 ==============================================================================*/
10 namespace boost { namespace fusion
14 template<typename State, typename It, typename F>
15 struct reverse_iter_fold_lvalue_state
18 typename add_reference<typename add_const<State>::type>::type,
22 template<typename Result,int N>
23 struct unrolled_reverse_iter_fold
25 template<typename State, typename It0, typename F>
27 call(State const& state,It0 const& it0,F f)
34 It1 it1 = fusion::prior(it0);
40 It2 it2 = fusion::prior(it1);
46 It3 it3 = fusion::prior(it2);
47 typedef typename reverse_iter_fold_lvalue_state<State,It0,F>::type State1;
48 State1 const state1=f(state,it0);
49 typedef typename reverse_iter_fold_lvalue_state<State1,It1,F>::type State2;
50 State2 const state2=f(state1,it1);
51 typedef typename reverse_iter_fold_lvalue_state<State2,It2,F>::type State3;
52 State3 const state3=f(state2,it2);
53 return unrolled_reverse_iter_fold<
62 template<typename Result>
63 struct unrolled_reverse_iter_fold<Result,3>
65 template<typename State, typename It0, typename F>
67 call(State const& state,It0 const& it0,F f)
74 It1 it1 = fusion::prior(it0);
80 It2 it2 = fusion::prior(it1);
81 typedef typename reverse_iter_fold_lvalue_state<State,It0,F>::type State1;
82 State1 const state1=f(state,it0);
83 typedef typename reverse_iter_fold_lvalue_state<State1,It1,F>::type State2;
84 State2 const state2=f(state1,it1);
88 template<typename Result>
89 struct unrolled_reverse_iter_fold<Result,2>
91 template<typename State, typename It0, typename F>
93 call(State const& state,It0 const& it0,F f)
95 typedef typename reverse_iter_fold_lvalue_state<State,It0,F>::type State1;
96 State1 const state1=f(state,it0);
102 template<typename Result>
103 struct unrolled_reverse_iter_fold<Result,1>
105 template<typename State, typename It0, typename F>
107 call(State const& state,It0 const& it0,F f)
113 template<typename Result>
114 struct unrolled_reverse_iter_fold<Result,0>
116 template<typename State, typename It0, typename F>
118 call(State const& state,It0 const& it0, F)
120 return static_cast<Result>(state);
123 template<typename StateRef, typename It0, typename F, int N>
124 struct result_of_unrolled_reverse_iter_fold
127 reverse_iter_fold_lvalue_state<
139 reverse_iter_fold_lvalue_state<
146 result_of::prior<it1>::type
149 reverse_iter_fold_lvalue_state<
156 result_of::prior<it2>::type
159 result_of_unrolled_reverse_iter_fold<
160 typename reverse_iter_fold_lvalue_state<
165 , typename result_of::prior<
173 template<typename StateRef, typename It0, typename F>
174 struct result_of_unrolled_reverse_iter_fold<
182 reverse_iter_fold_lvalue_state<
194 reverse_iter_fold_lvalue_state<
195 typename reverse_iter_fold_lvalue_state<
200 , typename result_of::prior<
207 template<typename StateRef, typename It0, typename F>
208 struct result_of_unrolled_reverse_iter_fold<
214 : reverse_iter_fold_lvalue_state<
215 typename reverse_iter_fold_lvalue_state<
220 , typename result_of::prior<
226 template<typename StateRef, typename It0, typename F>
227 struct result_of_unrolled_reverse_iter_fold<
233 : reverse_iter_fold_lvalue_state<
239 template<typename StateRef, typename It0, typename F>
240 struct result_of_unrolled_reverse_iter_fold<
247 typedef StateRef type;
249 template<typename StateRef, typename It0, typename F, int SeqSize>
250 struct result_of_first_unrolledreverse_iter_fold
253 result_of_unrolled_reverse_iter_fold<
254 typename boost::result_of<
260 , typename result_of::prior<
268 template<int SeqSize, typename StateRef, typename Seq, typename F>
269 struct reverse_iter_fold_impl
272 result_of_first_unrolledreverse_iter_fold<
274 , typename fusion::result_of::prior< typename result_of::end<Seq>::type >::type
280 call(StateRef state, Seq& seq, F f)
283 unrolled_reverse_iter_fold<
288 return unrolled_impl::call(
290 fusion::prior( fusion::end(seq)),
294 template<typename StateRef, typename Seq, typename F>
295 struct reverse_iter_fold_impl<0,StateRef,Seq,F>
297 typedef StateRef type;
299 call(StateRef state, Seq&, F)
301 return static_cast<StateRef>(state);
304 template<typename Seq, typename State, typename F, bool IsSegmented>
305 struct result_of_reverse_iter_fold
306 : reverse_iter_fold_impl<
307 result_of::size<Seq>::value
308 , typename add_reference<
309 typename add_const<State>::type
318 template<typename Seq, typename State, typename F>
319 struct reverse_iter_fold
320 : detail::result_of_reverse_iter_fold<
324 , traits::is_segmented<Seq>::type::value
328 template<typename Seq, typename State, typename F>
329 inline typename result_of::reverse_iter_fold<
334 reverse_iter_fold(Seq& seq, State const& state, F f)
336 return result_of::reverse_iter_fold<Seq,State const,F>::call(
341 template<typename Seq, typename State, typename F>
342 inline typename result_of::reverse_iter_fold<
347 reverse_iter_fold(Seq const& seq, State const& state, F f)
349 return result_of::reverse_iter_fold<Seq const,State const,F>::call(
354 template<typename Seq, typename State, typename F>
355 inline typename result_of::reverse_iter_fold<
360 reverse_iter_fold(Seq& seq, State& state, F f)
362 return result_of::reverse_iter_fold<Seq,State,F>::call(
367 template<typename Seq, typename State, typename F>
368 inline typename result_of::reverse_iter_fold<
373 reverse_iter_fold(Seq const& seq, State& state, F f)
375 return result_of::reverse_iter_fold<Seq const,State,F>::call(