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 an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

flatten_view

Description

flatten_view presents a view which iterates over its elements recursively in depth-first order.

Header
#include <boost/fusion/view/flatten_view.hpp>
#include <boost/fusion/include/flatten_view.hpp>
Synopsis
template <typename Sequence>
struct flatten_view;
Template parameters

Parameter

Description

Default

Sequence

A Forward Sequence

Model of

Notation

F

A flatten_view type

s

An instance of Sequence

f, f2

Instances of F

Expression Semantics

Semantics of an expression is defined only where it differs from, or is not defined in Forward Sequence.

Expression

Semantics

F(s)

Creates a flatten_view given sequence, s.

F(f)

Copy constructs a flatten_view from another flatten_view, f.

f = f2

Assigns to a flatten_view, f, from another flatten_view, f2.

Example
typedef vector<int, int, vector<int, int>, int> sequence_type;
sequence_type seq;
flatten_view<sequence_type> flattened(seq);
copy(make_vector(1, 2, 3, 4, 5), flattened);
assert(seq == make_vector(1, 2, make_vector(3, 4), 5));

PrevUpHomeNext