STRUCT TEMPLATE IM(3)

NAME
boost::proto::_default::impl

SYNOPSIS

// 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;
  static Expr s_expr;  // For exposition only
  static State s_state;  // For exposition only
  static Data s_data;  // For exposition only
};

DESCRIPTION

Let OP be the C++ operator corresponding to Expr::proto_tag. (For example, if Tag is proto::tag::plus, let OP be +.)

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 types

    1. typedef see-below result_type;

        &#8226; If Tag corresponds to a unary prefix operator, then the result type is

            decltype(
              OP Grammar()(proto::child(s_expr), s_state, s_data)
            )

        &#8226; If Tag corresponds to a unary postfix operator, then the result type is

            decltype(
              Grammar()(proto::child(s_expr), s_state, s_data) OP
            )

        &#8226; 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)
            )

        &#8226; 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) ]
            )

        &#8226; 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)
            )

        &#8226; 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 functions

    1.

    result_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()

        &#8226; If Tag corresponds to a unary prefix operator, then return

            OP Grammar()(proto::child(expr), state, data)

        &#8226; If Tag corresponds to a unary postfix operator, then return

            Grammar()(proto::child(expr), state, data) OP

        &#8226; If Tag corresponds to a binary infix operator, then return

            Grammar()(proto::left(expr), state, data) OP
            Grammar()(proto::right(expr), state, data)

        &#8226; If Tag is proto::tag::subscript, then return

            Grammar()(proto::left(expr), state, data) [
            Grammar()(proto::right(expr), state, data) ]

        &#8226; If Tag is proto::tag::if_else_, then return

            Grammar()(proto::child_c<0>(expr), state, data) ?
            Grammar()(proto::child_c<1>(expr), state, data) :
            Grammar()(proto::child_c<2>(expr), state, data)

        &#8226; If Tag is proto::tag::function, then return

            Grammar()(proto::child_c<0>(expr), state, data) (
            Grammar()(proto::child_c<1>(expr), state, data),
            ...
            Grammar()(proto::child_c<N>(expr), state, data) )