...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::proto::as_child — A function that wraps non-Proto expression types in Proto terminals (by reference) and leaves Proto expression types alone.
// In header: <boost/proto/traits.hpp> template<typename T> typename proto::result_of::as_child< T >::type as_child(T & t); template<typename T> typename proto::result_of::as_child< T const >::type as_child(T const & t); template<typename Domain, typename T> typename proto::result_of::as_child< T, Domain >::type as_child(T & t); template<typename Domain, typename T> typename proto::result_of::as_child< T const, Domain >::type as_child(T const & t);
The proto::as_child()
function turns objects into Proto terminals
if they are not Proto expression types already. Non-Proto types are held by reference. Types which
are already Proto types are simply returned as-is.
This function can be called either with an explicitly specified
Domain
parameter
(i.e., proto::as_child<Domain>(t)
), or without
(i.e., proto::as_child(t)
). If no domain is specified,
is assumed.
proto::default_domain
If
is
proto::is_expr
<T>::valuetrue
, then the argument is returned as-is. Otherwise,
proto::as_child()
returns
Domain()(
.
proto::terminal
<T &>::type::make(t))