blob: 494cd411b82cbc5c14ca0948439706ca74c0c04d [file] [log] [blame]
Jeff Thompsona28eed82013-08-22 16:21:10 -07001
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_/fold_impl.hpp" header
10// -- DO NOT modify by hand!
11
12namespace ndnboost { namespace mpl { namespace aux {
13
14/// forward declaration
15
16template<
17 int N
18 , typename First
19 , typename Last
20 , typename State
21 , typename ForwardOp
22 >
23struct fold_impl;
24
25template<
26 typename First
27 , typename Last
28 , typename State
29 , typename ForwardOp
30 >
31struct fold_impl< 0,First,Last,State,ForwardOp >
32{
33 typedef First iter0;
34 typedef State state0;
35 typedef state0 state;
36 typedef iter0 iterator;
37};
38
39template<
40 typename First
41 , typename Last
42 , typename State
43 , typename ForwardOp
44 >
45struct fold_impl< 1,First,Last,State,ForwardOp >
46{
47 typedef First iter0;
48 typedef State state0;
49 typedef typename apply2< ForwardOp, state0, typename deref<iter0>::type >::type state1;
50 typedef typename mpl::next<iter0>::type iter1;
51
52
53 typedef state1 state;
54 typedef iter1 iterator;
55};
56
57template<
58 typename First
59 , typename Last
60 , typename State
61 , typename ForwardOp
62 >
63struct fold_impl< 2,First,Last,State,ForwardOp >
64{
65 typedef First iter0;
66 typedef State state0;
67 typedef typename apply2< ForwardOp, state0, typename deref<iter0>::type >::type state1;
68 typedef typename mpl::next<iter0>::type iter1;
69 typedef typename apply2< ForwardOp, state1, typename deref<iter1>::type >::type state2;
70 typedef typename mpl::next<iter1>::type iter2;
71
72
73 typedef state2 state;
74 typedef iter2 iterator;
75};
76
77template<
78 typename First
79 , typename Last
80 , typename State
81 , typename ForwardOp
82 >
83struct fold_impl< 3,First,Last,State,ForwardOp >
84{
85 typedef First iter0;
86 typedef State state0;
87 typedef typename apply2< ForwardOp, state0, typename deref<iter0>::type >::type state1;
88 typedef typename mpl::next<iter0>::type iter1;
89 typedef typename apply2< ForwardOp, state1, typename deref<iter1>::type >::type state2;
90 typedef typename mpl::next<iter1>::type iter2;
91 typedef typename apply2< ForwardOp, state2, typename deref<iter2>::type >::type state3;
92 typedef typename mpl::next<iter2>::type iter3;
93
94
95 typedef state3 state;
96 typedef iter3 iterator;
97};
98
99template<
100 typename First
101 , typename Last
102 , typename State
103 , typename ForwardOp
104 >
105struct fold_impl< 4,First,Last,State,ForwardOp >
106{
107 typedef First iter0;
108 typedef State state0;
109 typedef typename apply2< ForwardOp, state0, typename deref<iter0>::type >::type state1;
110 typedef typename mpl::next<iter0>::type iter1;
111 typedef typename apply2< ForwardOp, state1, typename deref<iter1>::type >::type state2;
112 typedef typename mpl::next<iter1>::type iter2;
113 typedef typename apply2< ForwardOp, state2, typename deref<iter2>::type >::type state3;
114 typedef typename mpl::next<iter2>::type iter3;
115 typedef typename apply2< ForwardOp, state3, typename deref<iter3>::type >::type state4;
116 typedef typename mpl::next<iter3>::type iter4;
117
118
119 typedef state4 state;
120 typedef iter4 iterator;
121};
122
123template<
124 int N
125 , typename First
126 , typename Last
127 , typename State
128 , typename ForwardOp
129 >
130struct fold_impl
131{
132 typedef fold_impl<
133 4
134 , First
135 , Last
136 , State
137 , ForwardOp
138 > chunk_;
139
140 typedef fold_impl<
141 ( (N - 4) < 0 ? 0 : N - 4 )
142 , typename chunk_::iterator
143 , Last
144 , typename chunk_::state
145 , ForwardOp
146 > res_;
147
148 typedef typename res_::state state;
149 typedef typename res_::iterator iterator;
150};
151
152template<
153 typename First
154 , typename Last
155 , typename State
156 , typename ForwardOp
157 >
158struct fold_impl< -1,First,Last,State,ForwardOp >
159 : fold_impl<
160 -1
161 , typename mpl::next<First>::type
162 , Last
163 , typename apply2<ForwardOp,State, typename deref<First>::type>::type
164 , ForwardOp
165 >
166{
167};
168
169template<
170 typename Last
171 , typename State
172 , typename ForwardOp
173 >
174struct fold_impl< -1,Last,Last,State,ForwardOp >
175{
176 typedef State state;
177 typedef Last iterator;
178};
179
180}}}