![]() |
Home | Libraries | People | FAQ | More |
boost::proto::when<Grammar, R(A...)> — A grammar element and a Transform that associates a transform with the grammar.
// In header: <boost/proto/transform/when.hpp> template<typename Grammar, typename R, typename... A> struct when<, > : proto::transform< when<Grammar, R(A...)> > { // types typedef ; // member classes/structs/unions template<typename Expr, typename State, typename Data> struct impl : proto::transform_impl< Expr, State, Data > { // types typedef proto::call< ; // For exposition only typedef proto::make< ; // For exposition only typedef proto::is_callable< ; // For exposition only typedef ; // public member functions (, , ) ; }; };
Use proto::when<>
to override a grammar's default
transform with a custom transform. It is for use when composing larger transforms by associating
smaller transforms with individual rules in your grammar.
The when<G, R(A...)>
form accepts either a
CallableTransform or an ObjectTransform as its
second parameter. proto::when<>
uses
proto::is_callable<R>::value
to
distinguish between the two, and uses
proto::call<>
to evaluate
CallableTransforms and
proto::make<>
to evaluate
ObjectTransforms.