...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::proto::_default::impl
// In header: <boost/proto/transform/default.hpp> template<typename Expr, typename State, typename Data> struct impl : proto::transform_impl<Expr, State, Data> { // types typedef typename Expr::tag_type Tag; // For exposition only typedef see-below result_type; // public member functions result_type operator()(typename impl::expr_param, typename impl::state_param, typename impl::data_param) const; // public data members static Expr s_expr; // For exposition only static State s_state; // For exposition only static Data s_data; // For exposition only };
Let
be the C++ operator
corresponding to OP
Expr::proto_tag
. (For example, if
Tag
is
proto::tag::plus
, let
be OP
+
.)
The behavior of this class is specified in terms of the C++0x decltype
keyword. In systems where this keyword is not available, Proto uses the Boost.Typeof library to
approximate the behavior.
impl
public
typestypedef see-below result_type;
If Tag
corresponds to a unary prefix operator,
then the result type is
decltype( OP Grammar()(proto::child(s_expr), s_state, s_data) )
If Tag
corresponds to a unary postfix operator,
then the result type is
decltype( Grammar()(proto::child(s_expr), s_state, s_data) OP )
If Tag
corresponds to a binary infix operator,
then the result type is
decltype( Grammar()(proto::left(s_expr), s_state, s_data) OP Grammar()(proto::right(s_expr), s_state, s_data) )
If Tag
is
proto::tag::subscript
,
then the result type is
decltype( Grammar()(proto::left(s_expr), s_state, s_data) [ Grammar()(proto::right(s_expr), s_state, s_data) ] )
If Tag
is
proto::tag::if_else_
,
then the result type is
decltype( Grammar()(proto::child_c<0>(s_expr), s_state, s_data) ? Grammar()(proto::child_c<1>(s_expr), s_state, s_data) : Grammar()(proto::child_c<2>(s_expr), s_state, s_data) )
If Tag
is
proto::tag::function
,
then the result type is
decltype( Grammar()(proto::child_c<0>(s_expr), s_state, s_data) ( Grammar()(proto::child_c<1>(s_expr), s_state, s_data), ... Grammar()(proto::child_c<N>(s_expr), s_state, s_data) ) )
impl
public member functionsresult_type operator()(typename impl::expr_param expr, typename impl::state_param state, typename impl::data_param data) const;
proto::_default
<Grammar>::impl<Expr, State, Data>::operator()
If Tag
corresponds to a unary prefix operator,
then return
OP Grammar()(proto::child
(expr), state, data)
If Tag
corresponds to a unary postfix operator,
then return
Grammar()(proto::child
(expr), state, data) OP
If Tag
corresponds to a binary infix operator,
then return
Grammar()(proto::left
(expr), state, data) OP Grammar()(proto::right
(expr), state, data)
If Tag
is
,
then return
proto::tag::subscript
Grammar()(proto::left
(expr), state, data) [ Grammar()(proto::right
(expr), state, data) ]
If Tag
is
,
then return
proto::tag::if_else_
Grammar()(proto::child_c
<0>(expr), state, data) ? Grammar()(proto::child_c
<1>(expr), state, data) : Grammar()(proto::child_c
<2>(expr), state, data)
If Tag
is
,
then return
proto::tag::function
Grammar()(proto::child_c
<0>(expr), state, data) ( Grammar()(proto::child_c
<1>(expr), state, data), ... Grammar()(proto::child_c
<N>(expr), state, data) )