Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

Struct template impl

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;

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

PrevUpHomeNext