fold

| Home | Libraries | People | FAQ | More

##### fold

###### Description

Returns the result type of `fold`.

###### Synopsis

    template<
        typename Sequence,
        typename State,
        typename F>
    struct fold
    {
        typedef unspecified type;
    };

Table 1.36. Parameters

Parameter | Requirement | Description
--- | --- | ---
`Sequence` | A model of Forward Sequence | The sequence to iterate
`State` | Any type | The initial state for the first application of `F`
`F` | ``boost::result_of`<F(E,S)>::type` is the return type of `f(e,s)` for each element `e` of type `E` in `seq`, and current state `s` of type `S` | The operation to be applied on forward traversal

###### Expression Semantics

    result_of::fold<Sequence, State, F>::type

Return type: Any type

Semantics: Returns the result of applying `fold` to a sequence of type `Sequence`, with an initial state of type `State` and binary function object or function pointer of type `F`.

###### Complexity

Linear, exactly ``result_of::size`<Sequence>::value` applications of `F`.

###### Header

    #include <boost/fusion/algorithm/iteration/fold.hpp>
    #include <boost/fusion/include/fold.hpp>