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 an old version of boost. Click here for the latest version's documentation home page.
PrevUpHomeNext

Function flatten

boost::proto::flatten — A function that returns a "flattened" view of a Proto expression tree.

Synopsis

// In header: <boost/proto/fusion.hpp>


template<typename Expr> 
  typename proto::result_of::flatten< Expr >::type const flatten(Expr & expr);
template<typename Expr> 
  typename proto::result_of::flatten< Expr const >::type const 
  flatten(Expr const & expr);

Description

For a tree with a top-most node tag of type T, the elements of the flattened sequence are determined by recursing into each child node with the same tag type and returning those nodes of different type. So for instance, the Proto expression tree corresponding to the expression a | b | c has a flattened view with elements [a, b, c], even though the tree is grouped as ((a | b) | c).

The returned view is a Fusion Forward Sequence.


PrevUpHomeNext