1 | |
---|
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 "boost/mpl/aux_/iter_fold_impl.hpp" header |
---|
10 | // -- DO NOT modify by hand! |
---|
11 | |
---|
12 | namespace boost { namespace mpl { namespace aux { |
---|
13 | |
---|
14 | /// forward declaration |
---|
15 | |
---|
16 | template< |
---|
17 | int N |
---|
18 | , typename First |
---|
19 | , typename Last |
---|
20 | , typename State |
---|
21 | , typename ForwardOp |
---|
22 | > |
---|
23 | struct iter_fold_impl; |
---|
24 | |
---|
25 | template< int N > |
---|
26 | struct iter_fold_chunk; |
---|
27 | |
---|
28 | template<> struct iter_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 | |
---|
45 | template<> struct iter_fold_chunk<1> |
---|
46 | { |
---|
47 | template< |
---|
48 | typename First |
---|
49 | , typename Last |
---|
50 | , typename State |
---|
51 | , typename ForwardOp |
---|
52 | > |
---|
53 | struct result_ |
---|
54 | { |
---|
55 | typedef First iter0; |
---|
56 | typedef State state0; |
---|
57 | typedef typename apply2< ForwardOp,state0,iter0 >::type state1; |
---|
58 | typedef typename mpl::next<iter0>::type iter1; |
---|
59 | |
---|
60 | |
---|
61 | typedef state1 state; |
---|
62 | typedef iter1 iterator; |
---|
63 | }; |
---|
64 | }; |
---|
65 | |
---|
66 | template<> struct iter_fold_chunk<2> |
---|
67 | { |
---|
68 | template< |
---|
69 | typename First |
---|
70 | , typename Last |
---|
71 | , typename State |
---|
72 | , typename ForwardOp |
---|
73 | > |
---|
74 | struct result_ |
---|
75 | { |
---|
76 | typedef First iter0; |
---|
77 | typedef State state0; |
---|
78 | typedef typename apply2< ForwardOp,state0,iter0 >::type state1; |
---|
79 | typedef typename mpl::next<iter0>::type iter1; |
---|
80 | typedef typename apply2< ForwardOp,state1,iter1 >::type state2; |
---|
81 | typedef typename mpl::next<iter1>::type iter2; |
---|
82 | |
---|
83 | |
---|
84 | typedef state2 state; |
---|
85 | typedef iter2 iterator; |
---|
86 | }; |
---|
87 | }; |
---|
88 | |
---|
89 | template<> struct iter_fold_chunk<3> |
---|
90 | { |
---|
91 | template< |
---|
92 | typename First |
---|
93 | , typename Last |
---|
94 | , typename State |
---|
95 | , typename ForwardOp |
---|
96 | > |
---|
97 | struct result_ |
---|
98 | { |
---|
99 | typedef First iter0; |
---|
100 | typedef State state0; |
---|
101 | typedef typename apply2< ForwardOp,state0,iter0 >::type state1; |
---|
102 | typedef typename mpl::next<iter0>::type iter1; |
---|
103 | typedef typename apply2< ForwardOp,state1,iter1 >::type state2; |
---|
104 | typedef typename mpl::next<iter1>::type iter2; |
---|
105 | typedef typename apply2< ForwardOp,state2,iter2 >::type state3; |
---|
106 | typedef typename mpl::next<iter2>::type iter3; |
---|
107 | |
---|
108 | |
---|
109 | typedef state3 state; |
---|
110 | typedef iter3 iterator; |
---|
111 | }; |
---|
112 | }; |
---|
113 | |
---|
114 | template<> struct iter_fold_chunk<4> |
---|
115 | { |
---|
116 | template< |
---|
117 | typename First |
---|
118 | , typename Last |
---|
119 | , typename State |
---|
120 | , typename ForwardOp |
---|
121 | > |
---|
122 | struct result_ |
---|
123 | { |
---|
124 | typedef First iter0; |
---|
125 | typedef State state0; |
---|
126 | typedef typename apply2< ForwardOp,state0,iter0 >::type state1; |
---|
127 | typedef typename mpl::next<iter0>::type iter1; |
---|
128 | typedef typename apply2< ForwardOp,state1,iter1 >::type state2; |
---|
129 | typedef typename mpl::next<iter1>::type iter2; |
---|
130 | typedef typename apply2< ForwardOp,state2,iter2 >::type state3; |
---|
131 | typedef typename mpl::next<iter2>::type iter3; |
---|
132 | typedef typename apply2< ForwardOp,state3,iter3 >::type state4; |
---|
133 | typedef typename mpl::next<iter3>::type iter4; |
---|
134 | |
---|
135 | |
---|
136 | typedef state4 state; |
---|
137 | typedef iter4 iterator; |
---|
138 | }; |
---|
139 | }; |
---|
140 | |
---|
141 | template< int N > |
---|
142 | struct iter_fold_chunk |
---|
143 | { |
---|
144 | template< |
---|
145 | typename First |
---|
146 | , typename Last |
---|
147 | , typename State |
---|
148 | , typename ForwardOp |
---|
149 | > |
---|
150 | struct result_ |
---|
151 | { |
---|
152 | typedef iter_fold_impl< |
---|
153 | 4 |
---|
154 | , First |
---|
155 | , Last |
---|
156 | , State |
---|
157 | , ForwardOp |
---|
158 | > chunk_; |
---|
159 | |
---|
160 | typedef iter_fold_impl< |
---|
161 | ( (N - 4) < 0 ? 0 : N - 4 ) |
---|
162 | , typename chunk_::iterator |
---|
163 | , Last |
---|
164 | , typename chunk_::state |
---|
165 | , ForwardOp |
---|
166 | > res_; |
---|
167 | |
---|
168 | typedef typename res_::state state; |
---|
169 | typedef typename res_::iterator iterator; |
---|
170 | }; |
---|
171 | }; |
---|
172 | |
---|
173 | template< |
---|
174 | typename First |
---|
175 | , typename Last |
---|
176 | , typename State |
---|
177 | , typename ForwardOp |
---|
178 | > |
---|
179 | struct iter_fold_step; |
---|
180 | |
---|
181 | template< |
---|
182 | typename Last |
---|
183 | , typename State |
---|
184 | > |
---|
185 | struct iter_fold_null_step |
---|
186 | { |
---|
187 | typedef Last iterator; |
---|
188 | typedef State state; |
---|
189 | }; |
---|
190 | |
---|
191 | template<> |
---|
192 | struct iter_fold_chunk< -1 > |
---|
193 | { |
---|
194 | template< |
---|
195 | typename First |
---|
196 | , typename Last |
---|
197 | , typename State |
---|
198 | , typename ForwardOp |
---|
199 | > |
---|
200 | struct result_ |
---|
201 | { |
---|
202 | typedef typename if_< |
---|
203 | typename is_same< First,Last >::type |
---|
204 | , iter_fold_null_step< Last,State > |
---|
205 | , iter_fold_step< First,Last,State,ForwardOp > |
---|
206 | >::type res_; |
---|
207 | |
---|
208 | typedef typename res_::state state; |
---|
209 | typedef typename res_::iterator iterator; |
---|
210 | }; |
---|
211 | }; |
---|
212 | |
---|
213 | template< |
---|
214 | typename First |
---|
215 | , typename Last |
---|
216 | , typename State |
---|
217 | , typename ForwardOp |
---|
218 | > |
---|
219 | struct iter_fold_step |
---|
220 | { |
---|
221 | typedef iter_fold_chunk< -1 >::template result_< |
---|
222 | typename mpl::next<First>::type |
---|
223 | , Last |
---|
224 | , typename apply2< ForwardOp,State,First >::type |
---|
225 | , ForwardOp |
---|
226 | > chunk_; |
---|
227 | |
---|
228 | typedef typename chunk_::state state; |
---|
229 | typedef typename chunk_::iterator iterator; |
---|
230 | }; |
---|
231 | |
---|
232 | template< |
---|
233 | int N |
---|
234 | , typename First |
---|
235 | , typename Last |
---|
236 | , typename State |
---|
237 | , typename ForwardOp |
---|
238 | > |
---|
239 | struct iter_fold_impl |
---|
240 | : iter_fold_chunk<N> |
---|
241 | ::template result_< First,Last,State,ForwardOp > |
---|
242 | { |
---|
243 | }; |
---|
244 | |
---|
245 | }}} |
---|