Struct template switch_
boost::proto::switch_ — For matching one of a set of alternate grammars, which are looked up based on
the result type of the transform passed in second template parameter.
If no transform is passed, the default one is proto::tag_of<proto::_>()
so the default matching is based on the expression's tag type. When used as a transform,
proto::switch_<>
applies the transform associated
with the sub-grammar that matches the expression.
Synopsis
template<typename Cases, typename Transform>
struct switch_ : proto::transform<switch_<Cases, Transform> > {
typedef switch_ proto_grammar;
template<typename Expr, typename State, typename Data>
struct impl :
Cases::template case_<
typename when<_, Transform>::template impl<Expr, State, Data>::result_type
>::template impl<Expr, State, Data>
{
};
};
Description
Тип выражения<E
>матчи<proto::switch_<C,T>
>, если<E
>матчи<C::case_<boost::result_of<proto::when<proto::_,T>(E)>::type>
>.
При применении<proto::switch_<C,T>
>в качестве преобразования с выражением<e
>типа<E
>, состояния<s
>типа<S
>и данных<d
>типа<D
>он эквивалентен<C::case_<boost::result_of<proto::when<proto::_,T>(E,S,D)>::type>()(e, s, d)
>.