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 iter_fold_lvalue_state
18 typename add_reference<typename add_const<State>::type>::type,
22 template<typename Result,int N>
23 struct unrolled_iter_fold
25 template<typename State, typename It0, typename F>
27 call(State const& state,It0 const& it0,F f)
34 It1 it1 = fusion::next(it0);
40 It2 it2 = fusion::next(it1);
46 It3 it3 = fusion::next(it2);
47 typedef typename iter_fold_lvalue_state<State,It0,F>::type State1;
48 State1 const state1=f(state,it0);
49 typedef typename iter_fold_lvalue_state<State1,It1,F>::type State2;
50 State2 const state2=f(state1,it1);
51 typedef typename iter_fold_lvalue_state<State2,It2,F>::type State3;
52 State3 const state3=f(state2,it2);
53 return unrolled_iter_fold<
62 template<typename Result>
63 struct unrolled_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::next(it0);
80 It2 it2 = fusion::next(it1);
81 typedef typename iter_fold_lvalue_state<State,It0,F>::type State1;
82 State1 const state1=f(state,it0);
83 typedef typename iter_fold_lvalue_state<State1,It1,F>::type State2;
84 State2 const state2=f(state1,it1);
88 template<typename Result>
89 struct unrolled_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 iter_fold_lvalue_state<State,It0,F>::type State1;
96 State1 const state1=f(state,it0);
102 template<typename Result>
103 struct unrolled_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_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_iter_fold
127 iter_fold_lvalue_state<
139 iter_fold_lvalue_state<
146 result_of::next<it1>::type
149 iter_fold_lvalue_state<
156 result_of::next<it2>::type
159 result_of_unrolled_iter_fold<
160 typename iter_fold_lvalue_state<
165 , typename result_of::next<
173 template<typename StateRef, typename It0, typename F>
174 struct result_of_unrolled_iter_fold<
182 iter_fold_lvalue_state<
194 iter_fold_lvalue_state<
195 typename iter_fold_lvalue_state<
200 , typename result_of::next<
207 template<typename StateRef, typename It0, typename F>
208 struct result_of_unrolled_iter_fold<
214 : iter_fold_lvalue_state<
215 typename iter_fold_lvalue_state<
220 , typename result_of::next<
226 template<typename StateRef, typename It0, typename F>
227 struct result_of_unrolled_iter_fold<
233 : iter_fold_lvalue_state<
239 template<typename StateRef, typename It0, typename F>
240 struct result_of_unrolled_iter_fold<
247 typedef StateRef type;
249 template<typename StateRef, typename It0, typename F, int SeqSize>
250 struct result_of_first_unrollediter_fold
253 result_of_unrolled_iter_fold<
254 typename boost::result_of<
260 , typename result_of::next<
268 template<int SeqSize, typename StateRef, typename Seq, typename F>
269 struct iter_fold_impl
272 result_of_first_unrollediter_fold<
274 , typename result_of::begin<Seq>::type
280 call(StateRef state, Seq& seq, F f)
288 return unrolled_impl::call(
294 template<typename StateRef, typename Seq, typename F>
295 struct 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_iter_fold
307 result_of::size<Seq>::value
308 , typename add_reference<
309 typename add_const<State>::type
318 template<typename Seq, typename State, typename F>
320 : detail::result_of_iter_fold<
324 , traits::is_segmented<Seq>::type::value
328 template<typename Seq, typename State, typename F>
329 inline typename result_of::iter_fold<
334 iter_fold(Seq& seq, State const& state, F f)
336 return result_of::iter_fold<Seq,State const,F>::call(
341 template<typename Seq, typename State, typename F>
342 inline typename result_of::iter_fold<
347 iter_fold(Seq const& seq, State const& state, F f)
349 return result_of::iter_fold<Seq const,State const,F>::call(
354 template<typename Seq, typename State, typename F>
355 inline typename result_of::iter_fold<
360 iter_fold(Seq& seq, State& state, F f)
362 return result_of::iter_fold<Seq,State,F>::call(
367 template<typename Seq, typename State, typename F>
368 inline typename result_of::iter_fold<
373 iter_fold(Seq const& seq, State& state, F f)
375 return result_of::iter_fold<Seq const,State,F>::call(