Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:50:29

0001     ///////////////////////////////////////////////////////////////////////////////
0002     /// \file fold_impl.hpp
0003     /// Contains definition of fold_impl<> and reverse_fold_impl<> templates.
0004     //
0005     //  Copyright 2008 Eric Niebler. Distributed under the Boost
0006     //  Software License, Version 1.0. (See accompanying file
0007     //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0008     template<typename State0, typename Fun, typename Expr, typename State, typename Data>
0009     struct fold_impl<State0, Fun, Expr, State, Data, 1>
0010       : transform_impl<Expr, State, Data>
0011     {
0012         typedef typename when<_, State0>::template impl<Expr, State, Data>::result_type state0;
0013         typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 0>::type , state0 , Data >::result_type state1;
0014         typedef state1 result_type;
0015         result_type operator ()(
0016             typename fold_impl::expr_param e
0017           , typename fold_impl::state_param s
0018           , typename fold_impl::data_param d
0019         ) const
0020         {
0021             state0 s0 =
0022                 typename when<_, State0>::template impl<Expr, State, Data>()(e, s, d);
0023             state1 s1 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 0>::type , state0 , Data >()( proto::child_c< 0>(e) , s0 , d );
0024             return s1;
0025         }
0026     };
0027     template<typename State0, typename Fun, typename Expr, typename State, typename Data>
0028     struct reverse_fold_impl<State0, Fun, Expr, State, Data, 1>
0029       : transform_impl<Expr, State, Data>
0030     {
0031         typedef typename when<_, State0>::template impl<Expr, State, Data>::result_type state1;
0032         typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 0 >::type , state1 , Data >::result_type state0;
0033         typedef state0 result_type;
0034         result_type operator ()(
0035             typename reverse_fold_impl::expr_param e
0036           , typename reverse_fold_impl::state_param s
0037           , typename reverse_fold_impl::data_param d
0038         ) const
0039         {
0040             state1 s1 =
0041                 typename when<_, State0>::template impl<Expr, State, Data>()(e, s, d);
0042             state0 s0 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 0 >::type , state1 , Data >()( proto::child_c<0>(e) , s1 , d );
0043             return s0;
0044         }
0045     };
0046     template<typename State0, typename Fun, typename Expr, typename State, typename Data>
0047     struct fold_impl<State0, Fun, Expr, State, Data, 2>
0048       : transform_impl<Expr, State, Data>
0049     {
0050         typedef typename when<_, State0>::template impl<Expr, State, Data>::result_type state0;
0051         typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 0>::type , state0 , Data >::result_type state1; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 1>::type , state1 , Data >::result_type state2;
0052         typedef state2 result_type;
0053         result_type operator ()(
0054             typename fold_impl::expr_param e
0055           , typename fold_impl::state_param s
0056           , typename fold_impl::data_param d
0057         ) const
0058         {
0059             state0 s0 =
0060                 typename when<_, State0>::template impl<Expr, State, Data>()(e, s, d);
0061             state1 s1 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 0>::type , state0 , Data >()( proto::child_c< 0>(e) , s0 , d ); state2 s2 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 1>::type , state1 , Data >()( proto::child_c< 1>(e) , s1 , d );
0062             return s2;
0063         }
0064     };
0065     template<typename State0, typename Fun, typename Expr, typename State, typename Data>
0066     struct reverse_fold_impl<State0, Fun, Expr, State, Data, 2>
0067       : transform_impl<Expr, State, Data>
0068     {
0069         typedef typename when<_, State0>::template impl<Expr, State, Data>::result_type state2;
0070         typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 1 >::type , state2 , Data >::result_type state1; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 0 >::type , state1 , Data >::result_type state0;
0071         typedef state0 result_type;
0072         result_type operator ()(
0073             typename reverse_fold_impl::expr_param e
0074           , typename reverse_fold_impl::state_param s
0075           , typename reverse_fold_impl::data_param d
0076         ) const
0077         {
0078             state2 s2 =
0079                 typename when<_, State0>::template impl<Expr, State, Data>()(e, s, d);
0080             state1 s1 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 1 >::type , state2 , Data >()( proto::child_c<1>(e) , s2 , d ); state0 s0 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 0 >::type , state1 , Data >()( proto::child_c<0>(e) , s1 , d );
0081             return s0;
0082         }
0083     };
0084     template<typename State0, typename Fun, typename Expr, typename State, typename Data>
0085     struct fold_impl<State0, Fun, Expr, State, Data, 3>
0086       : transform_impl<Expr, State, Data>
0087     {
0088         typedef typename when<_, State0>::template impl<Expr, State, Data>::result_type state0;
0089         typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 0>::type , state0 , Data >::result_type state1; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 1>::type , state1 , Data >::result_type state2; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 2>::type , state2 , Data >::result_type state3;
0090         typedef state3 result_type;
0091         result_type operator ()(
0092             typename fold_impl::expr_param e
0093           , typename fold_impl::state_param s
0094           , typename fold_impl::data_param d
0095         ) const
0096         {
0097             state0 s0 =
0098                 typename when<_, State0>::template impl<Expr, State, Data>()(e, s, d);
0099             state1 s1 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 0>::type , state0 , Data >()( proto::child_c< 0>(e) , s0 , d ); state2 s2 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 1>::type , state1 , Data >()( proto::child_c< 1>(e) , s1 , d ); state3 s3 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 2>::type , state2 , Data >()( proto::child_c< 2>(e) , s2 , d );
0100             return s3;
0101         }
0102     };
0103     template<typename State0, typename Fun, typename Expr, typename State, typename Data>
0104     struct reverse_fold_impl<State0, Fun, Expr, State, Data, 3>
0105       : transform_impl<Expr, State, Data>
0106     {
0107         typedef typename when<_, State0>::template impl<Expr, State, Data>::result_type state3;
0108         typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 2 >::type , state3 , Data >::result_type state2; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 1 >::type , state2 , Data >::result_type state1; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 0 >::type , state1 , Data >::result_type state0;
0109         typedef state0 result_type;
0110         result_type operator ()(
0111             typename reverse_fold_impl::expr_param e
0112           , typename reverse_fold_impl::state_param s
0113           , typename reverse_fold_impl::data_param d
0114         ) const
0115         {
0116             state3 s3 =
0117                 typename when<_, State0>::template impl<Expr, State, Data>()(e, s, d);
0118             state2 s2 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 2 >::type , state3 , Data >()( proto::child_c<2>(e) , s3 , d ); state1 s1 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 1 >::type , state2 , Data >()( proto::child_c<1>(e) , s2 , d ); state0 s0 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 0 >::type , state1 , Data >()( proto::child_c<0>(e) , s1 , d );
0119             return s0;
0120         }
0121     };
0122     template<typename State0, typename Fun, typename Expr, typename State, typename Data>
0123     struct fold_impl<State0, Fun, Expr, State, Data, 4>
0124       : transform_impl<Expr, State, Data>
0125     {
0126         typedef typename when<_, State0>::template impl<Expr, State, Data>::result_type state0;
0127         typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 0>::type , state0 , Data >::result_type state1; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 1>::type , state1 , Data >::result_type state2; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 2>::type , state2 , Data >::result_type state3; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 3>::type , state3 , Data >::result_type state4;
0128         typedef state4 result_type;
0129         result_type operator ()(
0130             typename fold_impl::expr_param e
0131           , typename fold_impl::state_param s
0132           , typename fold_impl::data_param d
0133         ) const
0134         {
0135             state0 s0 =
0136                 typename when<_, State0>::template impl<Expr, State, Data>()(e, s, d);
0137             state1 s1 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 0>::type , state0 , Data >()( proto::child_c< 0>(e) , s0 , d ); state2 s2 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 1>::type , state1 , Data >()( proto::child_c< 1>(e) , s1 , d ); state3 s3 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 2>::type , state2 , Data >()( proto::child_c< 2>(e) , s2 , d ); state4 s4 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 3>::type , state3 , Data >()( proto::child_c< 3>(e) , s3 , d );
0138             return s4;
0139         }
0140     };
0141     template<typename State0, typename Fun, typename Expr, typename State, typename Data>
0142     struct reverse_fold_impl<State0, Fun, Expr, State, Data, 4>
0143       : transform_impl<Expr, State, Data>
0144     {
0145         typedef typename when<_, State0>::template impl<Expr, State, Data>::result_type state4;
0146         typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 3 >::type , state4 , Data >::result_type state3; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 2 >::type , state3 , Data >::result_type state2; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 1 >::type , state2 , Data >::result_type state1; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 0 >::type , state1 , Data >::result_type state0;
0147         typedef state0 result_type;
0148         result_type operator ()(
0149             typename reverse_fold_impl::expr_param e
0150           , typename reverse_fold_impl::state_param s
0151           , typename reverse_fold_impl::data_param d
0152         ) const
0153         {
0154             state4 s4 =
0155                 typename when<_, State0>::template impl<Expr, State, Data>()(e, s, d);
0156             state3 s3 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 3 >::type , state4 , Data >()( proto::child_c<3>(e) , s4 , d ); state2 s2 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 2 >::type , state3 , Data >()( proto::child_c<2>(e) , s3 , d ); state1 s1 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 1 >::type , state2 , Data >()( proto::child_c<1>(e) , s2 , d ); state0 s0 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 0 >::type , state1 , Data >()( proto::child_c<0>(e) , s1 , d );
0157             return s0;
0158         }
0159     };
0160     template<typename State0, typename Fun, typename Expr, typename State, typename Data>
0161     struct fold_impl<State0, Fun, Expr, State, Data, 5>
0162       : transform_impl<Expr, State, Data>
0163     {
0164         typedef typename when<_, State0>::template impl<Expr, State, Data>::result_type state0;
0165         typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 0>::type , state0 , Data >::result_type state1; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 1>::type , state1 , Data >::result_type state2; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 2>::type , state2 , Data >::result_type state3; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 3>::type , state3 , Data >::result_type state4; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 4>::type , state4 , Data >::result_type state5;
0166         typedef state5 result_type;
0167         result_type operator ()(
0168             typename fold_impl::expr_param e
0169           , typename fold_impl::state_param s
0170           , typename fold_impl::data_param d
0171         ) const
0172         {
0173             state0 s0 =
0174                 typename when<_, State0>::template impl<Expr, State, Data>()(e, s, d);
0175             state1 s1 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 0>::type , state0 , Data >()( proto::child_c< 0>(e) , s0 , d ); state2 s2 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 1>::type , state1 , Data >()( proto::child_c< 1>(e) , s1 , d ); state3 s3 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 2>::type , state2 , Data >()( proto::child_c< 2>(e) , s2 , d ); state4 s4 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 3>::type , state3 , Data >()( proto::child_c< 3>(e) , s3 , d ); state5 s5 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 4>::type , state4 , Data >()( proto::child_c< 4>(e) , s4 , d );
0176             return s5;
0177         }
0178     };
0179     template<typename State0, typename Fun, typename Expr, typename State, typename Data>
0180     struct reverse_fold_impl<State0, Fun, Expr, State, Data, 5>
0181       : transform_impl<Expr, State, Data>
0182     {
0183         typedef typename when<_, State0>::template impl<Expr, State, Data>::result_type state5;
0184         typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 4 >::type , state5 , Data >::result_type state4; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 3 >::type , state4 , Data >::result_type state3; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 2 >::type , state3 , Data >::result_type state2; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 1 >::type , state2 , Data >::result_type state1; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 0 >::type , state1 , Data >::result_type state0;
0185         typedef state0 result_type;
0186         result_type operator ()(
0187             typename reverse_fold_impl::expr_param e
0188           , typename reverse_fold_impl::state_param s
0189           , typename reverse_fold_impl::data_param d
0190         ) const
0191         {
0192             state5 s5 =
0193                 typename when<_, State0>::template impl<Expr, State, Data>()(e, s, d);
0194             state4 s4 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 4 >::type , state5 , Data >()( proto::child_c<4>(e) , s5 , d ); state3 s3 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 3 >::type , state4 , Data >()( proto::child_c<3>(e) , s4 , d ); state2 s2 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 2 >::type , state3 , Data >()( proto::child_c<2>(e) , s3 , d ); state1 s1 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 1 >::type , state2 , Data >()( proto::child_c<1>(e) , s2 , d ); state0 s0 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 0 >::type , state1 , Data >()( proto::child_c<0>(e) , s1 , d );
0195             return s0;
0196         }
0197     };
0198     template<typename State0, typename Fun, typename Expr, typename State, typename Data>
0199     struct fold_impl<State0, Fun, Expr, State, Data, 6>
0200       : transform_impl<Expr, State, Data>
0201     {
0202         typedef typename when<_, State0>::template impl<Expr, State, Data>::result_type state0;
0203         typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 0>::type , state0 , Data >::result_type state1; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 1>::type , state1 , Data >::result_type state2; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 2>::type , state2 , Data >::result_type state3; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 3>::type , state3 , Data >::result_type state4; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 4>::type , state4 , Data >::result_type state5; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 5>::type , state5 , Data >::result_type state6;
0204         typedef state6 result_type;
0205         result_type operator ()(
0206             typename fold_impl::expr_param e
0207           , typename fold_impl::state_param s
0208           , typename fold_impl::data_param d
0209         ) const
0210         {
0211             state0 s0 =
0212                 typename when<_, State0>::template impl<Expr, State, Data>()(e, s, d);
0213             state1 s1 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 0>::type , state0 , Data >()( proto::child_c< 0>(e) , s0 , d ); state2 s2 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 1>::type , state1 , Data >()( proto::child_c< 1>(e) , s1 , d ); state3 s3 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 2>::type , state2 , Data >()( proto::child_c< 2>(e) , s2 , d ); state4 s4 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 3>::type , state3 , Data >()( proto::child_c< 3>(e) , s3 , d ); state5 s5 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 4>::type , state4 , Data >()( proto::child_c< 4>(e) , s4 , d ); state6 s6 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 5>::type , state5 , Data >()( proto::child_c< 5>(e) , s5 , d );
0214             return s6;
0215         }
0216     };
0217     template<typename State0, typename Fun, typename Expr, typename State, typename Data>
0218     struct reverse_fold_impl<State0, Fun, Expr, State, Data, 6>
0219       : transform_impl<Expr, State, Data>
0220     {
0221         typedef typename when<_, State0>::template impl<Expr, State, Data>::result_type state6;
0222         typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 5 >::type , state6 , Data >::result_type state5; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 4 >::type , state5 , Data >::result_type state4; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 3 >::type , state4 , Data >::result_type state3; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 2 >::type , state3 , Data >::result_type state2; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 1 >::type , state2 , Data >::result_type state1; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 0 >::type , state1 , Data >::result_type state0;
0223         typedef state0 result_type;
0224         result_type operator ()(
0225             typename reverse_fold_impl::expr_param e
0226           , typename reverse_fold_impl::state_param s
0227           , typename reverse_fold_impl::data_param d
0228         ) const
0229         {
0230             state6 s6 =
0231                 typename when<_, State0>::template impl<Expr, State, Data>()(e, s, d);
0232             state5 s5 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 5 >::type , state6 , Data >()( proto::child_c<5>(e) , s6 , d ); state4 s4 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 4 >::type , state5 , Data >()( proto::child_c<4>(e) , s5 , d ); state3 s3 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 3 >::type , state4 , Data >()( proto::child_c<3>(e) , s4 , d ); state2 s2 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 2 >::type , state3 , Data >()( proto::child_c<2>(e) , s3 , d ); state1 s1 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 1 >::type , state2 , Data >()( proto::child_c<1>(e) , s2 , d ); state0 s0 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 0 >::type , state1 , Data >()( proto::child_c<0>(e) , s1 , d );
0233             return s0;
0234         }
0235     };
0236     template<typename State0, typename Fun, typename Expr, typename State, typename Data>
0237     struct fold_impl<State0, Fun, Expr, State, Data, 7>
0238       : transform_impl<Expr, State, Data>
0239     {
0240         typedef typename when<_, State0>::template impl<Expr, State, Data>::result_type state0;
0241         typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 0>::type , state0 , Data >::result_type state1; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 1>::type , state1 , Data >::result_type state2; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 2>::type , state2 , Data >::result_type state3; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 3>::type , state3 , Data >::result_type state4; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 4>::type , state4 , Data >::result_type state5; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 5>::type , state5 , Data >::result_type state6; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 6>::type , state6 , Data >::result_type state7;
0242         typedef state7 result_type;
0243         result_type operator ()(
0244             typename fold_impl::expr_param e
0245           , typename fold_impl::state_param s
0246           , typename fold_impl::data_param d
0247         ) const
0248         {
0249             state0 s0 =
0250                 typename when<_, State0>::template impl<Expr, State, Data>()(e, s, d);
0251             state1 s1 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 0>::type , state0 , Data >()( proto::child_c< 0>(e) , s0 , d ); state2 s2 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 1>::type , state1 , Data >()( proto::child_c< 1>(e) , s1 , d ); state3 s3 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 2>::type , state2 , Data >()( proto::child_c< 2>(e) , s2 , d ); state4 s4 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 3>::type , state3 , Data >()( proto::child_c< 3>(e) , s3 , d ); state5 s5 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 4>::type , state4 , Data >()( proto::child_c< 4>(e) , s4 , d ); state6 s6 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 5>::type , state5 , Data >()( proto::child_c< 5>(e) , s5 , d ); state7 s7 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 6>::type , state6 , Data >()( proto::child_c< 6>(e) , s6 , d );
0252             return s7;
0253         }
0254     };
0255     template<typename State0, typename Fun, typename Expr, typename State, typename Data>
0256     struct reverse_fold_impl<State0, Fun, Expr, State, Data, 7>
0257       : transform_impl<Expr, State, Data>
0258     {
0259         typedef typename when<_, State0>::template impl<Expr, State, Data>::result_type state7;
0260         typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 6 >::type , state7 , Data >::result_type state6; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 5 >::type , state6 , Data >::result_type state5; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 4 >::type , state5 , Data >::result_type state4; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 3 >::type , state4 , Data >::result_type state3; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 2 >::type , state3 , Data >::result_type state2; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 1 >::type , state2 , Data >::result_type state1; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 0 >::type , state1 , Data >::result_type state0;
0261         typedef state0 result_type;
0262         result_type operator ()(
0263             typename reverse_fold_impl::expr_param e
0264           , typename reverse_fold_impl::state_param s
0265           , typename reverse_fold_impl::data_param d
0266         ) const
0267         {
0268             state7 s7 =
0269                 typename when<_, State0>::template impl<Expr, State, Data>()(e, s, d);
0270             state6 s6 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 6 >::type , state7 , Data >()( proto::child_c<6>(e) , s7 , d ); state5 s5 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 5 >::type , state6 , Data >()( proto::child_c<5>(e) , s6 , d ); state4 s4 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 4 >::type , state5 , Data >()( proto::child_c<4>(e) , s5 , d ); state3 s3 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 3 >::type , state4 , Data >()( proto::child_c<3>(e) , s4 , d ); state2 s2 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 2 >::type , state3 , Data >()( proto::child_c<2>(e) , s3 , d ); state1 s1 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 1 >::type , state2 , Data >()( proto::child_c<1>(e) , s2 , d ); state0 s0 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 0 >::type , state1 , Data >()( proto::child_c<0>(e) , s1 , d );
0271             return s0;
0272         }
0273     };
0274     template<typename State0, typename Fun, typename Expr, typename State, typename Data>
0275     struct fold_impl<State0, Fun, Expr, State, Data, 8>
0276       : transform_impl<Expr, State, Data>
0277     {
0278         typedef typename when<_, State0>::template impl<Expr, State, Data>::result_type state0;
0279         typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 0>::type , state0 , Data >::result_type state1; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 1>::type , state1 , Data >::result_type state2; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 2>::type , state2 , Data >::result_type state3; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 3>::type , state3 , Data >::result_type state4; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 4>::type , state4 , Data >::result_type state5; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 5>::type , state5 , Data >::result_type state6; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 6>::type , state6 , Data >::result_type state7; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 7>::type , state7 , Data >::result_type state8;
0280         typedef state8 result_type;
0281         result_type operator ()(
0282             typename fold_impl::expr_param e
0283           , typename fold_impl::state_param s
0284           , typename fold_impl::data_param d
0285         ) const
0286         {
0287             state0 s0 =
0288                 typename when<_, State0>::template impl<Expr, State, Data>()(e, s, d);
0289             state1 s1 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 0>::type , state0 , Data >()( proto::child_c< 0>(e) , s0 , d ); state2 s2 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 1>::type , state1 , Data >()( proto::child_c< 1>(e) , s1 , d ); state3 s3 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 2>::type , state2 , Data >()( proto::child_c< 2>(e) , s2 , d ); state4 s4 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 3>::type , state3 , Data >()( proto::child_c< 3>(e) , s3 , d ); state5 s5 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 4>::type , state4 , Data >()( proto::child_c< 4>(e) , s4 , d ); state6 s6 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 5>::type , state5 , Data >()( proto::child_c< 5>(e) , s5 , d ); state7 s7 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 6>::type , state6 , Data >()( proto::child_c< 6>(e) , s6 , d ); state8 s8 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 7>::type , state7 , Data >()( proto::child_c< 7>(e) , s7 , d );
0290             return s8;
0291         }
0292     };
0293     template<typename State0, typename Fun, typename Expr, typename State, typename Data>
0294     struct reverse_fold_impl<State0, Fun, Expr, State, Data, 8>
0295       : transform_impl<Expr, State, Data>
0296     {
0297         typedef typename when<_, State0>::template impl<Expr, State, Data>::result_type state8;
0298         typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 7 >::type , state8 , Data >::result_type state7; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 6 >::type , state7 , Data >::result_type state6; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 5 >::type , state6 , Data >::result_type state5; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 4 >::type , state5 , Data >::result_type state4; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 3 >::type , state4 , Data >::result_type state3; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 2 >::type , state3 , Data >::result_type state2; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 1 >::type , state2 , Data >::result_type state1; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 0 >::type , state1 , Data >::result_type state0;
0299         typedef state0 result_type;
0300         result_type operator ()(
0301             typename reverse_fold_impl::expr_param e
0302           , typename reverse_fold_impl::state_param s
0303           , typename reverse_fold_impl::data_param d
0304         ) const
0305         {
0306             state8 s8 =
0307                 typename when<_, State0>::template impl<Expr, State, Data>()(e, s, d);
0308             state7 s7 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 7 >::type , state8 , Data >()( proto::child_c<7>(e) , s8 , d ); state6 s6 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 6 >::type , state7 , Data >()( proto::child_c<6>(e) , s7 , d ); state5 s5 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 5 >::type , state6 , Data >()( proto::child_c<5>(e) , s6 , d ); state4 s4 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 4 >::type , state5 , Data >()( proto::child_c<4>(e) , s5 , d ); state3 s3 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 3 >::type , state4 , Data >()( proto::child_c<3>(e) , s4 , d ); state2 s2 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 2 >::type , state3 , Data >()( proto::child_c<2>(e) , s3 , d ); state1 s1 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 1 >::type , state2 , Data >()( proto::child_c<1>(e) , s2 , d ); state0 s0 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 0 >::type , state1 , Data >()( proto::child_c<0>(e) , s1 , d );
0309             return s0;
0310         }
0311     };
0312     template<typename State0, typename Fun, typename Expr, typename State, typename Data>
0313     struct fold_impl<State0, Fun, Expr, State, Data, 9>
0314       : transform_impl<Expr, State, Data>
0315     {
0316         typedef typename when<_, State0>::template impl<Expr, State, Data>::result_type state0;
0317         typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 0>::type , state0 , Data >::result_type state1; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 1>::type , state1 , Data >::result_type state2; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 2>::type , state2 , Data >::result_type state3; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 3>::type , state3 , Data >::result_type state4; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 4>::type , state4 , Data >::result_type state5; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 5>::type , state5 , Data >::result_type state6; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 6>::type , state6 , Data >::result_type state7; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 7>::type , state7 , Data >::result_type state8; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 8>::type , state8 , Data >::result_type state9;
0318         typedef state9 result_type;
0319         result_type operator ()(
0320             typename fold_impl::expr_param e
0321           , typename fold_impl::state_param s
0322           , typename fold_impl::data_param d
0323         ) const
0324         {
0325             state0 s0 =
0326                 typename when<_, State0>::template impl<Expr, State, Data>()(e, s, d);
0327             state1 s1 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 0>::type , state0 , Data >()( proto::child_c< 0>(e) , s0 , d ); state2 s2 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 1>::type , state1 , Data >()( proto::child_c< 1>(e) , s1 , d ); state3 s3 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 2>::type , state2 , Data >()( proto::child_c< 2>(e) , s2 , d ); state4 s4 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 3>::type , state3 , Data >()( proto::child_c< 3>(e) , s3 , d ); state5 s5 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 4>::type , state4 , Data >()( proto::child_c< 4>(e) , s4 , d ); state6 s6 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 5>::type , state5 , Data >()( proto::child_c< 5>(e) , s5 , d ); state7 s7 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 6>::type , state6 , Data >()( proto::child_c< 6>(e) , s6 , d ); state8 s8 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 7>::type , state7 , Data >()( proto::child_c< 7>(e) , s7 , d ); state9 s9 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 8>::type , state8 , Data >()( proto::child_c< 8>(e) , s8 , d );
0328             return s9;
0329         }
0330     };
0331     template<typename State0, typename Fun, typename Expr, typename State, typename Data>
0332     struct reverse_fold_impl<State0, Fun, Expr, State, Data, 9>
0333       : transform_impl<Expr, State, Data>
0334     {
0335         typedef typename when<_, State0>::template impl<Expr, State, Data>::result_type state9;
0336         typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 8 >::type , state9 , Data >::result_type state8; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 7 >::type , state8 , Data >::result_type state7; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 6 >::type , state7 , Data >::result_type state6; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 5 >::type , state6 , Data >::result_type state5; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 4 >::type , state5 , Data >::result_type state4; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 3 >::type , state4 , Data >::result_type state3; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 2 >::type , state3 , Data >::result_type state2; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 1 >::type , state2 , Data >::result_type state1; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 0 >::type , state1 , Data >::result_type state0;
0337         typedef state0 result_type;
0338         result_type operator ()(
0339             typename reverse_fold_impl::expr_param e
0340           , typename reverse_fold_impl::state_param s
0341           , typename reverse_fold_impl::data_param d
0342         ) const
0343         {
0344             state9 s9 =
0345                 typename when<_, State0>::template impl<Expr, State, Data>()(e, s, d);
0346             state8 s8 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 8 >::type , state9 , Data >()( proto::child_c<8>(e) , s9 , d ); state7 s7 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 7 >::type , state8 , Data >()( proto::child_c<7>(e) , s8 , d ); state6 s6 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 6 >::type , state7 , Data >()( proto::child_c<6>(e) , s7 , d ); state5 s5 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 5 >::type , state6 , Data >()( proto::child_c<5>(e) , s6 , d ); state4 s4 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 4 >::type , state5 , Data >()( proto::child_c<4>(e) , s5 , d ); state3 s3 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 3 >::type , state4 , Data >()( proto::child_c<3>(e) , s4 , d ); state2 s2 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 2 >::type , state3 , Data >()( proto::child_c<2>(e) , s3 , d ); state1 s1 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 1 >::type , state2 , Data >()( proto::child_c<1>(e) , s2 , d ); state0 s0 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 0 >::type , state1 , Data >()( proto::child_c<0>(e) , s1 , d );
0347             return s0;
0348         }
0349     };
0350     template<typename State0, typename Fun, typename Expr, typename State, typename Data>
0351     struct fold_impl<State0, Fun, Expr, State, Data, 10>
0352       : transform_impl<Expr, State, Data>
0353     {
0354         typedef typename when<_, State0>::template impl<Expr, State, Data>::result_type state0;
0355         typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 0>::type , state0 , Data >::result_type state1; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 1>::type , state1 , Data >::result_type state2; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 2>::type , state2 , Data >::result_type state3; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 3>::type , state3 , Data >::result_type state4; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 4>::type , state4 , Data >::result_type state5; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 5>::type , state5 , Data >::result_type state6; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 6>::type , state6 , Data >::result_type state7; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 7>::type , state7 , Data >::result_type state8; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 8>::type , state8 , Data >::result_type state9; typedef typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 9>::type , state9 , Data >::result_type state10;
0356         typedef state10 result_type;
0357         result_type operator ()(
0358             typename fold_impl::expr_param e
0359           , typename fold_impl::state_param s
0360           , typename fold_impl::data_param d
0361         ) const
0362         {
0363             state0 s0 =
0364                 typename when<_, State0>::template impl<Expr, State, Data>()(e, s, d);
0365             state1 s1 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 0>::type , state0 , Data >()( proto::child_c< 0>(e) , s0 , d ); state2 s2 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 1>::type , state1 , Data >()( proto::child_c< 1>(e) , s1 , d ); state3 s3 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 2>::type , state2 , Data >()( proto::child_c< 2>(e) , s2 , d ); state4 s4 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 3>::type , state3 , Data >()( proto::child_c< 3>(e) , s3 , d ); state5 s5 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 4>::type , state4 , Data >()( proto::child_c< 4>(e) , s4 , d ); state6 s6 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 5>::type , state5 , Data >()( proto::child_c< 5>(e) , s5 , d ); state7 s7 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 6>::type , state6 , Data >()( proto::child_c< 6>(e) , s6 , d ); state8 s8 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 7>::type , state7 , Data >()( proto::child_c< 7>(e) , s7 , d ); state9 s9 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 8>::type , state8 , Data >()( proto::child_c< 8>(e) , s8 , d ); state10 s10 = typename when<_, Fun>::template impl< typename result_of::child_c<Expr, 9>::type , state9 , Data >()( proto::child_c< 9>(e) , s9 , d );
0366             return s10;
0367         }
0368     };
0369     template<typename State0, typename Fun, typename Expr, typename State, typename Data>
0370     struct reverse_fold_impl<State0, Fun, Expr, State, Data, 10>
0371       : transform_impl<Expr, State, Data>
0372     {
0373         typedef typename when<_, State0>::template impl<Expr, State, Data>::result_type state10;
0374         typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 9 >::type , state10 , Data >::result_type state9; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 8 >::type , state9 , Data >::result_type state8; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 7 >::type , state8 , Data >::result_type state7; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 6 >::type , state7 , Data >::result_type state6; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 5 >::type , state6 , Data >::result_type state5; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 4 >::type , state5 , Data >::result_type state4; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 3 >::type , state4 , Data >::result_type state3; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 2 >::type , state3 , Data >::result_type state2; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 1 >::type , state2 , Data >::result_type state1; typedef typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 0 >::type , state1 , Data >::result_type state0;
0375         typedef state0 result_type;
0376         result_type operator ()(
0377             typename reverse_fold_impl::expr_param e
0378           , typename reverse_fold_impl::state_param s
0379           , typename reverse_fold_impl::data_param d
0380         ) const
0381         {
0382             state10 s10 =
0383                 typename when<_, State0>::template impl<Expr, State, Data>()(e, s, d);
0384             state9 s9 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 9 >::type , state10 , Data >()( proto::child_c<9>(e) , s10 , d ); state8 s8 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 8 >::type , state9 , Data >()( proto::child_c<8>(e) , s9 , d ); state7 s7 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 7 >::type , state8 , Data >()( proto::child_c<7>(e) , s8 , d ); state6 s6 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 6 >::type , state7 , Data >()( proto::child_c<6>(e) , s7 , d ); state5 s5 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 5 >::type , state6 , Data >()( proto::child_c<5>(e) , s6 , d ); state4 s4 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 4 >::type , state5 , Data >()( proto::child_c<4>(e) , s5 , d ); state3 s3 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 3 >::type , state4 , Data >()( proto::child_c<3>(e) , s4 , d ); state2 s2 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 2 >::type , state3 , Data >()( proto::child_c<2>(e) , s3 , d ); state1 s1 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 1 >::type , state2 , Data >()( proto::child_c<1>(e) , s2 , d ); state0 s0 = typename when<_, Fun>::template impl< typename result_of::child_c< Expr , 0 >::type , state1 , Data >()( proto::child_c<0>(e) , s1 , d );
0385             return s0;
0386         }
0387     };