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

Click here to view the latest version of this page.
PrevUpHomeNext

Struct template basic_expr

boost::proto::basic_expr — Simplified representation of a node in an expression tree.

Synopsis

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

template<typename Tag, typename Args, long Arity = Args::arity> 
struct basic_expr {
  // types
  typedef Tag                         proto_tag;         
  typedef Args                        proto_args;        
  typedef mpl::long_< Arity >         proto_arity;       
  typedef proto::basic_default_domain proto_domain;      
  typedef basic_expr                  proto_grammar;     
  typedef basic_expr                  proto_base_expr;   
  typedef basic_expr                  proto_derived_expr;
  typedef typename Args::childN       proto_childN;        // For each N in [0,max(Arity,1)).

  // public static functions
  template<typename... A> static basic_expr const make(A const &...);

  // public member functions
  basic_expr & proto_base();
  basic_expr const & proto_base() const;
};

Description

proto::basic_expr<> is a node in an expression template tree. It is a container for its child sub-trees. 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::basic_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::basic_expr<> is a valid Fusion random-access sequence, where the elements of the sequence are the child expressions.

basic_expr public static functions

  1. template<typename... A> static basic_expr const make(A const &... a);

    Requires:

    The number of supplied arguments must be max(Arity,1).

    Returns:

    A new basic_expr object initialized with the specified arguments.

basic_expr public member functions

  1. basic_expr & proto_base();

    Returns:

    *this

  2. basic_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.


PrevUpHomeNext