| Home | Libraries | People | FAQ | More

## Function as_expr

boost::proto::as_expr — A function that wraps non-Proto expression types in Proto terminals and leaves Proto expression types alone.

## Synopsis

    // In header: <boost/proto/traits.hpp>

    template<typename T>
      typename proto::result_of::as_expr< T >::type as_expr(T & t);
    template<typename T>
      typename proto::result_of::as_expr< T const >::type as_expr(T const & t);
    template<typename Domain, typename T>
      typename proto::result_of::as_expr< T, Domain >::type as_expr(T & t);
    template<typename Domain, typename T>
      typename proto::result_of::as_expr< T const, Domain >::type
      as_expr(T const & t);

## Description

The `proto::as_expr()` function returns Proto expression objects that are suitable for storage in a local variable. It turns non-Proto objects into Proto terminals. Its behavior is domain-specific. By default, non-Proto types are wrapped by value (if possible) in a new Proto terminal expression, and objects that are already Proto expressions are returned by value.

If `Domain` is not explicitly specified, it is assumed to be ``proto::default_domain``.

See ``proto::domain::as_expr`<>` for a complete description of this function's default behavior.

Returns: | `typename Domain::template as_expr< T >()(t)`