Struct template impl

| Home | Libraries | People | FAQ | More

## Struct template impl

boost::proto::make::impl

## Synopsis

    template<typename Expr, typename State, typename Data>
    struct impl :  proto::transform_impl< Expr, State, Data > {
      // types
      typedef see-below result_type;

      // public member functions
      result_type operator()(typename impl::expr_param,
                             typename impl::state_param,
                             typename impl::data_param) const;
    };

## Description

### `impl` public types

1. typedef see-below result_type;

   `proto::make<T>::impl<Expr, State, Data>::result_type` is computed as follows:

   If `T` is an ObjectTransform of the form `Object(T0,...TN)`, then let `O` be the return type `Object`. Otherwise, let `O` be `T`. The `result_type` typedef is then computed as follows:

   - If `O` is a template like `S<X0,...XN>`, then the result type is calculated as follows:

     - For each `X` in `X0,...XN`, let `X'` be `proto::make<X>::impl<Expr, State, Data>::result_type` (which evaluates this procedure recursively). Note whether any substitutions took place during this operation.

     - If any substitutions took place in the above step and `S<X0',...XN'>` has a nested `type` typedef, the result type is `S<X0',...XN'>::type`.

     - Otherwise, the result type is `S<X0',...XN'>`.

   - Otherwise, if `O` is a Transform, then let the result type be `when<_, O>::impl<Expr, State, Data>::result_type` . Note that a substitution took place.

   - Otherwise, the result type is `O`, and note that no substitution took place.

   Note that `proto::when<>` is implemented in terms of `proto::call<>` and `proto::make<>`, so the above procedure is evaluated recursively.

### `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::make<T>::impl<Expr,State,Data>::operator()` behaves as follows:

   - If `T` if of the form `O(T0,...TN)`, then:

     - If ``proto::is_aggregate`<result_type>::value` is `true`, then construct and return an object `that` as follows:

           result_type that = {
             proto::when<_, T0>()(expr, state, data),
             ...
             proto::when<_, TN>()(expr, state, data)
           };

     - Otherwise, construct and return an object `that` as follows:

           result_type that(
             proto::when<_, T0>()(expr, state, data),
             ...
             proto::when<_, TN>()(expr, state, data)
           );

   - Otherwise, construct and return an object `that` as follows:

         result_type that = result_type();