unspecified
proto::transform
< _default<Grammar> >
A PrimitiveTransform that gives expressions their usual C++ behavior

For the complete description of the behavior of the `proto::_default` transform, see the documentation for the nested ``proto::_default::impl<>`` class template.

When used without specifying a `Grammar` parameter, `proto::_default` behaves as if the parameter were `proto::_default<>`.

`proto::transform_impl`<Expr, State, Data>
For exposition only
typename Expr::tag_type
For exposition only
Expr
For exposition only
State
For exposition only
Data
see-below

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

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

result_type `typename impl::expr_param` `typename impl::state_param` `typename impl::data_param` ``proto::_default`<Grammar>::impl<Expr, State, Data>::operator()` returns the following:

- 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 ``proto::tag::subscript`` , then return

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

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

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

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.