...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Returns a new sequence without nested sequences.
template< typename Sequence > typenameresult_of::flatten
<Sequence>::type flatten(Sequence& seq); template< typename Sequence > typenameresult_of::flatten
<Sequence const>::type flatten(Sequence const& seq);
Table 1.86. Parameters
Parameter |
Requirement |
Description |
---|---|---|
|
A model of Forward Sequence |
Operation's argument |
flatten
(seq);
Return type:
Semantics: Returns a new sequence containing
all the leaf elements of seq
.
Constant. Returns a view which is lazily evaluated.
#include <boost/fusion/algorithm/transformation/flatten.hpp> #include <boost/fusion/include/flatten.hpp>
constvector
<int, int,vector
<int, int>, int> vec(1, 2,make_vector
(3, 4), 5); assert(flatten
(vec) ==make_vector
(1, 2, 3, 4, 5)));