...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::proto::expr — Representation of a node in an expression tree.
// In header: <boost/proto/expr.hpp> template<typename Tag, typename Args, long Arity = Args::arity> struct expr { // types typedef Tag proto_tag; typedef Args proto_args; typedef mpl::long_< Arity > proto_arity; typedef proto::default_domain proto_domain; typedef expr proto_base_expr; typedef expr proto_derived_expr; typedef typename Args::childN
proto_childN; // For eachN
in[0,max(Arity,1))
. template<typename Signature> struct result { // types typedefunspecified
type; }; // public static functions template<typename... A> static expr const make(A const &...); // public member functions expr & proto_base(); expr const & proto_base() const; template<typename A>unspecified
operator=(A &); template<typename A>unspecified
operator=(A const &); template<typename A>unspecified
operator=(A &) const; template<typename A>unspecified
operator=(A const &) const; template<typename A>unspecified
operator[](A &); template<typename A>unspecified
operator[](A const &); template<typename A>unspecified
operator[](A &) const; template<typename A>unspecified
operator[](A const &) const; template<typename... A>unspecified
operator()(A const &...); template<typename... A>unspecified
operator()(A const &...) const; proto_childN
childN; // For eachN
in[0,max(Arity,1))
. };
proto::expr<>
is a node in an expression
template tree. It is a container for its child subtrees. It also serves as the
terminal nodes of the tree.
Tag
is type that represents the operation
encoded by this expression. It is typically one of the structs in the
boost::proto::tag
namespace, but it doesn't
have to be. If Arity
is 0 then this
expr<>
type represents a leaf in the
expression tree.
Args
is a list of types representing
the children of this expression. It is an instantiation of one of
proto::list1<>
,
proto::list2<>
,
etc. The child types
must all themselves be either proto::expr<>
or proto::expr<>&
(or extensions thereof via
proto::extends<>
or
BOOST_PROTO_EXTENDS()
), unless
Arity
is 0, in which case
Args
must be
proto::term<T>
, where
T
can be any type.
proto::expr<>
is a valid Fusion
randomaccess sequence, where the elements of the sequence are the child
expressions.
expr
public member functionsexpr & proto_base();
Returns: 

expr const & proto_base() const;
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<typename A> unspecified
operator=(A & a);
Lazy assignment expression
Returns: 
A new expression node representing the assignment operation. 
template<typename A> unspecified
operator=(A const & a);
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<typename A> unspecified
operator=(A & a) const;
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<typename A> unspecified
operator=(A const & a) const;
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<typename A> unspecified
operator[](A & a);
Lazy subscript expression
Returns: 
A new expression node representing the subscript operation. 
template<typename A> unspecified
operator[](A const & a);
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<typename A> unspecified
operator[](A & a) const;
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<typename A> unspecified
operator[](A const & a) const;
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<typename... A> unspecified
operator()(A const &... a);
Lazy function call
Returns: 
A new expression node representing the function call operation. 
template<typename... A> unspecified
operator()(A const &... a) const;
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.