|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r68222 - in sandbox/SOC/2010/phoenix3: boost/phoenix/core boost/phoenix/scope libs/phoenix/doc libs/phoenix/doc/html libs/phoenix/doc/html/phoenix libs/phoenix/doc/html/phoenix/reference libs/phoenix/doc/html/phoenix/starter_kit
From: thom.heller_at_[hidden]
Date: 2011-01-18 04:13:41
Author: theller
Date: 2011-01-18 04:13:32 EST (Tue, 18 Jan 2011)
New Revision: 68222
URL: http://svn.boost.org/trac/boost/changeset/68222
Log:
documentation work
Text files modified:
sandbox/SOC/2010/phoenix3/boost/phoenix/core/argument.hpp | 65 +++++++++++++++-------
sandbox/SOC/2010/phoenix3/boost/phoenix/core/reference.hpp | 43 +++++++++++---
sandbox/SOC/2010/phoenix3/boost/phoenix/core/terminal.hpp | 11 ---
sandbox/SOC/2010/phoenix3/boost/phoenix/core/value.hpp | 4
sandbox/SOC/2010/phoenix3/boost/phoenix/scope/local_variable.hpp | 4
sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/index.html | 14 ++--
sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/reference.html | 6 +-
sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/reference/the_language.html | 113 +++++++++++++++++++++++++++++++--------
sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/starter_kit.html | 2
sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/starter_kit/composites.html | 6 +-
sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/starter_kit/primitives.html | 4
sandbox/SOC/2010/phoenix3/libs/phoenix/doc/reference.qbk | 91 ++++++++++++++++++++++++++++---
12 files changed, 265 insertions(+), 98 deletions(-)
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/core/argument.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/core/argument.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/core/argument.hpp 2011-01-18 04:13:32 EST (Tue, 18 Jan 2011)
@@ -29,40 +29,59 @@
//
////////////////////////////////////////////////////////////////////////////
- template <typename I>
- struct argument
+ namespace detail
{
- typedef I type;
- typedef typename I::value_type value_type;
- static value_type const value = I::value;
-
- bool operator==(argument) const
- {
- return true;
- }
-
- template <typename I2>
- bool operator==(argument<I2>) const
+ template <int I>
+ struct argument
+ : mpl::int_<I>
{
- return false;
- }
- };
+ bool operator==(argument) const
+ {
+ return true;
+ }
+
+ template <int I2>
+ bool operator==(argument<I2>) const
+ {
+ return false;
+ }
+ };
+ }
}}
namespace boost {
- template <typename I>
- struct is_placeholder<phoenix::argument<I> >
- : I
+ template <int I>
+ struct is_placeholder<phoenix::detail::argument<I> >
+ : mpl::int_<I>
{};
}
namespace boost { namespace phoenix
{
+ namespace expression
+ {
+ template <int I>
+ struct argument
+ {
+ typedef
+ actor<
+ typename proto::terminal<detail::argument<I> >::type
+ >
+ type;
+
+ static const type make()
+ {
+ type const e = {};
+ return e;
+ }
+ };
+ }
+
#define BOOST_PHOENIX_ARGUMENT_N(_, N, name) \
- actor< \
- proto::terminal<argument<mpl::int_<BOOST_PP_INC(N)> > >::type \
- > const BOOST_PP_CAT(name, BOOST_PP_INC(N)) = {};
+ expression::argument<BOOST_PP_INC(N)>::type const \
+ BOOST_PP_CAT(name, BOOST_PP_INC(N)) = {}; \
+ /**/
namespace placeholders
{
@@ -75,6 +94,8 @@
BOOST_PP_REPEAT(PHOENIX_ARG_LIMIT, BOOST_PHOENIX_ARGUMENT_N, arg)
BOOST_PP_REPEAT(PHOENIX_ARG_LIMIT, BOOST_PHOENIX_ARGUMENT_N, _)
}
+
+ #undef BOOST_PHOENIX_ARGUMENT_N
}}
#endif
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/core/reference.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/core/reference.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/core/reference.hpp 2011-01-18 04:13:32 EST (Tue, 18 Jan 2011)
@@ -22,27 +22,48 @@
// function for evaluating references, e.g. ref(123)
//
/////////////////////////////////////////////////////////////////////////////
- template <typename T>
- struct reference
- : proto::terminal<reference_wrapper<T> >
+
+ namespace expression
{
- typedef actor<typename proto::terminal<reference_wrapper<T> >::type> type;
- };
+ template <typename T>
+ struct reference
+ : proto::terminal<reference_wrapper<T> >
+ {
+ typedef actor<typename proto::terminal<reference_wrapper<T> >::type> type;
+
+ static const type make(T & t)
+ {
+ typename reference<T>::type const e = {{boost::ref(t)}};
+ return e;
+ }
+ };
+
+ template <typename T>
+ struct reference<T const>
+ : proto::terminal<reference_wrapper<T const> >
+ {
+ typedef actor<typename proto::terminal<reference_wrapper<T const> >::type> type;
+
+ static const type make(T const & t)
+ {
+ typename reference<T const>::type const e = {{boost::cref(t)}};
+ return e;
+ }
+ };
+ }
template <typename T>
- typename reference<T>::type const
+ typename expression::reference<T>::type const
ref(T & t)
{
- typename reference<T>::type const e = {{boost::ref(t)}};
- return e;
+ return expression::reference<T>::make(t);
}
template <typename T>
- typename reference<T const>::type const
+ typename expression::reference<T const>::type const
cref(T const & t)
{
- typename reference<T const>::type const e = {{boost::cref(t)}};
- return e;
+ return expression::reference<T const>::make(t);
}
// Call out boost::reference_wrapper for special handling
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/core/terminal.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/core/terminal.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/core/terminal.hpp 2011-01-18 04:13:32 EST (Tue, 18 Jan 2011)
@@ -32,18 +32,8 @@
struct terminal
: proto::terminal<proto::_>
{};
-
- template <typename Grammar>
- struct expr::case_<proto::tag::terminal, Grammar>
- : proto::or_<
- proto::when<rule::argument , proto::external_transform>
- , proto::when<rule::custom_terminal, proto::external_transform>
- , proto::when<rule::terminal , proto::external_transform>
- >
- {};
}
- /*
template <typename Grammar>
struct meta_grammar::case_<proto::tag::terminal, Grammar>
: proto::or_<
@@ -52,7 +42,6 @@
, proto::when<rule::terminal , proto::external_transform>
>
{};
- */
template <typename Grammar>
struct default_actions::when<rule::custom_terminal, Grammar>
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/core/value.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/core/value.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/core/value.hpp 2011-01-18 04:13:32 EST (Tue, 18 Jan 2011)
@@ -30,7 +30,7 @@
{
typedef actor<typename proto::terminal<T>::type> type;
- static type make(T t)
+ static const type make(T t)
{
typename value<T>::type const e = {{t}};
return e;
@@ -43,7 +43,7 @@
{
typedef actor<typename proto::terminal<T* >::type> type;
- static type make(T t[N])
+ static const type make(T t[N])
{
typename value<T *>::type const e = {{t}};
return e;
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/scope/local_variable.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/scope/local_variable.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/scope/local_variable.hpp 2011-01-18 04:13:32 EST (Tue, 18 Jan 2011)
@@ -73,10 +73,10 @@
typedef
typename mpl::eval_if<
is_reference<result_type>
- , reference<
+ , expression::reference<
typename boost::remove_reference<result_type>::type
>
- , value<result_type>
+ , expression::value<result_type>
>::type
type;
};
Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/index.html
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/index.html (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/index.html 2011-01-18 04:13:32 EST (Tue, 18 Jan 2011)
@@ -27,7 +27,7 @@
</h3></div></div>
<div><p class="copyright">Copyright © 2002-2005, 2010 Joel de Guzman, Dan Marsden, Thomas Heller</p></div>
<div><div class="legalnotice">
-<a name="id567005"></a><p>
+<a name="id719206"></a><p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
</p>
@@ -48,7 +48,7 @@
</dl>
</div>
<a name="phoenix.preface"></a><h2>
-<a name="id597702"></a>
+<a name="id749903"></a>
<a class="link" href="index.html#phoenix.preface">Preface</a>
</h2>
<div class="blockquote"><blockquote class="blockquote"><p>
@@ -67,7 +67,7 @@
<span class="inlinemediaobject"><img src="images/lambda_cpp.png" alt="lambda_cpp"></span>
</p>
<a name="phoenix.description"></a><h3>
-<a name="id565812"></a>
+<a name="id718013"></a>
<a class="link" href="index.html#phoenix.description">Description</a>
</h3>
<p>
@@ -85,7 +85,7 @@
library is organized in highly independent modules and layers.
</p>
<a name="phoenix.how_to_use_this_manual"></a><h3>
-<a name="id565859"></a>
+<a name="id718060"></a>
<a class="link" href="index.html#phoenix.how_to_use_this_manual">How to use this manual</a>
</h3>
<p>
@@ -107,7 +107,7 @@
icons precede some text to indicate:
</p>
<div class="table">
-<a name="id565894"></a><p class="title"><b>Table 1.1. Icons</b></p>
+<a name="id718094"></a><p class="title"><b>Table 1.1. Icons</b></p>
<div class="table-contents"><table class="table" summary="Icons">
<colgroup>
<col>
@@ -196,12 +196,12 @@
</p>
</div>
<a name="phoenix._emphasis_role__bold___emphasis____to_my_dear_daughter__phoenix__emphasis___emphasis_"></a><h3>
-<a name="id606658"></a>
+<a name="id758858"></a>
<a class="link" href="index.html#phoenix._emphasis_role__bold___emphasis____to_my_dear_daughter__phoenix__emphasis___emphasis_"><span class="bold"><strong><span class="emphasis"><em>...To my dear daughter, Phoenix</em></span></strong></span></a>
</h3>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
-<td align="left"><p><small>Last revised: January 17, 2011 at 20:39:59 GMT</small></p></td>
+<td align="left"><p><small>Last revised: January 18, 2011 at 08:32:20 GMT</small></p></td>
<td align="right"><div class="copyright-footer"></div></td>
</tr></table>
<hr>
Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/reference.html
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/reference.html (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/reference.html 2011-01-18 04:13:32 EST (Tue, 18 Jan 2011)
@@ -79,7 +79,7 @@
</dl>
</div>
<a name="phoenix.reference.concepts"></a><h4>
-<a name="id609952"></a>
+<a name="id762153"></a>
<a class="link" href="reference.html#phoenix.reference.concepts">Concepts</a>
</h4>
<p>
@@ -87,14 +87,14 @@
their meanings consider the following definitions.
</p>
<a name="phoenix.reference.phoenix_actor"></a><h4>
-<a name="id609971"></a>
+<a name="id762172"></a>
<a class="link" href="reference.html#phoenix.reference.phoenix_actor">Phoenix Actor</a>
</h4>
<p>
A Phoenix Actor is the C++ Expression that is generated by the Phoenix Generators.
</p>
<a name="phoenix.reference.phoenix_generator"></a><h4>
-<a name="id609990"></a>
+<a name="id762190"></a>
<a class="link" href="reference.html#phoenix.reference.phoenix_generator">Phoenix Generator</a>
</h4>
<p>
Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/reference/the_language.html
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/reference/the_language.html (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/reference/the_language.html 2011-01-18 04:13:32 EST (Tue, 18 Jan 2011)
@@ -48,16 +48,57 @@
<span class="identifier">placeholder</span> <span class="special">:=</span> <span class="identifier">_1</span> <span class="special">|</span> <span class="identifier">_2</span> <span class="special">|</span> <span class="identifier">_3</span> <span class="special">|</span> <span class="special">...</span> <span class="special">|</span> <span class="identifier">_PHOENIX_ARG_LIMIT</span>
</pre>
+<p>
+ Terminals are the core building blocks. Phoenix, by default distinguishes
+ between 3 types of terminals:
+ </p>
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem">
+ Value Terminals
+ </li>
+<li class="listitem">
+ Reference Terminals
+ </li>
+<li class="listitem">
+ Placeholders
+ </li>
+</ol></div>
+<p>
+ The last two terminal types are handled by the terminal customization points.
+ </p>
<div class="section">
<div class="titlepage"><div><div><h5 class="title">
-<a name="phoenix.reference.the_language.terminal.blubb"></a><a class="link" href="the_language.html#phoenix.reference.the_language.terminal.blubb" title="Value">Value</a>
+<a name="phoenix.reference.the_language.terminal.value"></a><a class="link" href="the_language.html#phoenix.reference.the_language.terminal.value" title="Value">Value</a>
</h5></div></div></div>
<p>
- Values are one of the core building blocks of Phoenix.
+ Whenever we see a constant in a partially applied function, an
+ </p>
+<pre class="programlisting"><span class="identifier">expression</span><span class="special">::</span><span class="identifier">value</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">type</span>
+</pre>
+<p>
+ (where T is the type of the constant) is automatically created for us.
+ For instance:
</p>
-<a name="phoenix.reference.the_language.terminal.blubb.synopsis"></a><h6>
-<a name="id610289"></a>
- <a class="link" href="the_language.html#phoenix.reference.the_language.terminal.blubb.synopsis">Synopsis</a>
+<pre class="programlisting"><span class="identifier">add</span><span class="special">(</span><span class="identifier">arg1</span><span class="special">,</span> <span class="number">6</span><span class="special">)</span>
+</pre>
+<p>
+ Passing a second argument, <code class="computeroutput"><span class="number">6</span></code>,
+ an <code class="computeroutput"><span class="identifier">expression</span><span class="special">::</span><span class="identifier">value</span><span class="special"><</span><span class="keyword">int</span><span class="special">>::</span><span class="identifier">type</span></code> is implicitly created behind the
+ scenes. This is also equivalent to:
+ </p>
+<pre class="programlisting"><span class="identifier">add</span><span class="special">(</span><span class="identifier">arg1</span><span class="special">,</span> <span class="identifier">val</span><span class="special">(</span><span class="number">6</span><span class="special">))</span>
+</pre>
+<p>
+ <code class="computeroutput"><span class="identifier">val</span><span class="special">(</span><span class="identifier">x</span><span class="special">)</span></code>
+ generates an <code class="computeroutput"><span class="identifier">expression</span><span class="special">::</span><span class="identifier">value</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">type</span></code>
+ where <code class="computeroutput"><span class="identifier">T</span></code> is the type of
+ <code class="computeroutput"><span class="identifier">x</span></code>. In most cases, there's
+ no need to explicitly use <code class="computeroutput"><span class="identifier">val</span></code>,
+ but, as we'll see later on, there are situations where this is unavoidable.
+ </p>
+<a name="phoenix.reference.the_language.terminal.value.synopsis"></a><h6>
+<a name="id762763"></a>
+ <a class="link" href="the_language.html#phoenix.reference.the_language.terminal.value.synopsis">Synopsis</a>
</h6>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">expression</span>
<span class="special">{</span>
@@ -79,9 +120,11 @@
<span class="keyword">typename</span> <span class="identifier">expression</span><span class="special">::</span><span class="identifier">value</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">type</span>
<span class="identifier">val</span><span class="special">(</span><span class="identifier">T</span> <span class="identifier">t</span><span class="special">);</span>
</pre>
-<div class="table">
-<a name="id610579"></a><p class="title"><b>Table 1.2. Parameters</b></p>
-<div class="table-contents"><table class="table" summary="Parameters">
+<a name="phoenix.reference.the_language.terminal.value.parameters"></a><h6>
+<a name="id763058"></a>
+ <a class="link" href="the_language.html#phoenix.reference.the_language.terminal.value.parameters">Parameters</a>
+ </h6>
+<div class="informaltable"><table class="table">
<colgroup>
<col>
<col>
@@ -108,7 +151,7 @@
<tr>
<td>
<p>
- T
+ <code class="computeroutput"><span class="identifier">T</span></code>
</p>
</td>
<td>
@@ -125,7 +168,7 @@
<tr>
<td>
<p>
- t
+ <code class="computeroutput"><span class="identifier">t</span></code>
</p>
</td>
<td>
@@ -141,10 +184,9 @@
</tr>
</tbody>
</table></div>
-</div>
-<br class="table-break"><a name="phoenix.reference.the_language.terminal.blubb.expression_semantics"></a><h6>
-<a name="id610678"></a>
- <a class="link" href="the_language.html#phoenix.reference.the_language.terminal.blubb.expression_semantics">Expression
+<a name="phoenix.reference.the_language.terminal.value.expression_semantics"></a><h6>
+<a name="id763181"></a>
+ <a class="link" href="the_language.html#phoenix.reference.the_language.terminal.value.expression_semantics">Expression
Semantics</a>
</h6>
<pre class="programlisting"><span class="identifier">expression</span><span class="special">::</span><span class="identifier">value</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">type</span>
@@ -174,6 +216,15 @@
<p>
<span class="bold"><strong>Semantics</strong></span>: Calls <code class="computeroutput"><span class="identifier">expression</span><span class="special">::</span><span class="identifier">value</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">make</span><span class="special">(</span><span class="identifier">t</span><span class="special">)</span></code>, Automatically deduces type T
</p>
+<p>
+ [header Header] #include <boost/phoenix/core/value.hpp>
+ </p>
+<p>
+ [header Example]
+ </p>
+<p>
+ TODO
+ </p>
</div>
<div class="section">
<div class="titlepage"><div><div><h5 class="title">
@@ -183,7 +234,7 @@
References are one of the core building blocks of Phoenix.
</p>
<a name="phoenix.reference.the_language.terminal.reference.synopsis"></a><h6>
-<a name="id610975"></a>
+<a name="id763489"></a>
<a class="link" href="the_language.html#phoenix.reference.the_language.terminal.reference.synopsis">Synopsis</a>
</h6>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">expression</span>
@@ -193,7 +244,7 @@
<span class="special">{</span>
<span class="keyword">typedef</span> <span class="emphasis"><em>unspecified</em></span> <span class="identifier">type</span><span class="special">;</span>
- <span class="keyword">static</span> <span class="identifier">type</span> <span class="identifier">make</span><span class="special">(</span><span class="identifier">T</span> <span class="identifier">t</span><span class="special">);</span>
+ <span class="keyword">static</span> <span class="identifier">type</span> <span class="identifier">make</span><span class="special">(</span><span class="identifier">T</span> <span class="special">&</span><span class="identifier">t</span><span class="special">);</span>
<span class="special">};</span>
<span class="special">}</span>
@@ -205,9 +256,11 @@
<span class="keyword">typename</span> <span class="identifier">expression</span><span class="special">::</span><span class="identifier">reference</span><span class="special"><</span><span class="identifier">T</span> <span class="keyword">const</span><span class="special">>::</span><span class="identifier">type</span>
<span class="identifier">cref</span><span class="special">(</span><span class="identifier">T</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">t</span><span class="special">);</span>
</pre>
-<div class="table">
-<a name="id611292"></a><p class="title"><b>Table 1.3. Parameters</b></p>
-<div class="table-contents"><table class="table" summary="Parameters">
+<a name="phoenix.reference.the_language.terminal.reference.parameters"></a><h6>
+<a name="id763816"></a>
+ <a class="link" href="the_language.html#phoenix.reference.the_language.terminal.reference.parameters">Parameters</a>
+ </h6>
+<div class="informaltable"><table class="table">
<colgroup>
<col>
<col>
@@ -264,9 +317,8 @@
</tr>
</tbody>
</table></div>
-</div>
-<br class="table-break"><a name="phoenix.reference.the_language.terminal.reference.expression_semantics"></a><h6>
-<a name="id611383"></a>
+<a name="phoenix.reference.the_language.terminal.reference.expression_semantics"></a><h6>
+<a name="id763916"></a>
<a class="link" href="the_language.html#phoenix.reference.the_language.terminal.reference.expression_semantics">Expression
Semantics</a>
</h6>
@@ -287,7 +339,7 @@
</p>
<p>
<span class="bold"><strong>Semantics</strong></span>: Creates a Phoenix reference
- expression initialized with a copy of of the supplied argument
+ expression initialized with the supplied argument
</p>
<pre class="programlisting"><span class="identifier">ref</span><span class="special">(</span><span class="identifier">t</span><span class="special">);</span>
</pre>
@@ -306,13 +358,26 @@
<span class="bold"><strong>Semantics</strong></span>: Calls <code class="computeroutput"><span class="identifier">expression</span><span class="special">::</span><span class="identifier">reference</span><span class="special"><</span><span class="identifier">T</span> <span class="keyword">const</span><span class="special">>::</span><span class="identifier">make</span><span class="special">(</span><span class="identifier">t</span><span class="special">)</span></code>,
Automatically deduces type T
</p>
+<a name="phoenix.reference.the_language.terminal.reference.header"></a><h6>
+<a name="id764328"></a>
+ <a class="link" href="the_language.html#phoenix.reference.the_language.terminal.reference.header">Header</a>
+ </h6>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">phoenix</span><span class="special">/</span><span class="identifier">core</span><span class="special">/</span><span class="identifier">reference</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+</pre>
+<a name="phoenix.reference.the_language.terminal.reference.example"></a><h6>
+<a name="id764401"></a>
+ <a class="link" href="the_language.html#phoenix.reference.the_language.terminal.reference.example">Example</a>
+ </h6>
+<p>
+ TODO
+ </p>
</div>
<div class="section">
<div class="titlepage"><div><div><h5 class="title">
<a name="phoenix.reference.the_language.terminal.placeholder"></a><a class="link" href="the_language.html#phoenix.reference.the_language.terminal.placeholder" title="Placeholder">Placeholder</a>
</h5></div></div></div>
<a name="phoenix.reference.the_language.terminal.placeholder.synopsis"></a><h6>
-<a name="id611807"></a>
+<a name="id764433"></a>
<a class="link" href="the_language.html#phoenix.reference.the_language.terminal.placeholder.synopsis">Synopsis</a>
</h6>
<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">int</span> <span class="identifier">I</span><span class="special">></span>
Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/starter_kit.html
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/starter_kit.html (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/starter_kit.html 2011-01-18 04:13:32 EST (Tue, 18 Jan 2011)
@@ -62,7 +62,7 @@
into high gear quickly.
</p>
<a name="phoenix.starter_kit.functors_everywhere"></a><h4>
-<a name="id606762"></a>
+<a name="id758963"></a>
<a class="link" href="starter_kit.html#phoenix.starter_kit.functors_everywhere">Functors everywhere</a>
</h4>
<p>
Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/starter_kit/composites.html
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/starter_kit/composites.html (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/starter_kit/composites.html 2011-01-18 04:13:32 EST (Tue, 18 Jan 2011)
@@ -91,7 +91,7 @@
</p>
</div>
<a name="phoenix.starter_kit.composites.lazy_operators.first_practical_example"></a><h6>
-<a name="id608513"></a>
+<a name="id760714"></a>
<a class="link" href="composites.html#phoenix.starter_kit.composites.lazy_operators.first_practical_example">First
Practical Example</a>
</h6>
@@ -238,7 +238,7 @@
<span class="identifier">function</span><span class="special"><</span><span class="identifier">is_odd_impl</span><span class="special">></span> <span class="identifier">is_odd</span><span class="special">;</span>
</pre>
<a name="phoenix.starter_kit.composites.lazy_functions.things_to_note_"></a><h6>
-<a name="id609592"></a>
+<a name="id761792"></a>
<a class="link" href="composites.html#phoenix.starter_kit.composites.lazy_functions.things_to_note_">Things
to note:</a>
</h6>
@@ -269,7 +269,7 @@
(See function.cpp)
</p>
<a name="phoenix.starter_kit.composites.lazy_functions.predefined_lazy_functions"></a><h6>
-<a name="id609770"></a>
+<a name="id761971"></a>
<a class="link" href="composites.html#phoenix.starter_kit.composites.lazy_functions.predefined_lazy_functions">Predefined
Lazy Functions</a>
</h6>
Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/starter_kit/primitives.html
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/starter_kit/primitives.html (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/starter_kit/primitives.html 2011-01-18 04:13:32 EST (Tue, 18 Jan 2011)
@@ -47,7 +47,7 @@
World"</span></code>.
</p>
<a name="phoenix.starter_kit.primitives.values.lazy_evaluation"></a><h6>
-<a name="id606924"></a>
+<a name="id759125"></a>
<a class="link" href="primitives.html#phoenix.starter_kit.primitives.values.lazy_evaluation">Lazy
Evaluation</a>
</h6>
@@ -80,7 +80,7 @@
anything and defers the evaluation for later.
</p>
<a name="phoenix.starter_kit.primitives.values.callbacks"></a><h6>
-<a name="id607149"></a>
+<a name="id759350"></a>
<a class="link" href="primitives.html#phoenix.starter_kit.primitives.values.callbacks">Callbacks</a>
</h6>
<p>
Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/doc/reference.qbk
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/doc/reference.qbk (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/doc/reference.qbk 2011-01-18 04:13:32 EST (Tue, 18 Jan 2011)
@@ -105,9 +105,34 @@
placeholder := _1 | _2 | _3 | ... | _PHOENIX_ARG_LIMIT
-[section:blubb Value]
+Terminals are the core building blocks. Phoenix, by default distinguishes
+between 3 types of terminals:
-Values are one of the core building blocks of Phoenix.
+# Value Terminals
+# Reference Terminals
+# Placeholders
+
+The last two terminal types are handled by the terminal customization points.
+
+[section Value]
+
+Whenever we see a constant in a partially applied function, an
+
+ expression::value<T>::type
+
+(where T is the type of the constant) is automatically created for
+us. For instance:
+
+ add(arg1, 6)
+
+Passing a second argument, `6`, an `expression::value<int>::type` is implicitly created
+behind the scenes. This is also equivalent to:
+
+ add(arg1, val(6))
+
+`val(x)` generates an `expression::value<T>::type` where `T` is the type of `x`. In most
+cases, there's no need to explicitly use `val`, but, as we'll see later on,
+there are situations where this is unavoidable.
[heading Synopsis]
namespace expression
@@ -130,10 +155,12 @@
typename expression::value<T>::type
val(T t);
-[table Parameters
+[heading Parameters]
+
+[table
[[Parameter] [Requirement] [Description]]
- [[T] [Model of Copy Constructible] [Operation's Argument]]
- [[t] [Object of type T] [Operation's Argument]]
+ [[`T`] [Model of Copy Constructible] [Operation's Argument]]
+ [[`t`] [Object of type T] [Operation's Argument]]
]
[heading Expression Semantics]
@@ -156,11 +183,47 @@
[*Semantics]: Calls `expression::value<T>::make(t)`, Automatically deduces type T
+[header Header]
+ #include <boost/phoenix/core/value.hpp>
+
+[header Example]
+
+TODO
+
[endsect]
[section Reference]
-References are one of the core building blocks of Phoenix.
+Values are immutable constants. Attempting to modify a value will result in a
+compile time error. When we want the function to modify the parameter, we use a
+reference instead. For instance, imagine a lazy function `add_assign`:
+
+ void add_assign(T& x, T y) { x += y; } // pseudo code
+
+Here, we want the first function argument, x, to be mutable. Obviously, we
+cannot write:
+
+ add_assign(1, 2) // error first argument is immutable
+
+In C++, we can pass in a reference to a variable as the first argument in our
+example above. Yet, by default, the library forces arguments passed to partially
+applied functions functions to be immutable values (see [link __phoenix_reference_value__]
+). To achieve our intent, we use:
+
+ expression::reference<T>::type
+
+This is similar to `expression::value<T>::type` before but instead holds a reference to a
+variable.
+
+We normally don't instantiate `expression::reference<T>::type` objects directly. Instead we
+use `ref`. For example (where `i` is an `int` variable):
+
+ add_assign(ref(i), 2)
+
+Another free function `cref(cv)` may also be used. `cref(cv)` creates an
+`expression::reference<T const>::type` object. This is similar to `expression::value<T>::type` but
+when the data to be passed as argument to a function is heavy and expensive to
+copy by value, the `cref(cv)` offers a lighter alternative.
[heading Synopsis]
namespace expression
@@ -170,7 +233,7 @@
{
typedef __unspecified__ type;
- static type make(T t);
+ static type make(T &t);
};
}
@@ -182,7 +245,9 @@
typename expression::reference<T const>::type
cref(T const & t);
-[table Parameters
+[heading Parameters]
+
+[table
[[Parameter] [Requirement] [Description]]
[[T] [] [Operation's Argument]]
[[t] [Object of type T] [Operation's Argument]]
@@ -199,8 +264,7 @@
[*Return type]: `expression::reference<T>::type`
-[*Semantics]: Creates a Phoenix reference expression initialized with a copy of of
-the supplied argument
+[*Semantics]: Creates a Phoenix reference expression initialized with the supplied argument
ref(t);
@@ -214,6 +278,13 @@
[*Semantics]: Calls `expression::reference<T const>::make(t)`, Automatically deduces type T
+[heading Header]
+ #include <boost/phoenix/core/reference.hpp>
+
+[heading Example]
+
+TODO
+
[endsect]
[section Placeholder]
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