flatten

| Home | Libraries | People | FAQ | More

##### flatten

###### Description

Returns a new sequence without nested sequences.

###### Synopsis

    template<
        typename Sequence
        >
    typename result_of::flatten<Sequence>::type flatten(Sequence& seq);

    template<
        typename Sequence
        >
    typename result_of::flatten<Sequence const>::type flatten(Sequence const& seq);

Table 1.86. Parameters

Parameter | Requirement | Description
--- | --- | ---
`seq` | A model of Forward Sequence | Operation's argument

###### Expression Semantics

    flatten(seq);

Return type:

- A model of Forward Sequence.

Semantics: Returns a new sequence containing all the leaf elements of `seq`.

###### Complexity

Constant. Returns a view which is lazily evaluated.

###### Header

    #include <boost/fusion/algorithm/transformation/flatten.hpp>
    #include <boost/fusion/include/flatten.hpp>

###### Example

    const vector<int, int, vector<int, int>, int> vec(1, 2, make_vector(3, 4), 5);
    assert(flatten(vec) == make_vector(1, 2, 3, 4, 5)));