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

PrevUpHomeNext

Struct template or_

boost::proto::or_ — For matching one of a set of alternate grammars. Alternates are tried in order to avoid ambiguity. When used as a transform, proto::or_<> applies the transform associated with the first grammar that matches the expression.

Synopsis

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

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

  // member classes/structs/unions
  template<typename Expr, typename State, typename Data> 
  struct impl :  proto::transform_impl< Expr, State, Data > {
    // types
    typedef unspecified 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::or_<G0,G1,...Gn> if E matches any Gx for x in [0,n].

When applying proto::or_<G0,G1,...Gn> as a transform with an expression e of type E, state s and data d, it is equivalent to Gx()(e, s, d), where x is the lowest number such that proto::matches<E, Gx>::value is true.

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


PrevUpHomeNext