Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r62829 - in trunk/libs/proto/doc: . reference reference/concepts
From: eric_at_[hidden]
Date: 2010-06-12 00:36:29


Author: eric_niebler
Date: 2010-06-12 00:36:24 EDT (Sat, 12 Jun 2010)
New Revision: 62829
URL: http://svn.boost.org/trac/boost/changeset/62829

Log:
document new domain-specific as_expr and as_child customization points
Text files modified:
   trunk/libs/proto/doc/reference.xml | 10 +
   trunk/libs/proto/doc/reference/concepts/Domain.xml | 84 ++++++++++++++++
   trunk/libs/proto/doc/reference/domain.xml | 206 +++++++++++++++++++++++++++++++--------
   trunk/libs/proto/doc/reference/generate.xml | 48 ++++++++
   trunk/libs/proto/doc/reference/traits.xml | 131 ++++++++++++-------------
   5 files changed, 368 insertions(+), 111 deletions(-)

Modified: trunk/libs/proto/doc/reference.xml
==============================================================================
--- trunk/libs/proto/doc/reference.xml (original)
+++ trunk/libs/proto/doc/reference.xml 2010-06-12 00:36:24 EDT (Sat, 12 Jun 2010)
@@ -222,6 +222,16 @@
       </listitem>
       <listitem>
         <computeroutput>
+ <classname alt="boost::proto::domain::as_child">proto::domain::as_child</classname>
+ </computeroutput>
+ </listitem>
+ <listitem>
+ <computeroutput>
+ <classname alt="boost::proto::domain::as_expr">proto::domain::as_expr</classname>
+ </computeroutput>
+ </listitem>
+ <listitem>
+ <computeroutput>
           <classname alt="boost::proto::domain_of">proto::domain_of</classname>
         </computeroutput>
       </listitem>

Modified: trunk/libs/proto/doc/reference/concepts/Domain.xml
==============================================================================
--- trunk/libs/proto/doc/reference/concepts/Domain.xml (original)
+++ trunk/libs/proto/doc/reference/concepts/Domain.xml 2010-06-12 00:36:24 EDT (Sat, 12 Jun 2010)
@@ -9,6 +9,7 @@
   -->
   <param name="Domain" role="domain-type" />
   <param name="Expr" role="expression-type" />
+ <param name="Object" role="object-type" />
 
   <models-sentence>
     The type <arg num="1" /> must be a model of <self/>. It also
@@ -41,6 +42,12 @@
     </sample-value>
   </notation>
 
+ <notation variables="o">
+ <sample-value>
+ <type name="Object" />
+ </sample-value>
+ </notation>
+
   <associated-type name="proto_grammar">
     <get-member-type name="proto_grammar">
       <type name="Domain"/>
@@ -89,11 +96,50 @@
         the specified expression type. The result is required to
         model <conceptname>Expr</conceptname>. The domain type
         associated with <computeroutput>result_type</computeroutput>
+ (<computeroutput>result_type::proto_domain</computeroutput>)
         is required to be the same type as this Domain.
       </simpara>
     </description>
   </associated-type>
 
+ <associated-type name="as_expr_result_type">
+ <get-member-type name="result_type">
+ <apply-template name="Domain::as_expr">
+ <type name="Object"/>
+ </apply-template>
+ </get-member-type>
+ <description>
+ <simpara>
+ The result of converting some type to a Proto expression
+ type in this domain. This is used, for instance, when
+ calculating the type of a variable to hold a Proto
+ expression.
+ <computeroutput>as_expr_result_type</computeroutput>
+ models
+ <computeroutput><conceptname>Expr</conceptname></computeroutput>.
+ </simpara>
+ </description>
+ </associated-type>
+
+ <associated-type name="as_child_result_type">
+ <get-member-type name="result_type">
+ <apply-template name="Domain::as_child">
+ <type name="Object"/>
+ </apply-template>
+ </get-member-type>
+ <description>
+ <simpara>
+ The result of converting some type to a Proto expression
+ type in this domain. This is used, for instance, to
+ compute the type of an object suitable for storage
+ as a child in an expression tree.
+ <computeroutput>as_child_result_type</computeroutput>
+ models
+ <computeroutput><conceptname>Expr</conceptname></computeroutput>.
+ </simpara>
+ </description>
+ </associated-type>
+
   <valid-expression name="Apply Generator">
     <apply-function name="d">
       <sample-value>
@@ -111,6 +157,44 @@
     </semantics>
   </valid-expression>
 
+ <valid-expression name="As Expression">
+ <apply-function name="Domain::as_expr&lt; Object &gt;()">
+ <sample-value>
+ <type name="Object"/>
+ </sample-value>
+ </apply-function>
+ <return-type>
+ <require-same-type testable="yes">
+ <type name="as_expr_result_type"/>
+ </require-same-type>
+ </return-type>
+ <semantics>
+ The result of converting some object to a Proto expression
+ in this domain. It returns a Proto expression object that
+ is suitable for storage in a variable. It should return a
+ new object, which may be a copy of the object passed in.
+ </semantics>
+ </valid-expression>
+
+ <valid-expression name="As Child">
+ <apply-function name="Domain::as_child&lt; Object &gt;()">
+ <sample-value>
+ <type name="Object"/>
+ </sample-value>
+ </apply-function>
+ <return-type>
+ <require-same-type testable="yes">
+ <type name="as_child_result_type"/>
+ </require-same-type>
+ </return-type>
+ <semantics>
+ The result of converting some object to a Proto expression
+ in this domain. It returns an object suitable for storage
+ as a child in an expression tree, which may simply be a
+ reference to the object passed in.
+ </semantics>
+ </valid-expression>
+
   <example-model>
     <type name="boost::proto::default_domain" />
   </example-model>

Modified: trunk/libs/proto/doc/reference/domain.xml
==============================================================================
--- trunk/libs/proto/doc/reference/domain.xml (original)
+++ trunk/libs/proto/doc/reference/domain.xml 2010-06-12 00:36:24 EDT (Sat, 12 Jun 2010)
@@ -1,9 +1,9 @@
 ï»¿<?xml version="1.0" encoding="utf-8"?>
 <header name="boost/proto/domain.hpp">
   <para>
- Contains definition of <computeroutput><classname alt="boost::proto::domain">proto::domain&lt;&gt;</classname>
- </computeroutput> class template and helpers for defining domains with a generator and a grammar for controlling
- operator overloading.
+ Contains definition of the <computeroutput><classname alt="boost::proto::domain">proto::domain&lt;&gt;</classname>
+ </computeroutput> class template and helpers for defining domains with a generator for customizing expression
+ construction and a grammar for controlling operator overloading.
   </para>
   <namespace name="boost">
     <namespace name="proto">
@@ -27,22 +27,25 @@
           <computeroutput><macroname>BOOST_PROTO_EXTENDS</macroname>()</computeroutput> and
           <computeroutput><macroname>BOOST_PROTO_DEFINE_OPERATORS</macroname>()</computeroutput>.
           A <emphasis>domain</emphasis> associates an expression type with a <emphasis>generator</emphasis>,
- and optionally a <emphasis>grammar</emphasis>.
+ and optionally a <emphasis>grammar</emphasis>. It may also have a super-domain. Expressions
+ in a sub-domain are interoperable (i.e. can be combined freely with) expressions in a
+ super-domain. Finally, domains control how non-Proto objects are turned into Proto
+ expressions and how they are combined to form larger Proto expressions.
         </purpose>
         <description>
           <para>
- The Generator determines how new expressions in the domain are constructed. Typically, a generator
+ The Generator parameter determines how new expressions in the domain are post-processed. Typically, a generator
             wraps all new expressions in a wrapper that imparts domain-specific behaviors to expressions within
             its domain. (See <computeroutput><classname alt="proto::extends">proto::extends&lt;&gt;</classname></computeroutput>.)
           </para>
           <para>
- The Grammar determines whether a given expression is valid within the domain, and automatically
+ The Grammar parameter determines whether a given expression is valid within the domain, and automatically
             disables any operator overloads which would cause an invalid expression to be created. By default,
             the Grammar parameter defaults to the wildcard, <computeroutput><classname>proto::_</classname>
             </computeroutput>, which makes all expressions valid within the domain.
           </para>
           <para>
- The Super declares the domain currently being defined to be a sub-domain of Super. An expression in
+ The Super parameter declares the domain currently being defined to be a sub-domain of Super. An expression in
             a sub-domain can be freely combined with expressions in its super-domain (and <emphasis>its</emphasis>
             super-domain, etc.).
           </para>
@@ -70,6 +73,14 @@
  };
             </programlisting>
           </para>
+ <para>
+ The <computeroutput><classname>domain::as_expr</classname>&lt;&gt;</computeroutput> and
+ <computeroutput><classname>domain::as_child</classname>&lt;&gt;</computeroutput> member
+ templates define how non-Proto objects are turned into Proto terminals and how Proto
+ expressions should be processed before they are combined to form larger expressions.
+ They can be overridden in a derived domain for customization. See their descriptions to
+ understand how Proto uses these two templates and what their default behavior is.
+ </para>
         </description>
         <typedef name="proto_grammar">
           <type>Grammar</type>
@@ -80,6 +91,151 @@
         <typedef name="proto_super_domain">
           <type>Super</type>
         </typedef>
+
+ <struct name="as_expr">
+ <template>
+ <template-type-parameter name="T"/>
+ </template>
+ <inherit><type><classname>proto::callable</classname></type></inherit>
+ <purpose>
+ A callable unary MonomorphicFunctionObject that specifies how objects are turned into
+ Proto expressions in this domain. The resulting expression object is suitable for storage
+ in a local variable.
+ </purpose>
+ <description>
+ <para>
+ A unary MonomorphicFunctionObject that specifies how objects are turned into Proto
+ expressions in this domain. The resulting expression object is suitable for storage
+ in a local variable. In that scenario, it is usually preferable to return
+ expressions by value; and, in the case of objects that are not yet Proto expressions,
+ to wrap they by value (if possible) in a new Proto terminal expression. (Contrast
+ this description with the description for
+ <computeroutput><classname>proto::domain::as_child</classname></computeroutput>.)
+ </para>
+ <para>
+ The <computeroutput>as_expr</computeroutput> function object turns objects into
+ Proto expressions, if they are not already, by making them Proto terminals held by
+ value if possible. Objects that are already Proto expressions are simply returned
+ by value. If
+ <computeroutput>wants_basic_expr&lt;Generator&gt;::value</computeroutput> is true,
+ then let <emphasis>E</emphasis> be
+ <computeroutput><classname>proto::basic_expr</classname></computeroutput>;
+ otherwise, let <emphasis>E</emphasis> be
+ <computeroutput><classname>proto::expr</classname></computeroutput>.
+ Given an lvalue <computeroutput>t</computeroutput> of type
+ <computeroutput>T</computeroutput>:
+ <itemizedlist>
+ <listitem>
+ If <computeroutput>T</computeroutput> is not a Proto expression type the resulting
+ terminal is calculated as follows:
+ <itemizedlist>
+ <listitem>
+ If <computeroutput>T</computeroutput> is a function type, an abstract type, or
+ a type derived from <computeroutput>std::ios_base</computeroutput>, let
+ <replaceable>A</replaceable> be <computeroutput>T &amp;</computeroutput>.
+ </listitem>
+ <listitem>
+ Otherwise, let <replaceable>A</replaceable> be the type
+ <computeroutput>T</computeroutput> stripped of cv-qualifiers.
+ </listitem>
+ </itemizedlist>
+ Then, the result of <computeroutput>as_expr&lt;T&gt;()(t)</computeroutput> is
+ <computeroutput>Generator()(<replaceable>E</replaceable>&lt;tag::terminal,
+ term&lt; <replaceable>A</replaceable> &gt; &gt;::make(t))</computeroutput>.
+ </listitem>
+ <listitem>
+ If <computeroutput>T</computeroutput> is a Proto expression type and its generator
+ type is different from <computeroutput>Generator</computeroutput>, the result is
+ <computeroutput>Generator()(t)</computeroutput>.
+ </listitem>
+ <listitem>
+ Otherwise, the result is <computeroutput>t</computeroutput> converted to an
+ (un-const) rvalue.
+ </listitem>
+ </itemizedlist>
+ </para>
+ </description>
+ <typedef name="result_type">
+ <type><replaceable>see-below</replaceable></type>
+ </typedef>
+ <method-group name="public member functions">
+ <method name="operator()" cv="const">
+ <type>result_type</type>
+ <parameter name="t">
+ <paramtype>T &amp;</paramtype>
+ <description>
+ <para>The object to wrap.</para>
+ </description>
+ </parameter>
+ </method>
+ </method-group>
+ </struct>
+
+ <struct name="as_child">
+ <template>
+ <template-type-parameter name="T"/>
+ </template>
+ <inherit><type><classname>proto::callable</classname></type></inherit>
+ <purpose>
+ 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.
+ </purpose>
+ <description>
+ <para>
+ 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
+ <computeroutput><classname>proto::domain::as_expr</classname></computeroutput>.)
+ </para>
+ <para>
+ The <computeroutput>as_child</computeroutput> 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
+ <computeroutput>wants_basic_expr&lt;Generator&gt;::value</computeroutput> is true,
+ then let <emphasis>E</emphasis> be
+ <computeroutput><classname>proto::basic_expr</classname></computeroutput>;
+ otherwise, let <emphasis>E</emphasis> be
+ <computeroutput><classname>proto::expr</classname></computeroutput>.
+ Given an lvalue <computeroutput>t</computeroutput> of type
+ <computeroutput>T</computeroutput>:
+ <itemizedlist>
+ <listitem>
+ If <computeroutput>T</computeroutput> is not a Proto expression type the resulting
+ terminal is
+ <computeroutput>Generator()(<replaceable>E</replaceable>&lt;tag::terminal,
+ term&lt; <computeroutput>T &amp;</computeroutput> &gt; &gt;::make(t))</computeroutput>.
+ </listitem>
+ <listitem>
+ If <computeroutput>T</computeroutput> is a Proto expression type and its generator
+ type is different from <computeroutput>Generator</computeroutput>, the result is
+ <computeroutput>Generator()(t)</computeroutput>.
+ </listitem>
+ <listitem>
+ Otherwise, the result is the lvalue <computeroutput>t</computeroutput>.
+ </listitem>
+ </itemizedlist>
+ </para>
+ </description>
+ <typedef name="result_type">
+ <type><replaceable>see-below</replaceable></type>
+ </typedef>
+ <method-group name="public member functions">
+ <method name="operator()" cv="const">
+ <type>result_type</type>
+ <parameter name="t">
+ <paramtype>T &amp;</paramtype>
+ <description>
+ <para>The object to wrap.</para>
+ </description>
+ </parameter>
+ </method>
+ </method-group>
+ </struct>
       </struct>
 
       <!-- proto::default_domain -->
@@ -132,41 +288,7 @@
         </typedef>
       </struct>
 
- <!-- proto::use_basic_expr -->
- <struct name="use_basic_expr">
- <template>
- <template-type-parameter name="Domain"/>
- </template>
- <description>
- <para>
- Annotate a domain to indicate that its generator would
- prefer to be passed instances of
- <computeroutput><classname>proto::basic_expr</classname>&lt;&gt;</computeroutput> rather than
- <computeroutput><classname>proto::expr</classname>&lt;&gt;</computeroutput>.
- <computeroutput>use_basic_expr&lt; Domain &gt;</computeroutput> is itself a domain.
- </para>
- </description>
- </struct>
-
- <!-- proto::wants_basic_expr -->
- <struct name="wants_basic_expr">
- <template>
- <template-type-parameter name="Domain"/>
- </template>
- <description>
- <para>
- A Boolean metafunction that tests a domain to see whether
- its generator would prefer to be passed instances of
- <computeroutput><classname>proto::basic_expr</classname>&lt;&gt;</computeroutput> rather than
- <computeroutput><classname>proto::expr</classname>&lt;&gt;</computeroutput>.
- </para>
- </description>
- <inherit>
- <type>mpl::bool_&lt; <replaceable>true-or-false</replaceable> &gt;</type>
- </inherit>
- </struct>
-
- <!-- proto::wants_basic_expr -->
+ <!-- proto::base_expr -->
       <struct name="base_expr">
         <template>
           <template-type-parameter name="Domain"/>

Modified: trunk/libs/proto/doc/reference/generate.xml
==============================================================================
--- trunk/libs/proto/doc/reference/generate.xml (original)
+++ trunk/libs/proto/doc/reference/generate.xml 2010-06-12 00:36:24 EDT (Sat, 12 Jun 2010)
@@ -1,7 +1,11 @@
 ï»¿<?xml version="1.0" encoding="utf-8"?>
 <header name="boost/proto/generate.hpp">
- <para>Contains definition of <computeroutput><classname alt="boost::proto::generator">proto::generator&lt;&gt;</classname></computeroutput>
- class template and friends that end users can use to generate domain-specific expression wrappers.</para>
+ <para>Contains definition of
+ <computeroutput><classname alt="boost::proto::default_generator">proto::default_generator</classname></computeroutput>,
+ <computeroutput><classname alt="boost::proto::generator">proto::generator</classname>&lt;&gt;</computeroutput>,
+ <computeroutput><classname alt="boost::proto::pod_generator">proto::pod_generator</classname>&lt;&gt;</computeroutput>
+ and other utilities that users can use to post-process new expression objects that
+ Proto creates.</para>
   <namespace name="boost">
     <namespace name="proto">
       <!-- proto::default_generator -->
@@ -259,6 +263,46 @@
           </method>
         </method-group>
       </struct>
+
+ <!-- proto::use_basic_expr -->
+ <struct name="use_basic_expr">
+ <template>
+ <template-type-parameter name="Generator"/>
+ </template>
+ <inherit>
+ <type>Generator</type>
+ </inherit>
+ <description>
+ <para>
+ Annotate a generator to indicate that it would
+ prefer to be passed instances of
+ <computeroutput><classname>proto::basic_expr</classname>&lt;&gt;</computeroutput> rather than
+ <computeroutput><classname>proto::expr</classname>&lt;&gt;</computeroutput>.
+ </para>
+ <para>
+ <computeroutput>use_basic_expr&lt; Generator &gt;</computeroutput> is itself a generator.
+ </para>
+ </description>
+ </struct>
+
+ <!-- proto::wants_basic_expr -->
+ <struct name="wants_basic_expr">
+ <template>
+ <template-type-parameter name="Generator"/>
+ </template>
+ <inherit>
+ <type>mpl::bool_&lt; <replaceable>true-or-false</replaceable> &gt;</type>
+ </inherit>
+ <description>
+ <para>
+ A Boolean metafunction that tests a generator to see whether
+ it would prefer to be passed instances of
+ <computeroutput><classname>proto::basic_expr</classname>&lt;&gt;</computeroutput> rather than
+ <computeroutput><classname>proto::expr</classname>&lt;&gt;</computeroutput>.
+ </para>
+ </description>
+ </struct>
+
     </namespace>
   </namespace>
 </header>

Modified: trunk/libs/proto/doc/reference/traits.xml
==============================================================================
--- trunk/libs/proto/doc/reference/traits.xml (original)
+++ trunk/libs/proto/doc/reference/traits.xml 2010-06-12 00:36:24 EDT (Sat, 12 Jun 2010)
@@ -1,6 +1,19 @@
 ï»¿<?xml version="1.0" encoding="utf-8"?>
 <header name="boost/proto/traits.hpp">
- <para>Contains definitions for child&lt;&gt;, child_c&lt;&gt;, left&lt;&gt;, right&lt;&gt;, tag_of&lt;&gt;, and the helper functions child(), child_c(), value(), left() and right(). </para>
+ <para>
+ Contains definitions for various expression traits and utilities like
+ <computeroutput><classname alt="boost::proto::tag_of">proto::tag_of</classname>&lt;&gt;</computeroutput> and
+ <computeroutput><classname alt="boost::proto::arity_of">proto::arity_of</classname>&lt;&gt;</computeroutput>;
+ the functions
+ <computeroutput><functionname alt="boost::proto::value">proto::value</functionname>()</computeroutput>,
+ <computeroutput><functionname alt="boost::proto::left">proto::left</functionname>()</computeroutput> and
+ <computeroutput><functionname alt="boost::proto::right">proto::right</functionname>()</computeroutput>;
+ <computeroutput><functionname alt="boost::proto::child">proto::child</functionname>()</computeroutput>,
+ <computeroutput><functionname alt="boost::proto::child_c">proto::child_c</functionname>()</computeroutput>,
+ <computeroutput><functionname alt="boost::proto::as_expr">proto::as_expr</functionname>()</computeroutput>,
+ <computeroutput><functionname alt="boost::proto::as_child">proto::as_child</functionname>()</computeroutput>,
+ and assorted helpers.
+ </para>
   <namespace name="boost">
     <namespace name="proto">
       <struct name="is_callable">
@@ -97,7 +110,7 @@
             <specialization>
               <template-arg>This(T)</template-arg>
             </specialization>
- <inherit><type><classname>proto::result_of::as_expr</classname>&lt; T, Domain &gt;</type></inherit>
+ <inherit><type><classname>proto::result_of::as_expr</classname>&lt; typename remove_reference&lt; T &gt;::type, Domain &gt;</type></inherit>
           </struct-specialization>
           <method-group name="public member functions">
             <method name="operator()" cv="const">
@@ -156,7 +169,7 @@
             <specialization>
               <template-arg>This(T)</template-arg>
             </specialization>
- <inherit><type><classname>proto::result_of::as_child</classname>&lt; T, Domain &gt;</type></inherit>
+ <inherit><type><classname>proto::result_of::as_child</classname>&lt; typename remove_reference&lt; T &gt;::type, Domain &gt;</type></inherit>
           </struct-specialization>
           <method-group name="public member functions">
             <method name="operator()" cv="const">
@@ -2087,27 +2100,21 @@
             </template-type-parameter>
           </template>
           <purpose>A metafunction that computes the return type of the
- <computeroutput><functionname alt="proto::as_expr">proto::as_expr()</functionname></computeroutput> function.</purpose>
+ <computeroutput><functionname>proto::as_expr</functionname>()</computeroutput> function.</purpose>
           <description>
             <para>
- The <computeroutput>proto::result_of::as_expr&lt;&gt;</computeroutput> metafunction turns types into Proto types if they are
- not already, by making them Proto terminals held by value if possible. Types which are already Proto types are
- left alone.
+ The <computeroutput>proto::result_of::as_expr&lt;&gt;</computeroutput> metafunction turns types
+ into Proto expression types, if they are not already, in a domain-specific way. It is intended
+ for use to compute the type of a local variable that can hold the result of the
+ <computeroutput><functionname>proto::as_expr</functionname>()</computeroutput> function.
             </para>
             <para>
- If <computeroutput>T</computeroutput> is not yet a Proto type, the resulting terminal type is calculated
- as follows:
- </para>
- <para>
- If <computeroutput>T</computeroutput> is a function type, let
- <computeroutput>A</computeroutput> be <computeroutput>T &amp;</computeroutput>. Otherwise, let
- <computeroutput>A</computeroutput> be the type <computeroutput>T</computeroutput> stripped of
- cv-qualifiers. Then, the result type <computeroutput>proto::result_of::as_expr&lt;T, Domain&gt;::type</computeroutput>
- is <computeroutput>boost::result_of&lt;Domain(typename <classname>proto::base_expr</classname>&lt;Domain, <classname>proto::tag::terminal</classname>, <classname>proto::term</classname>&lt;A&gt; &gt;::type)&gt;::type</computeroutput>.
+ See <computeroutput><classname>proto::domain::as_expr</classname>&lt;&gt;</computeroutput>
+ for a complete description of the default behavior.
             </para>
           </description>
           <typedef name="type">
- <type><replaceable>see-below</replaceable></type>
+ <type>typename Domain::template as_expr&lt; T &gt;::result_type</type>
           </typedef>
         </struct>
 
@@ -2119,26 +2126,20 @@
             </template-type-parameter>
           </template>
           <purpose>A metafunction that computes the return type of the
- <computeroutput><functionname alt="proto::as_child">proto::as_child()</functionname></computeroutput> function.</purpose>
+ <computeroutput><functionname>proto::as_child</functionname>()</computeroutput> function.</purpose>
           <description>
             <para>
- The <computeroutput>proto::result_of::as_child&lt;&gt;</computeroutput> metafunction turns types into Proto types
- if they are not already by making them Proto terminals held by reference. Types which are already Proto
- types are left alone.
- </para>
- <para>
- When <computeroutput>T</computeroutput> is not yet a Proto type,
- the result type <computeroutput>proto::result_of::as_child&lt;T, Domain&gt;::type</computeroutput> is
- <computeroutput>boost::result_of&lt;Domain(typename <classname>proto::base_expr</classname>&lt;Domain, <classname>proto::tag::terminal</classname>, <classname>proto::term</classname>&lt;T &amp;&gt; &gt;::type)&gt;::type</computeroutput>.
+ The <computeroutput>proto::result_of::as_child&lt;&gt;</computeroutput> metafunction turns types
+ into Proto expression types, if they are not already, in a domain-specific way. It is used by Proto
+ to compute the type of an object to store as a child in another expression node.
             </para>
             <para>
- When <computeroutput>T</computeroutput> is already a Proto type
- The result type <computeroutput>proto::result_of::as_child&lt;T, Domain&gt;::type</computeroutput> is
- <computeroutput>T &amp;</computeroutput>.
+ See <computeroutput><classname>proto::domain::as_child</classname>&lt;&gt;</computeroutput>
+ for a complete description of the default behavior.
             </para>
           </description>
           <typedef name="type">
- <type><replaceable>see-below</replaceable></type>
+ <type>typename Domain::template as_child&lt; T &gt;::result_type</type>
           </typedef>
         </struct>
 
@@ -2472,28 +2473,24 @@
           expression types alone.</purpose>
         <description>
           <para>
- The <computeroutput>proto::as_expr()</computeroutput> function turns objects into Proto terminals if they
- are not Proto expression types already. Non-Proto types are held by value, if possible. Types which are
- already Proto types are left alone.
- </para>
- <para>
- This function can be called either with an explicitly specified
- <computeroutput>Domain</computeroutput> parameter
- (i.e., <computeroutput>proto::as_expr&lt;Domain&gt;(t)</computeroutput>), or without
- (i.e., <computeroutput>proto::as_expr(t)</computeroutput>). If no domain is specified,
- <computeroutput><classname>proto::default_domain</classname></computeroutput> is assumed.
- </para>
- <para>
- If <computeroutput><classname>proto::is_expr</classname>&lt;T&gt;::value</computeroutput> is
- <computeroutput>true</computeroutput>, then the argument is returned unmodified. Otherwise,
- the argument is wrapped in a Proto terminal expression node according to the following rules.
- If <computeroutput>T</computeroutput> is a function type, let
- <computeroutput>A</computeroutput> be <computeroutput>T &amp;</computeroutput>. Otherwise, let
- <computeroutput>A</computeroutput> be the type <computeroutput>T</computeroutput> stripped of
- cv-qualifiers. Then, <computeroutput>proto::as_expr()</computeroutput> returns
- <computeroutput>Domain()(<classname>proto::terminal</classname>&lt;A&gt;::type::make(t))</computeroutput>.
+ The <computeroutput>proto::as_expr()</computeroutput> 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.
+ </para>
+ <para>
+ If <computeroutput>Domain</computeroutput> is not explicitly specified, it is assumed to
+ be <computeroutput><classname>proto::default_domain</classname></computeroutput>.
+ </para>
+ <para>
+ See <computeroutput><classname>proto::domain::as_expr</classname>&lt;&gt;</computeroutput>
+ for a complete description of this function's default behavior.
           </para>
         </description>
+ <returns>
+ <computeroutput>typename Domain::template as_expr&lt; T &gt;()(t)</computeroutput>
+ </returns>
       </overloaded-function>
       
       <overloaded-function name="as_child">
@@ -2535,28 +2532,28 @@
             <paramtype>T const &amp;</paramtype>
           </parameter>
         </signature>
- <purpose>A function that wraps non-Proto expression types in Proto terminals (by reference) and leaves
+ <purpose>A function that wraps non-Proto objects in Proto terminals (by reference) and leaves
           Proto expression types alone.</purpose>
         <description>
           <para>
- The <computeroutput>proto::as_child()</computeroutput> 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.
- </para>
- <para>
- This function can be called either with an explicitly specified
- <computeroutput>Domain</computeroutput> parameter
- (i.e., <computeroutput>proto::as_child&lt;Domain&gt;(t)</computeroutput>), or without
- (i.e., <computeroutput>proto::as_child(t)</computeroutput>). If no domain is specified,
- <computeroutput><classname>proto::default_domain</classname></computeroutput> is assumed.
- </para>
- <para>
- If <computeroutput><classname>proto::is_expr</classname>&lt;T&gt;::value</computeroutput> is
- <computeroutput>true</computeroutput>, then the argument is returned as-is. Otherwise,
- <computeroutput>proto::as_child()</computeroutput> returns
- <computeroutput>Domain()(<classname>proto::terminal</classname>&lt;T &amp;&gt;::type::make(t))</computeroutput>.
+ The <computeroutput>proto::as_child()</computeroutput> function returns Proto expression
+ objects that are suitable for storage as child nodes in an expression tree. It turns
+ non-Proto objects into Proto terminals. Its behavior is domain-specific. By default,
+ non-Proto types are held wrapped by reference in a new Proto terminal expression, and
+ objects that are already Proto expressions are simply returned by reference.
+ </para>
+ <para>
+ If <computeroutput>Domain</computeroutput> is not explicitly specified, it is assumed to
+ be <computeroutput><classname>proto::default_domain</classname></computeroutput>.
+ </para>
+ <para>
+ See <computeroutput><classname>proto::domain::as_child</classname>&lt;&gt;</computeroutput>
+ for a complete description of this function's default behavior.
           </para>
         </description>
+ <returns>
+ <computeroutput>typename Domain::template as_child&lt; T &gt;()(t)</computeroutput>
+ </returns>
       </overloaded-function>
 
       <overloaded-function name="child">


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk