PageRenderTime 136ms CodeModel.GetById 110ms app.highlight 22ms RepoModel.GetById 1ms app.codeStats 0ms

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

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