blob: c8ca0c70182e7e81c1b1a3e7ac238b37bfbeff03 [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< int N >
26struct fold_chunk;
27
28template<> struct fold_chunk<0>
29{
30 template<
31 typename First
32 , typename Last
33 , typename State
34 , typename ForwardOp
35 >
36 struct result_
37 {
38 typedef First iter0;
39 typedef State state0;
40 typedef state0 state;
41 typedef iter0 iterator;
42 };
43
44 /// ETI workaround
45 template<> struct result_< int,int,int,int >
46 {
47 typedef int state;
48 typedef int iterator;
49 };
50
51};
52
53template<> struct fold_chunk<1>
54{
55 template<
56 typename First
57 , typename Last
58 , typename State
59 , typename ForwardOp
60 >
61 struct result_
62 {
63 typedef First iter0;
64 typedef State state0;
65 typedef typename apply2< ForwardOp, state0, typename deref<iter0>::type >::type state1;
66 typedef typename mpl::next<iter0>::type iter1;
67
68
69 typedef state1 state;
70 typedef iter1 iterator;
71 };
72
73 /// ETI workaround
74 template<> struct result_< int,int,int,int >
75 {
76 typedef int state;
77 typedef int iterator;
78 };
79
80};
81
82template<> struct fold_chunk<2>
83{
84 template<
85 typename First
86 , typename Last
87 , typename State
88 , typename ForwardOp
89 >
90 struct result_
91 {
92 typedef First iter0;
93 typedef State state0;
94 typedef typename apply2< ForwardOp, state0, typename deref<iter0>::type >::type state1;
95 typedef typename mpl::next<iter0>::type iter1;
96 typedef typename apply2< ForwardOp, state1, typename deref<iter1>::type >::type state2;
97 typedef typename mpl::next<iter1>::type iter2;
98
99
100 typedef state2 state;
101 typedef iter2 iterator;
102 };
103
104 /// ETI workaround
105 template<> struct result_< int,int,int,int >
106 {
107 typedef int state;
108 typedef int iterator;
109 };
110
111};
112
113template<> struct fold_chunk<3>
114{
115 template<
116 typename First
117 , typename Last
118 , typename State
119 , typename ForwardOp
120 >
121 struct result_
122 {
123 typedef First iter0;
124 typedef State state0;
125 typedef typename apply2< ForwardOp, state0, typename deref<iter0>::type >::type state1;
126 typedef typename mpl::next<iter0>::type iter1;
127 typedef typename apply2< ForwardOp, state1, typename deref<iter1>::type >::type state2;
128 typedef typename mpl::next<iter1>::type iter2;
129 typedef typename apply2< ForwardOp, state2, typename deref<iter2>::type >::type state3;
130 typedef typename mpl::next<iter2>::type iter3;
131
132
133 typedef state3 state;
134 typedef iter3 iterator;
135 };
136
137 /// ETI workaround
138 template<> struct result_< int,int,int,int >
139 {
140 typedef int state;
141 typedef int iterator;
142 };
143
144};
145
146template<> struct fold_chunk<4>
147{
148 template<
149 typename First
150 , typename Last
151 , typename State
152 , typename ForwardOp
153 >
154 struct result_
155 {
156 typedef First iter0;
157 typedef State state0;
158 typedef typename apply2< ForwardOp, state0, typename deref<iter0>::type >::type state1;
159 typedef typename mpl::next<iter0>::type iter1;
160 typedef typename apply2< ForwardOp, state1, typename deref<iter1>::type >::type state2;
161 typedef typename mpl::next<iter1>::type iter2;
162 typedef typename apply2< ForwardOp, state2, typename deref<iter2>::type >::type state3;
163 typedef typename mpl::next<iter2>::type iter3;
164 typedef typename apply2< ForwardOp, state3, typename deref<iter3>::type >::type state4;
165 typedef typename mpl::next<iter3>::type iter4;
166
167
168 typedef state4 state;
169 typedef iter4 iterator;
170 };
171
172 /// ETI workaround
173 template<> struct result_< int,int,int,int >
174 {
175 typedef int state;
176 typedef int iterator;
177 };
178
179};
180
181template< int N >
182struct fold_chunk
183{
184 template<
185 typename First
186 , typename Last
187 , typename State
188 , typename ForwardOp
189 >
190 struct result_
191 {
192 typedef fold_impl<
193 4
194 , First
195 , Last
196 , State
197 , ForwardOp
198 > chunk_;
199
200 typedef fold_impl<
201 ( (N - 4) < 0 ? 0 : N - 4 )
202 , typename chunk_::iterator
203 , Last
204 , typename chunk_::state
205 , ForwardOp
206 > res_;
207
208 typedef typename res_::state state;
209 typedef typename res_::iterator iterator;
210 };
211};
212
213template<
214 typename First
215 , typename Last
216 , typename State
217 , typename ForwardOp
218 >
219struct fold_step;
220
221template<
222 typename Last
223 , typename State
224 >
225struct fold_null_step
226{
227 typedef Last iterator;
228 typedef State state;
229};
230
231template<>
232struct fold_chunk< -1 >
233{
234 template<
235 typename First
236 , typename Last
237 , typename State
238 , typename ForwardOp
239 >
240 struct result_
241 {
242 typedef typename if_<
243 typename is_same< First,Last >::type
244 , fold_null_step< Last,State >
245 , fold_step< First,Last,State,ForwardOp >
246 >::type res_;
247
248 typedef typename res_::state state;
249 typedef typename res_::iterator iterator;
250 };
251
252 /// ETI workaround
253 template<> struct result_< int,int,int,int >
254 {
255 typedef int state;
256 typedef int iterator;
257 };
258
259};
260
261template<
262 typename First
263 , typename Last
264 , typename State
265 , typename ForwardOp
266 >
267struct fold_step
268{
269 typedef fold_chunk< -1 >::template result_<
270 typename mpl::next<First>::type
271 , Last
272 , typename apply2<ForwardOp,State, typename deref<First>::type>::type
273 , ForwardOp
274 > chunk_;
275
276 typedef typename chunk_::state state;
277 typedef typename chunk_::iterator iterator;
278};
279
280template<
281 int N
282 , typename First
283 , typename Last
284 , typename State
285 , typename ForwardOp
286 >
287struct fold_impl
288 : fold_chunk<N>
289 ::template result_< First,Last,State,ForwardOp >
290{
291};
292
293}}}