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 the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

Struct template and_

boost::proto::and_ — For matching all of a set of grammars. When used as a transform, proto::and_<> applies the transform associated with each grammar in the set and returns the result of the last.

Synopsis

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

template<typename... G> 
struct and_ :  proto::transform<and_<G...> > {
  // types
  typedef and_ proto_grammar;

  // member classes/structs/unions
  template<typename Expr, typename State, typename Data> 
  struct impl :  proto::transform_impl< Expr, State, Data > {
    // types
    typedef typename boost::result_of<Gn(Expr, State, Data)>::type result_type;

    // public member functions
    result_type operator()(typename impl::expr_param, 
                           typename impl::state_param, 
                           typename impl::data_param) const;
  };
};

Description

An expression type E matches proto::and_<G0,G1,...Gn> if E matches all Gx for x in [0,n].

When applying proto::and_<G0,G1,...Gn> as a transform with an expression e, state s and data d, it is equivalent to (G0()(e, s, d),G1()(e, s, d),...Gn()(e, s, d)).

The maximun number of template arguments proto::and_<> accepts is controlled by the BOOST_PROTO_MAX_LOGICAL_ARITY macro.


PrevUpHomeNext