PageRenderTime 34ms CodeModel.GetById 2ms app.highlight 29ms RepoModel.GetById 1ms app.codeStats 0ms

/Src/Dependencies/Boost/boost/mpl/aux_/preprocessed/msvc60/reverse_fold_impl.hpp

http://hadesmem.googlecode.com/
C++ Header | 343 lines | 276 code | 52 blank | 15 comment | 0 complexity | 2bf821f726ebd76663c0fadd76f556b9 MD5 | raw file
  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
 12namespace boost { namespace mpl { namespace aux {
 13
 14/// forward declaration
 15
 16template<
 17      long N
 18    , typename First
 19    , typename Last
 20    , typename State
 21    , typename BackwardOp
 22    , typename ForwardOp
 23    >
 24struct reverse_fold_impl;
 25
 26template< long N >
 27struct reverse_fold_chunk;
 28
 29template<> struct reverse_fold_chunk<0>
 30{
 31    template<
 32          typename First
 33        , typename Last
 34        , typename State
 35        , typename BackwardOp
 36        , typename ForwardOp
 37        >
 38    struct result_
 39    {
 40        typedef First iter0;
 41        typedef State fwd_state0;
 42        typedef fwd_state0 bkwd_state0;
 43        typedef bkwd_state0 state;
 44        typedef iter0 iterator;
 45    };
 46
 47    /// ETI workaround
 48    template<> struct result_< int,int,int,int,int >
 49    {
 50        typedef int state;
 51        typedef int iterator;
 52    };
 53
 54};
 55
 56template<> struct reverse_fold_chunk<1>
 57{
 58    template<
 59          typename First
 60        , typename Last
 61        , typename State
 62        , typename BackwardOp
 63        , typename ForwardOp
 64        >
 65    struct result_
 66    {
 67        typedef First iter0;
 68        typedef State fwd_state0;
 69        typedef typename apply2< ForwardOp, fwd_state0, typename deref<iter0>::type >::type fwd_state1;
 70        typedef typename mpl::next<iter0>::type iter1;
 71        
 72
 73        typedef fwd_state1 bkwd_state1;
 74        typedef typename apply2< BackwardOp, bkwd_state1, typename deref<iter0>::type >::type bkwd_state0;
 75        typedef bkwd_state0 state;
 76        typedef iter1 iterator;
 77    };
 78
 79    /// ETI workaround
 80    template<> struct result_< int,int,int,int,int >
 81    {
 82        typedef int state;
 83        typedef int iterator;
 84    };
 85
 86};
 87
 88template<> struct reverse_fold_chunk<2>
 89{
 90    template<
 91          typename First
 92        , typename Last
 93        , typename State
 94        , typename BackwardOp
 95        , typename ForwardOp
 96        >
 97    struct result_
 98    {
 99        typedef First iter0;
100        typedef State fwd_state0;
101        typedef typename apply2< ForwardOp, fwd_state0, typename deref<iter0>::type >::type fwd_state1;
102        typedef typename mpl::next<iter0>::type iter1;
103        typedef typename apply2< ForwardOp, fwd_state1, typename deref<iter1>::type >::type fwd_state2;
104        typedef typename mpl::next<iter1>::type iter2;
105        
106
107        typedef fwd_state2 bkwd_state2;
108        typedef typename apply2< BackwardOp, bkwd_state2, typename deref<iter1>::type >::type bkwd_state1;
109        typedef typename apply2< BackwardOp, bkwd_state1, typename deref<iter0>::type >::type bkwd_state0;
110        
111
112        typedef bkwd_state0 state;
113        typedef iter2 iterator;
114    };
115
116    /// ETI workaround
117    template<> struct result_< int,int,int,int,int >
118    {
119        typedef int state;
120        typedef int iterator;
121    };
122
123};
124
125template<> struct reverse_fold_chunk<3>
126{
127    template<
128          typename First
129        , typename Last
130        , typename State
131        , typename BackwardOp
132        , typename ForwardOp
133        >
134    struct result_
135    {
136        typedef First iter0;
137        typedef State fwd_state0;
138        typedef typename apply2< ForwardOp, fwd_state0, typename deref<iter0>::type >::type fwd_state1;
139        typedef typename mpl::next<iter0>::type iter1;
140        typedef typename apply2< ForwardOp, fwd_state1, typename deref<iter1>::type >::type fwd_state2;
141        typedef typename mpl::next<iter1>::type iter2;
142        typedef typename apply2< ForwardOp, fwd_state2, typename deref<iter2>::type >::type fwd_state3;
143        typedef typename mpl::next<iter2>::type iter3;
144        
145
146        typedef fwd_state3 bkwd_state3;
147        typedef typename apply2< BackwardOp, bkwd_state3, typename deref<iter2>::type >::type bkwd_state2;
148        typedef typename apply2< BackwardOp, bkwd_state2, typename deref<iter1>::type >::type bkwd_state1;
149        typedef typename apply2< BackwardOp, bkwd_state1, typename deref<iter0>::type >::type bkwd_state0;
150        
151
152        typedef bkwd_state0 state;
153        typedef iter3 iterator;
154    };
155
156    /// ETI workaround
157    template<> struct result_< int,int,int,int,int >
158    {
159        typedef int state;
160        typedef int iterator;
161    };
162
163};
164
165template<> struct reverse_fold_chunk<4>
166{
167    template<
168          typename First
169        , typename Last
170        , typename State
171        , typename BackwardOp
172        , typename ForwardOp
173        >
174    struct result_
175    {
176        typedef First iter0;
177        typedef State fwd_state0;
178        typedef typename apply2< ForwardOp, fwd_state0, typename deref<iter0>::type >::type fwd_state1;
179        typedef typename mpl::next<iter0>::type iter1;
180        typedef typename apply2< ForwardOp, fwd_state1, typename deref<iter1>::type >::type fwd_state2;
181        typedef typename mpl::next<iter1>::type iter2;
182        typedef typename apply2< ForwardOp, fwd_state2, typename deref<iter2>::type >::type fwd_state3;
183        typedef typename mpl::next<iter2>::type iter3;
184        typedef typename apply2< ForwardOp, fwd_state3, typename deref<iter3>::type >::type fwd_state4;
185        typedef typename mpl::next<iter3>::type iter4;
186        
187
188        typedef fwd_state4 bkwd_state4;
189        typedef typename apply2< BackwardOp, bkwd_state4, typename deref<iter3>::type >::type bkwd_state3;
190        typedef typename apply2< BackwardOp, bkwd_state3, typename deref<iter2>::type >::type bkwd_state2;
191        typedef typename apply2< BackwardOp, bkwd_state2, typename deref<iter1>::type >::type bkwd_state1;
192        typedef typename apply2< BackwardOp, bkwd_state1, typename deref<iter0>::type >::type bkwd_state0;
193        
194
195        typedef bkwd_state0 state;
196        typedef iter4 iterator;
197    };
198
199    /// ETI workaround
200    template<> struct result_< int,int,int,int,int >
201    {
202        typedef int state;
203        typedef int iterator;
204    };
205
206};
207
208template< long N >
209struct reverse_fold_chunk
210{
211    template<
212          typename First
213        , typename Last
214        , typename State
215        , typename BackwardOp
216        , typename ForwardOp
217        >
218    struct result_
219    {
220        typedef First iter0;
221        typedef State fwd_state0;
222        typedef typename apply2< ForwardOp, fwd_state0, typename deref<iter0>::type >::type fwd_state1;
223        typedef typename mpl::next<iter0>::type iter1;
224        typedef typename apply2< ForwardOp, fwd_state1, typename deref<iter1>::type >::type fwd_state2;
225        typedef typename mpl::next<iter1>::type iter2;
226        typedef typename apply2< ForwardOp, fwd_state2, typename deref<iter2>::type >::type fwd_state3;
227        typedef typename mpl::next<iter2>::type iter3;
228        typedef typename apply2< ForwardOp, fwd_state3, typename deref<iter3>::type >::type fwd_state4;
229        typedef typename mpl::next<iter3>::type iter4;
230        
231
232        typedef reverse_fold_impl<
233              ( (N - 4) < 0 ? 0 : N - 4 )
234            , iter4
235            , Last
236            , fwd_state4
237            , BackwardOp
238            , ForwardOp
239            > nested_chunk;
240
241        typedef typename nested_chunk::state bkwd_state4;
242        typedef typename apply2< BackwardOp, bkwd_state4, typename deref<iter3>::type >::type bkwd_state3;
243        typedef typename apply2< BackwardOp, bkwd_state3, typename deref<iter2>::type >::type bkwd_state2;
244        typedef typename apply2< BackwardOp, bkwd_state2, typename deref<iter1>::type >::type bkwd_state1;
245        typedef typename apply2< BackwardOp, bkwd_state1, typename deref<iter0>::type >::type bkwd_state0;
246        
247
248        typedef bkwd_state0 state;
249        typedef typename nested_chunk::iterator iterator;
250    };
251};
252
253template<
254      typename First
255    , typename Last
256    , typename State
257    , typename BackwardOp
258    , typename ForwardOp
259    >
260struct reverse_fold_step;
261
262template<
263      typename Last
264    , typename State
265    >
266struct reverse_fold_null_step
267{
268    typedef Last iterator;
269    typedef State state;
270};
271
272template<>
273struct reverse_fold_chunk< -1 >
274{
275    template<
276          typename First
277        , typename Last
278        , typename State
279        , typename BackwardOp
280        , typename ForwardOp
281        >
282    struct result_
283    {
284        typedef typename if_<
285              typename is_same< First,Last >::type
286            , reverse_fold_null_step< Last,State >
287            , reverse_fold_step< First,Last,State,BackwardOp,ForwardOp >
288            >::type res_;
289
290        typedef typename res_::state state;
291        typedef typename res_::iterator iterator;
292    };
293
294    /// ETI workaround
295    template<> struct result_< int,int,int,int,int >
296    {
297        typedef int state;
298        typedef int iterator;
299    };
300
301};
302
303template<
304      typename First
305    , typename Last
306    , typename State
307    , typename BackwardOp
308    , typename ForwardOp
309    >
310struct reverse_fold_step
311{
312    typedef reverse_fold_chunk< -1 >::template result_<
313          typename mpl::next<First>::type
314        , Last
315        , typename apply2<ForwardOp,State, typename deref<First>::type>::type
316        , BackwardOp
317        , ForwardOp
318        > nested_step;
319
320    typedef typename apply2<
321          BackwardOp
322        , typename nested_step::state
323        , typename deref<First>::type
324        >::type state;
325
326    typedef typename nested_step::iterator iterator;
327};
328
329template<
330      long N
331    , typename First
332    , typename Last
333    , typename State
334    , typename BackwardOp
335    , typename ForwardOp
336    >
337struct reverse_fold_impl
338    : reverse_fold_chunk<N>
339        ::template result_< First,Last,State,BackwardOp,ForwardOp >
340{
341};
342
343}}}