Boost C++ Libraries 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.

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.


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

template<typename... G> 
struct or_ :  proto::transform<or_<G...> > {
  // types
  typedef or_ proto_base_expr;
  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;


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 v, it is equivalent to Gx()(e, s, v), 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.