Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for a snapshot of the develop branch, built from commit 09fbc2c975.
PrevUpHomeNext
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:

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)));

PrevUpHomeNext