A PrimitiveTransform that recursively applies the fold<>
transform to sub-trees that all share a common tag type.
More...
#include <fold_tree.hpp>
Classes | |
struct | impl |
struct | impl< Expr &, State, Data > |
Public Types | |
typedef fold_tree< Sequence, State0, Fun > | transform_type |
Public Member Functions | |
BOOST_PROTO_CALLABLE () typedef X proto_is_transform_ | |
BOOST_FORCEINLINE boost::proto::detail::apply_transform < transform_type(Expr const &)> ::result_type | operator() (Expr &&e) const |
BOOST_FORCEINLINE boost::proto::detail::apply_transform < transform_type(Expr const &, State const &)> ::result_type | operator() (Expr &&e, State &&s) const |
BOOST_FORCEINLINE boost::proto::detail::apply_transform < transform_type(Expr const &, State const &, Data const &)> ::result_type | operator() (Expr &&e, State &&s, Data &&d) const |
A PrimitiveTransform that recursively applies the fold<>
transform to sub-trees that all share a common tag type.
fold_tree<>
is useful for flattening trees into lists; for example, you might use fold_tree<>
to flatten an expression tree like a | b | c
into a Fusion list like cons(c, cons(b, cons(a)))
.
fold_tree<>
is easily understood in terms of a recurse_if_<>
helper, defined as follows:
With recurse_if_<>
as defined above, fold_tree<Sequence, State0, Fun>()(e, s, d)
is equivalent to fold<Sequence, State0, recurse_if_<Expr::proto_tag, Fun> >()(e, s, d).
It has the effect of folding a tree front-to-back, recursing into child nodes that share a tag type with the parent node.
|
inherited |
|
inherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |