| Home | Libraries | People | FAQ | More

## Struct template impl

boost::proto::fold::impl

## Synopsis

    // In header: <boost/proto/transform/fold.hpp>

    template<typename Expr, typename State, typename Data>
    struct impl :  proto::transform_impl< Expr, State, Data > {
      // types
      typedef when<_, Sequence>                                        X;            // For exposition only
      typedef when<_, State0>                                          Y;            // For exposition only
      typedef typename boost::result_of<X(Expr, State, Data)>::type    seq;          // A Fusion sequence, for exposition only
      typedef typename boost::result_of<Y(Expr, State, Data)>::type    state0;       // An initial state for the fold, for exposition only
      typedef unspecified                                              fun;          // fun(d)(s,e) == when<_,Fun>()(e,s,d)
      typedef typename fusion::result_of::fold<seq, state0, fun>::type result_type;

      // public member functions
      result_type operator()(typename impl::expr_param,
                             typename impl::state_param,
                             typename impl::data_param) const;
    };

## Description

### `impl` public member functions

1.     result_type operator()(typename impl::expr_param expr,
                              typename impl::state_param state,
                              typename impl::data_param data) const;

   Let `seq` be ``when`<`_`, Sequence>()(expr, state, data)`, let `state0` be ``when`<`_`, State0>()(expr, state, data)`, and let `fun(data)` be an object such that `fun(data)(state, expr)` is equivalent to ``when`<`_`, Fun>()(expr, state, data)`. Then, this function returns `fusion::fold(seq, state0, fun(data))`.

   Parameters:

   `data` | An arbitrary data
   `expr` | The current expression
   `state` | The current state