Home | Libraries | People | FAQ | More |
boost::proto::domain::as_child — A callable unary MonomorphicFunctionObject that specifies how objects are turned into Proto expressions in this domain, for use in scenarios where the resulting expression is intended to be made a child of another expression.
// In header: <boost/proto/domain.hpp>
// A callable unary MonomorphicFunctionObject that specifies how objects are
// turned into Proto expressions in this domain, for use in scenarios where
// the resulting expression is intended to be made a child of another
// expression.
template<typename T>
struct as_child : proto::callable {
// types
typedef see-below
result_type;
// public member functions
result_type operator()(T &) const;
};
A unary MonomorphicFunctionObject that specifies how objects are turned into Proto
expressions in this domain. The resulting expression object is suitable for storage
as a child of another expression. In that scenario, it is usually
preferable to store child expressions by reference; or, in the case of objects that
are not yet Proto expressions, to wrap them by reference in a new Proto terminal
expression. (Contrast this description with the description for
proto::domain::as_expr
.)
The as_child
function object turns objects into
Proto expressions, if they are not already, by making them Proto terminals held by
reference. Objects that are already Proto expressions are simply returned by
reference. If
wants_basic_expr<Generator>::value
is true,
then let E be
proto::basic_expr
;
otherwise, let E be
proto::expr
.
Given an lvalue t
of type
T
:
T
is not a Proto expression type, the resulting
terminal is
Generator()(E
<tag::terminal,
term< T &
> >::make(t))
.
t
.