| Home | Libraries | People | FAQ | More

## Function as_child

boost::proto::as_child — A function that wraps non-Proto expression types in Proto terminals (by reference) and leaves Proto expression types alone.

## Synopsis

    // 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);

## Description

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, ``proto::default_domain`` is assumed.

If ``proto::is_expr`<T>::value` is `true`, then the argument is returned as-is. Otherwise, `proto::as_child()` returns `Domain()(`proto::terminal`<T &>::type::make(t))`.