For matching one of a set of alternate grammars, which are looked up based on some property of an expression. More...
#include <proto_fwd.hpp>
Classes | |
struct | impl |
Public Types | |
typedef switch_ | proto_grammar |
typedef switch_< Cases, Transform > | transform_type |
Public Member Functions | |
BOOST_PROTO_CALLABLE () typedef X proto_is_transform_ | |
BOOST_FORCEINLINE boost::proto::detail::apply_transform < transform_type(Expr const &)> ::result_type | operator() (Expr &&e) const |
BOOST_FORCEINLINE boost::proto::detail::apply_transform < transform_type(Expr const &, State const &)> ::result_type | operator() (Expr &&e, State &&s) const |
BOOST_FORCEINLINE boost::proto::detail::apply_transform < transform_type(Expr const &, State const &, Data const &)> ::result_type | operator() (Expr &&e, State &&s, Data &&d) const |
For matching one of a set of alternate grammars, which are looked up based on some property of an expression.
The property on which to dispatch is specified by the Transform
template parameter, which defaults to tag_of<_>()
. That is, when the Trannsform
is not specified, the alternate grammar is looked up using the tag type of the current expression.
When used as a transform, switch_<>
applies the transform associated with the grammar that matches the expression.
switch_<>
is functionally identical to or_<>
but is often more efficient. It does a fast, O(1) lookup using the result of the specified transform to find a sub-grammar that may potentially match the expression.An expression type E
matches switch_<C,T>
if E
matches C::case_<boost::result_of<T(E)>::type>
.
When applying switch_<C,T>
as a transform with an expression e
of type E
, state s
of type and data d
of type D
, it is equivalent to C::case_<boost::result_of<T(E,S,D)>::type>()(e, s, d)
.
typedef switch_ boost::proto::switch_< Cases, Transform >::proto_grammar |
|
inherited |
|
inherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |