...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::deduce_domain — A pseudo-domain for use in functions and metafunctions that require a domain parameter. It indicates that the domain of the parent node should be inferred from the domains of the child nodes.
// In header: <boost/proto/domain.hpp> struct deduce_domain { };
When proto::deduce_domain
is used as a domain — either
explicitly or implicitly by
proto::make_expr()
,
proto::unpack_expr()
,
or Proto's operator overloads — Proto will use the domains of the child expressions to
compute the domain of the parent. It is done in such a way that (A) expressions in domains
that share a common super-domain are interoperable, and (B) expressions that are in
the default domain (or a sub-domain thereof) are interoperable with all
expressions. The rules are as follows:
proto::default_domain
,
proto::basic_default_domain
and all their sub-domains are weaker than all other domains.
proto::basic_default_domain
is weaker than
proto::default_domain
.
proto::default_domain
or
proto::basic_default_domain
.
proto::default_domain
or
proto::basic_default_domain
.
proto::default_domain
or
proto::basic_default_domain
and U contains an element that is not proto::default_domain
or
proto::basic_default_domain
,
it is an error.
Note: the above description sounds like it would be expensive to compute at compile time. In fact, it can all be done using C++ function overloading.