Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::proto::switch_< Cases, Transform > Struct Template Reference

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>

Inheritance diagram for boost::proto::switch_< Cases, Transform >:
Collaboration diagram for boost::proto::switch_< Cases, Transform >:

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
 

Detailed Description

template<typename Cases, typename Transform>
struct boost::proto::switch_< Cases, Transform >

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.

Note
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).

Member Typedef Documentation

template<typename Cases, typename Transform >
typedef switch_ boost::proto::switch_< Cases, Transform >::proto_grammar
typedef switch_< Cases, Transform > boost::proto::transform< switch_< Cases, Transform > , X >::transform_type
inherited

Member Function Documentation

boost::proto::transform< switch_< Cases, Transform > , X >::BOOST_PROTO_CALLABLE ( )
inherited
BOOST_FORCEINLINE boost::proto::detail::apply_transform<transform_type(Expr const &, State const &, Data const &)>::result_type boost::proto::transform< switch_< Cases, Transform > , X >::operator() ( Expr &&  e,
State &&  s,
Data &&  d 
) const
inlineinherited
BOOST_FORCEINLINE boost::proto::detail::apply_transform<transform_type(Expr const &, State const &)>::result_type boost::proto::transform< switch_< Cases, Transform > , X >::operator() ( Expr &&  e,
State &&  s 
) const
inlineinherited
BOOST_FORCEINLINE boost::proto::detail::apply_transform<transform_type(Expr const &)>::result_type boost::proto::transform< switch_< Cases, Transform > , X >::operator() ( Expr &&  e) const
inlineinherited

The documentation for this struct was generated from the following file: