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 expr

boost::proto::expr — 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 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 each N in [0,max(Arity,1)).

  // member classes/structs/unions
  template<typename Signature> 
  struct result {
    // types
    typedef unspecified 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 each N in [0,max(Arity,1)).
  static const long proto_arity_c;  // = Arity;
};

Description

proto::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::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 random-access sequence, where the elements of the sequence are the child expressions.

expr public static functions

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

    Requires:

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

    Returns:

    A new expr object initialized with the specified arguments.

expr public member functions

  1. expr & proto_base();

    Returns:

    *this

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

  3. template<typename A> unspecified operator=(A & a);

    Lazy assignment expression

    Returns:

    A new expression node representing the assignment operation.

  4. 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.

  5. 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.

  6. 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.

  7. template<typename A> unspecified operator[](A & a);

    Lazy subscript expression

    Returns:

    A new expression node representing the subscript operation.

  8. 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.

  9. 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.

  10. 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.

  11. template<typename... A> unspecified operator()(A const &... a);

    Lazy function call

    Returns:

    A new expression node representing the function call operation.

  12. 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.


PrevUpHomeNext