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_/reverse_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 | long N |
18 | , typename First |
19 | , typename Last |
20 | , typename State |
21 | , typename BackwardOp |
22 | , typename ForwardOp |
23 | > |
24 | struct reverse_fold_impl; |
25 | |
26 | template< |
27 | typename First |
28 | , typename Last |
29 | , typename State |
30 | , typename BackwardOp |
31 | , typename ForwardOp |
32 | > |
33 | struct reverse_fold_impl< 0,First,Last,State,BackwardOp,ForwardOp > |
34 | { |
35 | typedef First iter0; |
36 | typedef State fwd_state0; |
37 | typedef fwd_state0 bkwd_state0; |
38 | typedef bkwd_state0 state; |
39 | typedef iter0 iterator; |
40 | }; |
41 | |
42 | template< |
43 | typename First |
44 | , typename Last |
45 | , typename State |
46 | , typename BackwardOp |
47 | , typename ForwardOp |
48 | > |
49 | struct reverse_fold_impl< 1,First,Last,State,BackwardOp,ForwardOp > |
50 | { |
51 | typedef First iter0; |
52 | typedef State fwd_state0; |
53 | typedef typename apply2< ForwardOp, fwd_state0, typename deref<iter0>::type >::type fwd_state1; |
54 | typedef typename mpl::next<iter0>::type iter1; |
55 | |
56 | |
57 | typedef fwd_state1 bkwd_state1; |
58 | typedef typename apply2< BackwardOp, bkwd_state1, typename deref<iter0>::type >::type bkwd_state0; |
59 | typedef bkwd_state0 state; |
60 | typedef iter1 iterator; |
61 | }; |
62 | |
63 | template< |
64 | typename First |
65 | , typename Last |
66 | , typename State |
67 | , typename BackwardOp |
68 | , typename ForwardOp |
69 | > |
70 | struct reverse_fold_impl< 2,First,Last,State,BackwardOp,ForwardOp > |
71 | { |
72 | typedef First iter0; |
73 | typedef State fwd_state0; |
74 | typedef typename apply2< ForwardOp, fwd_state0, typename deref<iter0>::type >::type fwd_state1; |
75 | typedef typename mpl::next<iter0>::type iter1; |
76 | typedef typename apply2< ForwardOp, fwd_state1, typename deref<iter1>::type >::type fwd_state2; |
77 | typedef typename mpl::next<iter1>::type iter2; |
78 | |
79 | |
80 | typedef fwd_state2 bkwd_state2; |
81 | typedef typename apply2< BackwardOp, bkwd_state2, typename deref<iter1>::type >::type bkwd_state1; |
82 | typedef typename apply2< BackwardOp, bkwd_state1, typename deref<iter0>::type >::type bkwd_state0; |
83 | |
84 | |
85 | typedef bkwd_state0 state; |
86 | typedef iter2 iterator; |
87 | }; |
88 | |
89 | template< |
90 | typename First |
91 | , typename Last |
92 | , typename State |
93 | , typename BackwardOp |
94 | , typename ForwardOp |
95 | > |
96 | struct reverse_fold_impl< 3,First,Last,State,BackwardOp,ForwardOp > |
97 | { |
98 | typedef First iter0; |
99 | typedef State fwd_state0; |
100 | typedef typename apply2< ForwardOp, fwd_state0, typename deref<iter0>::type >::type fwd_state1; |
101 | typedef typename mpl::next<iter0>::type iter1; |
102 | typedef typename apply2< ForwardOp, fwd_state1, typename deref<iter1>::type >::type fwd_state2; |
103 | typedef typename mpl::next<iter1>::type iter2; |
104 | typedef typename apply2< ForwardOp, fwd_state2, typename deref<iter2>::type >::type fwd_state3; |
105 | typedef typename mpl::next<iter2>::type iter3; |
106 | |
107 | |
108 | typedef fwd_state3 bkwd_state3; |
109 | typedef typename apply2< BackwardOp, bkwd_state3, typename deref<iter2>::type >::type bkwd_state2; |
110 | typedef typename apply2< BackwardOp, bkwd_state2, typename deref<iter1>::type >::type bkwd_state1; |
111 | typedef typename apply2< BackwardOp, bkwd_state1, typename deref<iter0>::type >::type bkwd_state0; |
112 | |
113 | |
114 | typedef bkwd_state0 state; |
115 | typedef iter3 iterator; |
116 | }; |
117 | |
118 | template< |
119 | typename First |
120 | , typename Last |
121 | , typename State |
122 | , typename BackwardOp |
123 | , typename ForwardOp |
124 | > |
125 | struct reverse_fold_impl< 4,First,Last,State,BackwardOp,ForwardOp > |
126 | { |
127 | typedef First iter0; |
128 | typedef State fwd_state0; |
129 | typedef typename apply2< ForwardOp, fwd_state0, typename deref<iter0>::type >::type fwd_state1; |
130 | typedef typename mpl::next<iter0>::type iter1; |
131 | typedef typename apply2< ForwardOp, fwd_state1, typename deref<iter1>::type >::type fwd_state2; |
132 | typedef typename mpl::next<iter1>::type iter2; |
133 | typedef typename apply2< ForwardOp, fwd_state2, typename deref<iter2>::type >::type fwd_state3; |
134 | typedef typename mpl::next<iter2>::type iter3; |
135 | typedef typename apply2< ForwardOp, fwd_state3, typename deref<iter3>::type >::type fwd_state4; |
136 | typedef typename mpl::next<iter3>::type iter4; |
137 | |
138 | |
139 | typedef fwd_state4 bkwd_state4; |
140 | typedef typename apply2< BackwardOp, bkwd_state4, typename deref<iter3>::type >::type bkwd_state3; |
141 | typedef typename apply2< BackwardOp, bkwd_state3, typename deref<iter2>::type >::type bkwd_state2; |
142 | typedef typename apply2< BackwardOp, bkwd_state2, typename deref<iter1>::type >::type bkwd_state1; |
143 | typedef typename apply2< BackwardOp, bkwd_state1, typename deref<iter0>::type >::type bkwd_state0; |
144 | |
145 | |
146 | typedef bkwd_state0 state; |
147 | typedef iter4 iterator; |
148 | }; |
149 | |
150 | template< |
151 | long N |
152 | , typename First |
153 | , typename Last |
154 | , typename State |
155 | , typename BackwardOp |
156 | , typename ForwardOp |
157 | > |
158 | struct reverse_fold_impl |
159 | { |
160 | typedef First iter0; |
161 | typedef State fwd_state0; |
162 | typedef typename apply2< ForwardOp, fwd_state0, typename deref<iter0>::type >::type fwd_state1; |
163 | typedef typename mpl::next<iter0>::type iter1; |
164 | typedef typename apply2< ForwardOp, fwd_state1, typename deref<iter1>::type >::type fwd_state2; |
165 | typedef typename mpl::next<iter1>::type iter2; |
166 | typedef typename apply2< ForwardOp, fwd_state2, typename deref<iter2>::type >::type fwd_state3; |
167 | typedef typename mpl::next<iter2>::type iter3; |
168 | typedef typename apply2< ForwardOp, fwd_state3, typename deref<iter3>::type >::type fwd_state4; |
169 | typedef typename mpl::next<iter3>::type iter4; |
170 | |
171 | |
172 | typedef reverse_fold_impl< |
173 | ( (N - 4) < 0 ? 0 : N - 4 ) |
174 | , iter4 |
175 | , Last |
176 | , fwd_state4 |
177 | , BackwardOp |
178 | , ForwardOp |
179 | > nested_chunk; |
180 | |
181 | typedef typename nested_chunk::state bkwd_state4; |
182 | typedef typename apply2< BackwardOp, bkwd_state4, typename deref<iter3>::type >::type bkwd_state3; |
183 | typedef typename apply2< BackwardOp, bkwd_state3, typename deref<iter2>::type >::type bkwd_state2; |
184 | typedef typename apply2< BackwardOp, bkwd_state2, typename deref<iter1>::type >::type bkwd_state1; |
185 | typedef typename apply2< BackwardOp, bkwd_state1, typename deref<iter0>::type >::type bkwd_state0; |
186 | |
187 | |
188 | typedef bkwd_state0 state; |
189 | typedef typename nested_chunk::iterator iterator; |
190 | }; |
191 | |
192 | template< |
193 | typename First |
194 | , typename Last |
195 | , typename State |
196 | , typename BackwardOp |
197 | , typename ForwardOp |
198 | > |
199 | struct reverse_fold_impl< -1,First,Last,State,BackwardOp,ForwardOp > |
200 | { |
201 | typedef reverse_fold_impl< |
202 | -1 |
203 | , typename mpl::next<First>::type |
204 | , Last |
205 | , typename apply2<ForwardOp,State, typename deref<First>::type>::type |
206 | , BackwardOp |
207 | , ForwardOp |
208 | > nested_step; |
209 | |
210 | typedef typename apply2< |
211 | BackwardOp |
212 | , typename nested_step::state |
213 | , typename deref<First>::type |
214 | >::type state; |
215 | |
216 | typedef typename nested_step::iterator iterator; |
217 | }; |
218 | |
219 | template< |
220 | typename Last |
221 | , typename State |
222 | , typename BackwardOp |
223 | , typename ForwardOp |
224 | > |
225 | struct reverse_fold_impl< -1,Last,Last,State,BackwardOp,ForwardOp > |
226 | { |
227 | typedef State state; |
228 | typedef Last iterator; |
229 | }; |
230 | |
231 | }}} |
232 | |