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

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)

PrevUpHomeNext