|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r70138 - in sandbox/local/libs/local: doc doc/html doc/html/boost/local doc/html/boost_local doc/qbk example
From: lorcaminiti_at_[hidden]
Date: 2011-03-18 17:38:36
Author: lcaminiti
Date: 2011-03-18 17:38:31 EDT (Fri, 18 Mar 2011)
New Revision: 70138
URL: http://svn.boost.org/trac/boost/changeset/70138
Log:
Updating docs.
Added:
sandbox/local/libs/local/doc/qbk/advanced_topics.qbk
- copied, changed from r69958, /sandbox/local/libs/local/doc/qbk/advanced.qbk
sandbox/local/libs/local/doc/qbk/getting_started.qbk
- copied, changed from r69958, /sandbox/local/libs/local/doc/qbk/starting.qbk
sandbox/local/libs/local/doc/qbk/release_notes.qbk
- copied, changed from r69958, /sandbox/local/libs/local/doc/qbk/releases.qbk
Removed:
sandbox/local/libs/local/doc/qbk/advanced.qbk
sandbox/local/libs/local/doc/qbk/releases.qbk
sandbox/local/libs/local/doc/qbk/starting.qbk
Text files modified:
sandbox/local/libs/local/doc/Jamfile.jam | 12
sandbox/local/libs/local/doc/html/BOOST_IDENTITY_TYPE.html | 8
sandbox/local/libs/local/doc/html/BOOST_IDENTITY_VALUE.html | 2
sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK.html | 47 ++
sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK_END.html | 12
sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK_TPL.html | 8
sandbox/local/libs/local/doc/html/BOOST_LOCAL_CONFIG_FUNCTION_ARITY_MAX.html | 17
sandbox/local/libs/local/doc/html/BOOST_LOCAL_CONFIG_THIS_PARAM_NAME.html | 8
sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT.html | 47 ++
sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT_END.html | 6
sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT_TPL.html | 8
sandbox/local/libs/local/doc/html/BOOST_LOCAL_FUNCTION_NAME.html | 29 +
sandbox/local/libs/local/doc/html/BOOST_LOCAL_FUNCTION_PARAMS.html | 58 ++
sandbox/local/libs/local/doc/html/BOOST_LOCAL_FUNCTION_PARAMS_TPL.html | 8
sandbox/local/libs/local/doc/html/boost/local/function.html | 38 +
sandbox/local/libs/local/doc/html/boost_local/Advanced.html | 771 +++++++++++++++++++++++++--------------
sandbox/local/libs/local/doc/html/boost_local/Bibliography.html | 6
sandbox/local/libs/local/doc/html/boost_local/Implementation.html | 6
sandbox/local/libs/local/doc/html/boost_local/Starting.html | 4
sandbox/local/libs/local/doc/html/boost_local/Tutorial.html | 58 +-
sandbox/local/libs/local/doc/html/index.html | 35 +
sandbox/local/libs/local/doc/html/reference.html | 26
sandbox/local/libs/local/doc/html/standalone_HTML.manifest | 6
sandbox/local/libs/local/doc/qbk/advanced_topics.qbk | 264 ++++++-------
sandbox/local/libs/local/doc/qbk/getting_started.qbk | 10
sandbox/local/libs/local/doc/qbk/introduction.qbk | 3
sandbox/local/libs/local/doc/qbk/local.qbk | 27
sandbox/local/libs/local/doc/qbk/release_notes.qbk | 2
sandbox/local/libs/local/example/Jamfile.jam | 9
sandbox/local/libs/local/example/add_except_va.cpp | 2
sandbox/local/libs/local/example/nesting.cpp | 2
sandbox/local/libs/local/example/nesting_va.cpp | 2
sandbox/local/libs/local/example/print_map.cpp | 9
sandbox/local/libs/local/example/typeof.cpp | 16
sandbox/local/libs/local/example/typeof_tpl.cpp | 16
sandbox/local/libs/local/example/typeof_tpl_va.cpp | 16
sandbox/local/libs/local/example/typeof_va.cpp | 16
37 files changed, 1008 insertions(+), 606 deletions(-)
Modified: sandbox/local/libs/local/doc/Jamfile.jam
==============================================================================
--- sandbox/local/libs/local/doc/Jamfile.jam (original)
+++ sandbox/local/libs/local/doc/Jamfile.jam 2011-03-18 17:38:31 EDT (Fri, 18 Mar 2011)
@@ -12,12 +12,14 @@
../../../boost/local/function.hpp
../../../boost/local/block.hpp
../../../boost/local/exit.hpp
- ../../../boost/local/function.hpp
+ ../../../boost/local/typeof.hpp
../../../boost/local/config.hpp
../../../boost/utility/identity.hpp
:
<doxygen:param>QUIET=YES
- <doxygen:param>ALIASES=" Params=\"<b>Parameters:</b> <table border="0">\" Param{2}=\"<tr><td><b><tt>\\1</tt></b></td><td>\\2</td></tr>\" EndParams=\"</table>\" Returns=\"<b>Returns:</b>\" Note=\"<b>Note:</b>\" Warning=\"<b>Warning:</b>\" See=\"<b>See:</b>\" RefSect{1}=\"\\xmlonly<link linkend='boost_local.\\1'>\\1</link>\\endxmlonly\" RefClass{1}=\"\\xmlonly<computeroutput><classname alt='\\1'>\\1</classname></computeroutput>\\endxmlonly\" RefMacro{1}=\"\\xmlonly<computeroutput><macroname alt='\\1'>\\1</macroname></computeroutput>\\endxmlonly\" "
+ <doxygen:param>ALIASES=" Params=\"<b>Parameters:</b> <table border="0">\" Param{2}=\"<tr><td><b><tt>\\1</tt></b></td><td>\\2</td></tr>\" EndParams=\"</table>\" Returns=\"<b>Returns:</b>\" Note=\"<b>Note:</b>\" Warning=\"<b>Warning:</b>\" See=\"<b>See:</b>\" RefSect{1}=\"\\xmlonly<link linkend='boost_local.\\1'>\\1</link>\\endxmlonly\" RefSect2{2}=\"\\xmlonly<link linkend='boost_local.\\1'>\\1 \\2</link>\\endxmlonly\" RefClass{1}=\"\\xmlonly<computeroutput><classname alt='\\1'>\\1</classname></computeroutput>\\endxmlonly\" RefMacro{1}=\"\\xmlonly<computeroutput><macroname alt='\\1'>\\1</macroname></computeroutput>\\endxmlonly\" "
+ # Extract Doxygen that comments non-variant macros.
+ <doxygen:param>PREDEFINED=BOOST_LOCAL_CONFIG_COMPLIANT
<reftitle>"Reference"
;
@@ -26,14 +28,14 @@
qbk/local.qbk
:
<dependency>qbk/introduction.qbk
- <dependency>qbk/starting.qbk
+ <dependency>qbk/getting_started.qbk
<dependency>qbk/tutorial.qbk
- <dependency>qbk/advanced.qbk
+ <dependency>qbk/advanced_topics.qbk
<dependency>reference
<dependency>qbk/examples.qbk
<dependency>qbk/alternatives.qbk
<dependency>qbk/implementation.qbk
- <dependency>qbk/releases.qbk
+ <dependency>qbk/release_notes.qbk
<dependency>qbk/bibliography.qbk
<dependency>qbk/acknowledgements.qbk
;
Modified: sandbox/local/libs/local/doc/html/BOOST_IDENTITY_TYPE.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_IDENTITY_TYPE.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_IDENTITY_TYPE.html 2011-03-18 17:38:31 EDT (Fri, 18 Mar 2011)
@@ -6,7 +6,7 @@
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="Boost.Local 0.1.1">
<link rel="up" href="reference.html#header.boost.utility.identity_hpp" title="Header <boost/utility/identity.hpp>">
-<link rel="prev" href="BOOST_LOCAL_FUNCTION_NAME.html" title="Macro BOOST_LOCAL_FUNCTION_NAME">
+<link rel="prev" href="BOOST_LOCAL_TYPEOF.html" title="Macro BOOST_LOCAL_TYPEOF">
<link rel="next" href="BOOST_IDENTITY_VALUE.html" title="Macro BOOST_IDENTITY_VALUE">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
@@ -20,7 +20,7 @@
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="BOOST_LOCAL_FUNCTION_NAME.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.utility.identity_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_IDENTITY_VALUE.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
+<a accesskey="p" href="BOOST_LOCAL_TYPEOF.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.utility.identity_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_IDENTITY_VALUE.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="BOOST_IDENTITY_TYPE"></a><div class="titlepage"></div>
@@ -33,7 +33,7 @@
</span>BOOST_IDENTITY_TYPE(parenthesized_type)</pre></div>
<div class="refsect1">
-<a name="id908060"></a><h2>Description</h2>
+<a name="id915384"></a><h2>Description</h2>
<p>This macro expands to an expression that can be passed as a single macro parameter even if it contains commas and that evaluates to the specified type at compile-time (see the <a class="link" href="boost_local/Advanced.html" title="Advanced Topics">Advanced</a> section).</p>
<p>For example <code class="computeroutput">BOOST_IDENTITY_TYPE((std::map<int, double>))</code> can be passed as a single macro parameter when instead <code class="computeroutput">std::map<int, double></code> cannot (because it contains a comma not wrapped by round parenthesis so it will be interpreted as two separate macro parameters by the preprocessor).</p>
<p><span class="bold"><strong>Parameters:</strong></span> </p>
@@ -62,7 +62,7 @@
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="BOOST_LOCAL_FUNCTION_NAME.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.utility.identity_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_IDENTITY_VALUE.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
+<a accesskey="p" href="BOOST_LOCAL_TYPEOF.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.utility.identity_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_IDENTITY_VALUE.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
Modified: sandbox/local/libs/local/doc/html/BOOST_IDENTITY_VALUE.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_IDENTITY_VALUE.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_IDENTITY_VALUE.html 2011-03-18 17:38:31 EDT (Fri, 18 Mar 2011)
@@ -33,7 +33,7 @@
</span>BOOST_IDENTITY_VALUE(parenthesized_value)</pre></div>
<div class="refsect1">
-<a name="id908200"></a><h2>Description</h2>
+<a name="id915525"></a><h2>Description</h2>
<p>This macro expands to an expression that can be passed as a single macro parameter even if it contains commas and that evaluates to the specified value at run-time (see the <a class="link" href="boost_local/Advanced.html" title="Advanced Topics">Advanced</a> section).</p>
<p>For example <code class="computeroutput">BOOST_IDENTITY_VALUE((key_size<int, double>::value))</code> can be passed as a single macro parameter when instead <code class="computeroutput">key_size<int, double>::value</code> cannot (because it contains a comma not wrapped by round parenthesis so it will be interpreted as two separate macro parameters by the preprocessor).</p>
<p><span class="bold"><strong>Parameters:</strong></span> </p>
Modified: sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK.html 2011-03-18 17:38:31 EDT (Fri, 18 Mar 2011)
@@ -26,12 +26,55 @@
<a name="BOOST_LOCAL_BLOCK"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Macro BOOST_LOCAL_BLOCK</span></h2>
-<p>BOOST_LOCAL_BLOCK</p>
+<p>BOOST_LOCAL_BLOCK — This macro starts the declaration of a local block. </p>
</div>
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.local.block_hpp" title="Header <boost/local/block.hpp>">boost/local/block.hpp</a>>
-</span>BOOST_LOCAL_BLOCK(...)</pre></div>
+</span>BOOST_LOCAL_BLOCK(bindings)</pre></div>
+<div class="refsect1">
+<a name="id910442"></a><h2>Description</h2>
+<p>This macro must be used within a declarative context, it must be followed by the local block body code and then by the <code class="computeroutput"><a class="link" href="BOOST_LOCAL_BLOCK_END.html" title="Macro BOOST_LOCAL_BLOCK_END">BOOST_LOCAL_BLOCK_END</a></code> macro (see the Tutorial section): </p>
+<pre class="programlisting"> <span class="special">{</span> <span class="comment">// Some declarative context.</span>
+ <span class="special">...</span>
+ <span class="identifier">BOOST_LOCAL_BLOCK</span><span class="special">(</span><span class="identifier">bindings</span><span class="special">)</span> <span class="special">{</span>
+ <span class="special">...</span> <span class="comment">// Body code.</span>
+ <span class="special">}</span> <span class="identifier">BOOST_LOCAL_BLOCK_END</span>
+ <span class="special">...</span>
+ <span class="special">}</span>
+</pre>
+<p>As usual, exceptions specifications can be optionally programmed before the body code block (but the specifications will only apply the body code and not to the library code automatically generated by the macro expansion, see <a class="link" href="boost_local/Advanced.html" title="Advanced Topics">Advanced Topics</a>).</p>
+<p>Within templates, the special macro <code class="computeroutput"><a class="link" href="BOOST_LOCAL_BLOCK_TPL.html" title="Macro BOOST_LOCAL_BLOCK_TPL">BOOST_LOCAL_BLOCK_TPL</a></code> must be used instead of <code class="computeroutput"><a class="link" href="BOOST_LOCAL_BLOCK.html" title="Macro BOOST_LOCAL_BLOCK">BOOST_LOCAL_BLOCK</a></code>.</p>
+<p><span class="bold"><strong>Note:</strong></span> A <code class="computeroutput">return;</code> instruction from within a local block body jumps to the end of the local block body and it does not return the enclosing scope.</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">bindings</code></strong></span></td>
+<td>On all C++ compilers, the <span class="emphasis"><em>sequencing macro syntax</em></span> defined by the following grammar is used to specify the variables in scope to bind: <pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"> <span class="identifier">bindings</span><span class="special">:</span>
+ <span class="identifier">void_list</span> <span class="special">|</span> <span class="identifier">bound_list</span>
+ <span class="identifier">void_list</span><span class="special">:</span>
+ <span class="special">(</span><span class="keyword">void</span><span class="special">)</span>
+ <span class="identifier">bound_list</span><span class="special">:</span>
+ <span class="special">(</span><span class="identifier">bound_parameter1</span><span class="special">)</span> <span class="special">(</span><span class="identifier">bound_parameter2</span><span class="special">)</span> <span class="special">...</span>
+ <span class="identifier">bound_parameter</span><span class="special">:</span>
+ <span class="special">[</span><span class="keyword">const</span><span class="special">]</span> <span class="identifier">bind</span><span class="special">[</span><span class="special">&</span><span class="special">]</span> <span class="identifier">variable_name</span>
+</pre> Where the following lexical conventions have been used: <code class="computeroutput">token1 | token2</code> means either <code class="computeroutput">token1</code> or <code class="computeroutput">token2</code>; <code class="computeroutput">[token]</code> means either <code class="computeroutput">token</code> or nothing (i.e., <code class="computeroutput">token</code> is optional).On C99 and later compilers which support variadic macros, the above grammar can be modified as follow to define the <span class="emphasis"><em>variadic macro syntax</em></span> that can also be used to specify the variables in scope to bind: <pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"> <span class="identifier">void_list</span><span class="special">:</span>
+ <span class="keyword">void</span>
+ <span class="identifier">bound_list</span><span class="special">:</span>
+ <span class="identifier">bound_parameter1</span><span class="special">,</span> <span class="identifier">bound_parameter2</span><span class="special">,</span> <span class="special">...</span>
+</pre> Note that the variadic macro syntax uses commas <code class="computeroutput">,</code> instead of parenthesis <code class="computeroutput">()</code> to separate the parameters and therefore resembles the usual C++ function parameter declaration syntax more closely than the sequencing macro syntax. However, the variadic macro syntax will only work on C++ compilers that support variadic macros so it should be used with care in order to avoid portability issues.Finally, on C++ compilers which support empty macro parameters, the above grammars can be modified as follow to define the <span class="emphasis"><em>empty macro syntax</em></span> that can can also be used to specify an empty list of variables to bind: <pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"> <span class="identifier">void_list</span><span class="special">:</span>
+ <span class="special">(</span><span class="special">)</span>
+</pre> Note that the empty macro parameter syntax uses the usual C++ syntax to specify empty bound variable list but it will only work on compilers that support empty macro parameters so it should be used with care in order to avoid portability issues. </td>
+</tr></tbody>
+</table></div>
+<p>
+</p>
+<p><span class="bold"><strong>See:</strong></span> <a class="link" href="boost_local/Tutorial.html" title="Tutorial">Tutorial</a> section, <a class="link" href="boost_local/Advanced.html" title="Advanced Topics">Advanced Topics</a> section, <code class="computeroutput"><a class="link" href="BOOST_LOCAL_BLOCK_TPL.html" title="Macro BOOST_LOCAL_BLOCK_TPL">BOOST_LOCAL_BLOCK_TPL</a></code>, <code class="computeroutput"><a class="link" href="BOOST_LOCAL_BLOCK_END.html" title="Macro BOOST_LOCAL_BLOCK_END">BOOST_LOCAL_BLOCK_END</a></code>. </p>
+</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
Modified: sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK_END.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK_END.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK_END.html 2011-03-18 17:38:31 EDT (Fri, 18 Mar 2011)
@@ -7,7 +7,7 @@
<link rel="home" href="index.html" title="Boost.Local 0.1.1">
<link rel="up" href="reference.html#header.boost.local.block_hpp" title="Header <boost/local/block.hpp>">
<link rel="prev" href="BOOST_LOCAL_BLOCK_TPL.html" title="Macro BOOST_LOCAL_BLOCK_TPL">
-<link rel="next" href="BOOST_LOCAL_CONFIG_FUNCTION_ARITY_MAX.html" title="Macro BOOST_LOCAL_CONFIG_FUNCTION_ARITY_MAX">
+<link rel="next" href="BOOST_LOCAL_CONFIG_COMPLIANT.html" title="Macro BOOST_LOCAL_CONFIG_COMPLIANT">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
@@ -20,7 +20,7 @@
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="BOOST_LOCAL_BLOCK_TPL.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.local.block_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_LOCAL_CONFIG_FUNCTION_ARITY_MAX.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
+<a accesskey="p" href="BOOST_LOCAL_BLOCK_TPL.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.local.block_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_LOCAL_CONFIG_COMPLIANT.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="BOOST_LOCAL_BLOCK_END"></a><div class="titlepage"></div>
@@ -33,9 +33,9 @@
</span>BOOST_LOCAL_BLOCK_END</pre></div>
<div class="refsect1">
-<a name="id905973"></a><h2>Description</h2>
-<p>This macro must follow the local block body code <code class="computeroutput">{ ... }</code> as shown in the <code class="computeroutput">CONTRACT_DETAIL_LOCAL_BLOCK</code> documentation.</p>
-<p><span class="bold"><strong>See:</strong></span> <code class="computeroutput">CONTRACT_DETAIL_LOCAL_BLOCK</code>, <a class="link" href="boost_local/Tutorial.html" title="Tutorial">Tutorial</a> section. </p>
+<a name="id911164"></a><h2>Description</h2>
+<p>This macro must follow the local block body code <code class="computeroutput">{ ... }</code> as shown in the <code class="computeroutput"><a class="link" href="BOOST_LOCAL_BLOCK.html" title="Macro BOOST_LOCAL_BLOCK">BOOST_LOCAL_BLOCK</a></code> documentation.</p>
+<p><span class="bold"><strong>See:</strong></span> <code class="computeroutput"><a class="link" href="BOOST_LOCAL_BLOCK.html" title="Macro BOOST_LOCAL_BLOCK">BOOST_LOCAL_BLOCK</a></code>, <a class="link" href="boost_local/Tutorial.html" title="Tutorial">Tutorial</a> section. </p>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
@@ -48,7 +48,7 @@
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="BOOST_LOCAL_BLOCK_TPL.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.local.block_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_LOCAL_CONFIG_FUNCTION_ARITY_MAX.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
+<a accesskey="p" href="BOOST_LOCAL_BLOCK_TPL.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.local.block_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_LOCAL_CONFIG_COMPLIANT.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
Modified: sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK_TPL.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK_TPL.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK_TPL.html 2011-03-18 17:38:31 EDT (Fri, 18 Mar 2011)
@@ -26,12 +26,16 @@
<a name="BOOST_LOCAL_BLOCK_TPL"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Macro BOOST_LOCAL_BLOCK_TPL</span></h2>
-<p>BOOST_LOCAL_BLOCK_TPL</p>
+<p>BOOST_LOCAL_BLOCK_TPL — This macro is the same as <code class="computeroutput"><a class="link" href="BOOST_LOCAL_BLOCK.html" title="Macro BOOST_LOCAL_BLOCK">BOOST_LOCAL_BLOCK</a></code> but it must be used when declaring local blocks within templates. </p>
</div>
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.local.block_hpp" title="Header <boost/local/block.hpp>">boost/local/block.hpp</a>>
-</span>BOOST_LOCAL_BLOCK_TPL(...)</pre></div>
+</span>BOOST_LOCAL_BLOCK_TPL(bindings)</pre></div>
+<div class="refsect1">
+<a name="id911090"></a><h2>Description</h2>
+<p><span class="bold"><strong>See:</strong></span> <code class="computeroutput"><a class="link" href="BOOST_LOCAL_BLOCK.html" title="Macro BOOST_LOCAL_BLOCK">BOOST_LOCAL_BLOCK</a></code>, <a class="link" href="boost_local/Tutorial.html" title="Tutorial">Tutorial</a> section. </p>
+</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
Modified: sandbox/local/libs/local/doc/html/BOOST_LOCAL_CONFIG_FUNCTION_ARITY_MAX.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_LOCAL_CONFIG_FUNCTION_ARITY_MAX.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_LOCAL_CONFIG_FUNCTION_ARITY_MAX.html 2011-03-18 17:38:31 EDT (Fri, 18 Mar 2011)
@@ -6,7 +6,7 @@
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="Boost.Local 0.1.1">
<link rel="up" href="reference.html#header.boost.local.config_hpp" title="Header <boost/local/config.hpp>">
-<link rel="prev" href="BOOST_LOCAL_BLOCK_END.html" title="Macro BOOST_LOCAL_BLOCK_END">
+<link rel="prev" href="BOOST_LOCAL_CONFIG_COMPLIANT.html" title="Macro BOOST_LOCAL_CONFIG_COMPLIANT">
<link rel="next" href="BOOST_LOCAL_CONFIG_THIS_PARAM_NAME.html" title="Macro BOOST_LOCAL_CONFIG_THIS_PARAM_NAME">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
@@ -20,27 +20,24 @@
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="BOOST_LOCAL_BLOCK_END.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.local.config_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_LOCAL_CONFIG_THIS_PARAM_NAME.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
+<a accesskey="p" href="BOOST_LOCAL_CONFIG_COMPLIANT.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.local.config_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_LOCAL_CONFIG_THIS_PARAM_NAME.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="BOOST_LOCAL_CONFIG_FUNCTION_ARITY_MAX"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Macro BOOST_LOCAL_CONFIG_FUNCTION_ARITY_MAX</span></h2>
-<p>BOOST_LOCAL_CONFIG_FUNCTION_ARITY_MAX — Force to use C++ standard feature only. </p>
+<p>BOOST_LOCAL_CONFIG_FUNCTION_ARITY_MAX — Maximum number of function parameters supported for the local functions. </p>
</div>
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.local.config_hpp" title="Header <boost/local/config.hpp>">boost/local/config.hpp</a>>
</span>BOOST_LOCAL_CONFIG_FUNCTION_ARITY_MAX</pre></div>
<div class="refsect1">
-<a name="id906105"></a><h2>Description</h2>
-<p><span class="bold"><strong>Note:</strong></span> If programmers leave this macro undefined, its default value is undefined.</p>
-<p>If this macro is defined, variadic macros and empty macro parameters are not supported. Variadic macros, are supported by most recent compilers (like MSVC and GCC) and they were first introduced by the C99 preprocessor. However, they are not part of the official ISO C++ standard.</p>
-<p><span class="bold"><strong>See:</strong></span> <a class="link" href="boost_local/Tutorial.html" title="Tutorial">Tutorial</a> section. Maximum number of function parameters supported for the local functions.</p>
-<p><span class="bold"><strong>Note:</strong></span> If programmers leave this macro undefined, its default value is <code class="computeroutput">5</code>.</p>
+<a name="id911468"></a><h2>Description</h2>
+<p>If programmers leave this configuration macro undefined, its default value is <code class="computeroutput">5</code>.</p>
<p>This only refers to the number of local function parameters and not to the number of bound variables in scope (the limit on the number of bound variables is instead the maximum size allowed for a Boost.Preprocessor sequences).</p>
<p><span class="bold"><strong>Warning:</strong></span> Increasing this number will increase compilation time.</p>
-<p><span class="bold"><strong>See:</strong></span> <a class="link" href="boost_local/Starting.html" title="Getting Started">Starting</a> section. </p>
+<p><span class="bold"><strong>See:</strong></span> <a class="link" href="boost_local/Getting.html" title="Getting Started">Getting Starting</a> section. </p>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
@@ -53,7 +50,7 @@
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="BOOST_LOCAL_BLOCK_END.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.local.config_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_LOCAL_CONFIG_THIS_PARAM_NAME.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
+<a accesskey="p" href="BOOST_LOCAL_CONFIG_COMPLIANT.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.local.config_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_LOCAL_CONFIG_THIS_PARAM_NAME.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
Modified: sandbox/local/libs/local/doc/html/BOOST_LOCAL_CONFIG_THIS_PARAM_NAME.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_LOCAL_CONFIG_THIS_PARAM_NAME.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_LOCAL_CONFIG_THIS_PARAM_NAME.html 2011-03-18 17:38:31 EDT (Fri, 18 Mar 2011)
@@ -33,10 +33,10 @@
</span>BOOST_LOCAL_CONFIG_THIS_PARAM_NAME</pre></div>
<div class="refsect1">
-<a name="id906239"></a><h2>Description</h2>
-<p><span class="bold"><strong>Note:</strong></span> If programmers leave this macro undefined, the default symbol used is <code class="computeroutput">this_</code>.</p>
-<p><span class="bold"><strong>Warning:</strong></span> Programmers should not define this macro unless it is absolutely necessary (e.g., to avoid name clashes with another library which cannot be changed). Changing the symbol <code class="computeroutput">this_</code> effectively changes the public API of this library.</p>
-<p><span class="bold"><strong>See:</strong></span> <a class="link" href="boost_local/Starting.html" title="Getting Started">Starting</a> section. </p>
+<a name="id911562"></a><h2>Description</h2>
+<p>If programmers leave this configuration macro undefined, the default symbol used is <code class="computeroutput">this_</code>.</p>
+<p><span class="bold"><strong>Warning:</strong></span> Programmers should not #define this macro unless it is absolutely necessary (e.g., to avoid name clashes with another library which cannot be changed). Changing the symbol <code class="computeroutput">this_</code> effectively changes the public API of this library.</p>
+<p><span class="bold"><strong>See:</strong></span> <a class="link" href="boost_local/Getting.html" title="Getting Started">Getting Started</a> section. </p>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
Modified: sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT.html 2011-03-18 17:38:31 EDT (Fri, 18 Mar 2011)
@@ -26,12 +26,55 @@
<a name="BOOST_LOCAL_EXIT"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Macro BOOST_LOCAL_EXIT</span></h2>
-<p>BOOST_LOCAL_EXIT</p>
+<p>BOOST_LOCAL_EXIT — This macro starts the declaration of a local exit. </p>
</div>
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.local.exit_hpp" title="Header <boost/local/exit.hpp>">boost/local/exit.hpp</a>>
-</span>BOOST_LOCAL_EXIT(...)</pre></div>
+</span>BOOST_LOCAL_EXIT(binding_list)</pre></div>
+<div class="refsect1">
+<a name="id911703"></a><h2>Description</h2>
+<p>This macro must be used within a declarative context, it must be followed by the local exit body code and then by the <code class="computeroutput"><a class="link" href="BOOST_LOCAL_EXIT_END.html" title="Macro BOOST_LOCAL_EXIT_END">BOOST_LOCAL_EXIT_END</a></code> macro (see the <a class="link" href="boost_local/Tutorial.html" title="Tutorial">Tutorial</a> section): </p>
+<pre class="programlisting"> <span class="special">{</span> <span class="comment">// Some declarative context.</span>
+ <span class="special">...</span>
+ <span class="identifier">BOOST_LOCAL_EXIT</span><span class="special">(</span><span class="identifier">bindings</span><span class="special">)</span> <span class="special">{</span>
+ <span class="special">...</span> <span class="comment">// Block code.</span>
+ <span class="special">}</span> <span class="identifier">BOOST_LOCAL_EXIT_END</span>
+ <span class="special">...</span>
+ <span class="special">}</span>
+</pre>
+<p>As usual, exceptions specifications can be optionally programmed before the body code block (but the specifications will only apply the body code and not to the library code automatically generated by the macro expansion, see <a class="link" href="boost_local/Advanced.html" title="Advanced Topics">Advanced Topics</a>).</p>
+<p>Within templates, the special macro <code class="computeroutput"><a class="link" href="BOOST_LOCAL_EXIT_TPL.html" title="Macro BOOST_LOCAL_EXIT_TPL">BOOST_LOCAL_EXIT_TPL</a></code> must be used instead of <code class="computeroutput"><a class="link" href="BOOST_LOCAL_EXIT.html" title="Macro BOOST_LOCAL_EXIT">BOOST_LOCAL_EXIT</a></code>.</p>
+<p><span class="bold"><strong>Note:</strong></span> A <code class="computeroutput">return;</code> instruction from within a local exit body jumps to the end of the local exit body and it does not return the enclosing scope.</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">bindings</code></strong></span></td>
+<td>On all C++ compilers, the <span class="emphasis"><em>sequencing macro syntax</em></span> defined by the following grammar is used to specify the variables in scope to bind: <pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"> <span class="identifier">bindings</span><span class="special">:</span>
+ <span class="identifier">void_list</span> <span class="special">|</span> <span class="identifier">bound_list</span>
+ <span class="identifier">void_list</span><span class="special">:</span>
+ <span class="special">(</span><span class="keyword">void</span><span class="special">)</span>
+ <span class="identifier">bound_list</span><span class="special">:</span>
+ <span class="special">(</span><span class="identifier">bound_parameter1</span><span class="special">)</span> <span class="special">(</span><span class="identifier">bound_parameter2</span><span class="special">)</span> <span class="special">...</span>
+ <span class="identifier">bound_parameter</span><span class="special">:</span>
+ <span class="special">[</span><span class="keyword">const</span><span class="special">]</span> <span class="identifier">bind</span><span class="special">[</span><span class="special">&</span><span class="special">]</span> <span class="identifier">variable_name</span>
+</pre> Where the following lexical conventions have been used: <code class="computeroutput">token1 | token2</code> means either <code class="computeroutput">token1</code> or <code class="computeroutput">token2</code>; <code class="computeroutput">[token]</code> means either <code class="computeroutput">token</code> or nothing (i.e., <code class="computeroutput">token</code> is optional).On C99 and later compilers which support variadic macros, the above grammar can be modified as follow to define the <span class="emphasis"><em>variadic macro syntax</em></span> that can also be used to specify the variables in scope to bind: <pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"> <span class="identifier">void_list</span><span class="special">:</span>
+ <span class="keyword">void</span>
+ <span class="identifier">bound_list</span><span class="special">:</span>
+ <span class="identifier">bound_parameter1</span><span class="special">,</span> <span class="identifier">bound_parameter2</span><span class="special">,</span> <span class="special">...</span>
+</pre> Note that the variadic macro syntax uses commas <code class="computeroutput">,</code> instead of parenthesis <code class="computeroutput">()</code> to separate the parameters and therefore resembles the usual C++ function parameter declaration syntax more closely than the sequencing macro syntax. However, the variadic macro syntax will only work on C++ compilers that support variadic macros so it should be used with care in order to avoid portability issues.Finally, on C++ compilers which support empty macro parameters, the above grammars can be modified as follow to define the <span class="emphasis"><em>empty macro syntax</em></span> that can can also be used to specify an empty list of variables to bind: <pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"> <span class="identifier">void_list</span><span class="special">:</span>
+ <span class="special">(</span><span class="special">)</span>
+</pre> Note that the empty macro parameter syntax uses the usual C++ syntax to specify empty bound variable list but it will only work on compilers that support empty macro parameters so it should be used with care in order to avoid portability issues. </td>
+</tr></tbody>
+</table></div>
+<p>
+</p>
+<p><span class="bold"><strong>See:</strong></span> <a class="link" href="boost_local/Tutorial.html" title="Tutorial">Tutorial</a> section, <a class="link" href="boost_local/Advanced.html" title="Advanced Topics">Advanced Topics</a> section, <code class="computeroutput"><a class="link" href="BOOST_LOCAL_EXIT_TPL.html" title="Macro BOOST_LOCAL_EXIT_TPL">BOOST_LOCAL_EXIT_TPL</a></code>, <code class="computeroutput"><a class="link" href="BOOST_LOCAL_EXIT_END.html" title="Macro BOOST_LOCAL_EXIT_END">BOOST_LOCAL_EXIT_END</a></code>. </p>
+</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
Modified: sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT_END.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT_END.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT_END.html 2011-03-18 17:38:31 EDT (Fri, 18 Mar 2011)
@@ -33,9 +33,9 @@
</span>BOOST_LOCAL_EXIT_END</pre></div>
<div class="refsect1">
-<a name="id906463"></a><h2>Description</h2>
-<p>This macro must follow the local exit body code <code class="computeroutput">{ ... }</code> as shown in the <code class="computeroutput">CONTRACT_DETAIL_LOCAL_EXIT</code> documentation.</p>
-<p><span class="bold"><strong>See:</strong></span> <code class="computeroutput">CONTRACT_DETAIL_LOCAL_EXIT</code>, <a class="link" href="boost_local/Tutorial.html" title="Tutorial">Tutorial</a> section. </p>
+<a name="id912434"></a><h2>Description</h2>
+<p>This macro must follow the local exit body code <code class="computeroutput">{ ... }</code> as shown in the <code class="computeroutput"><a class="link" href="BOOST_LOCAL_EXIT.html" title="Macro BOOST_LOCAL_EXIT">BOOST_LOCAL_EXIT</a></code> documentation.</p>
+<p><span class="bold"><strong>See:</strong></span> <code class="computeroutput"><a class="link" href="BOOST_LOCAL_EXIT.html" title="Macro BOOST_LOCAL_EXIT">BOOST_LOCAL_EXIT</a></code>, <a class="link" href="boost_local/Tutorial.html" title="Tutorial">Tutorial</a> section. </p>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
Modified: sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT_TPL.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT_TPL.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT_TPL.html 2011-03-18 17:38:31 EDT (Fri, 18 Mar 2011)
@@ -26,12 +26,16 @@
<a name="BOOST_LOCAL_EXIT_TPL"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Macro BOOST_LOCAL_EXIT_TPL</span></h2>
-<p>BOOST_LOCAL_EXIT_TPL</p>
+<p>BOOST_LOCAL_EXIT_TPL — This macro is the same as <code class="computeroutput"><a class="link" href="BOOST_LOCAL_EXIT.html" title="Macro BOOST_LOCAL_EXIT">BOOST_LOCAL_EXIT</a></code> but it must used when declaring local exits within templates. </p>
</div>
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.local.exit_hpp" title="Header <boost/local/exit.hpp>">boost/local/exit.hpp</a>>
-</span>BOOST_LOCAL_EXIT_TPL(...)</pre></div>
+</span>BOOST_LOCAL_EXIT_TPL(binding_list)</pre></div>
+<div class="refsect1">
+<a name="id912360"></a><h2>Description</h2>
+<p><span class="bold"><strong>See:</strong></span> <code class="computeroutput"><a class="link" href="BOOST_LOCAL_EXIT.html" title="Macro BOOST_LOCAL_EXIT">BOOST_LOCAL_EXIT</a></code>, <a class="link" href="boost_local/Tutorial.html" title="Tutorial">Tutorial</a> section. </p>
+</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
Modified: sandbox/local/libs/local/doc/html/BOOST_LOCAL_FUNCTION_NAME.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_LOCAL_FUNCTION_NAME.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_LOCAL_FUNCTION_NAME.html 2011-03-18 17:38:31 EDT (Fri, 18 Mar 2011)
@@ -7,7 +7,7 @@
<link rel="home" href="index.html" title="Boost.Local 0.1.1">
<link rel="up" href="reference.html#header.boost.local.function_hpp" title="Header <boost/local/function.hpp>">
<link rel="prev" href="BOOST_LOCAL_FUNCTION_PARAMS_TPL.html" title="Macro BOOST_LOCAL_FUNCTION_PARAMS_TPL">
-<link rel="next" href="BOOST_IDENTITY_TYPE.html" title="Macro BOOST_IDENTITY_TYPE">
+<link rel="next" href="BOOST_LOCAL_TYPEOF.html" title="Macro BOOST_LOCAL_TYPEOF">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
@@ -20,18 +20,37 @@
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="BOOST_LOCAL_FUNCTION_PARAMS_TPL.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.local.function_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_IDENTITY_TYPE.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
+<a accesskey="p" href="BOOST_LOCAL_FUNCTION_PARAMS_TPL.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.local.function_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_LOCAL_TYPEOF.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="BOOST_LOCAL_FUNCTION_NAME"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Macro BOOST_LOCAL_FUNCTION_NAME</span></h2>
-<p>BOOST_LOCAL_FUNCTION_NAME</p>
+<p>BOOST_LOCAL_FUNCTION_NAME — This macro is used to specify the local function name. </p>
</div>
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.local.function_hpp" title="Header <boost/local/function.hpp>">boost/local/function.hpp</a>>
-</span>BOOST_LOCAL_FUNCTION_NAME(local_function_name)</pre></div>
+</span>BOOST_LOCAL_FUNCTION_NAME(name)</pre></div>
+<div class="refsect1">
+<a name="id914864"></a><h2>Description</h2>
+<p>This macro must follow the local function body code block <code class="computeroutput">{ ... }</code> as shown in the <code class="computeroutput"><a class="link" href="BOOST_LOCAL_FUNCTION_PARAMS.html" title="Macro BOOST_LOCAL_FUNCTION_PARAMS">BOOST_LOCAL_FUNCTION_PARAMS</a></code> documentation.</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">name</code></strong></span></td>
+<td>The name of the local function. This name cannot be the name of an operator <code class="computeroutput">operator...</code> and it cannot be the same name of another local function declared within the same enclosing scope (i.e., it is not possible to overload local function declarations) -- see the <a class="link" href="boost_local/Advanced.html" title="Advanced Topics">Advanced
+ Topics</a> section. </td>
+</tr></tbody>
+</table></div>
+<p>
+</p>
+<p><span class="bold"><strong>See:</strong></span> <code class="computeroutput"><a class="link" href="BOOST_LOCAL_FUNCTION_PARAMS.html" title="Macro BOOST_LOCAL_FUNCTION_PARAMS">BOOST_LOCAL_FUNCTION_PARAMS</a></code>, <a class="link" href="boost_local/Tutorial.html" title="Tutorial">Tutorial</a> section, <a class="link" href="boost_local/Advanced.html" title="Advanced Topics">Advanced Topics</a> section. </p>
+</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
@@ -43,7 +62,7 @@
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="BOOST_LOCAL_FUNCTION_PARAMS_TPL.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.local.function_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_IDENTITY_TYPE.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
+<a accesskey="p" href="BOOST_LOCAL_FUNCTION_PARAMS_TPL.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.local.function_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_LOCAL_TYPEOF.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
Modified: sandbox/local/libs/local/doc/html/BOOST_LOCAL_FUNCTION_PARAMS.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_LOCAL_FUNCTION_PARAMS.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_LOCAL_FUNCTION_PARAMS.html 2011-03-18 17:38:31 EDT (Fri, 18 Mar 2011)
@@ -26,12 +26,66 @@
<a name="BOOST_LOCAL_FUNCTION_PARAMS"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Macro BOOST_LOCAL_FUNCTION_PARAMS</span></h2>
-<p>BOOST_LOCAL_FUNCTION_PARAMS</p>
+<p>BOOST_LOCAL_FUNCTION_PARAMS — This macro is used to declare the local function parameters. </p>
</div>
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.local.function_hpp" title="Header <boost/local/function.hpp>">boost/local/function.hpp</a>>
-</span>BOOST_LOCAL_FUNCTION_PARAMS(...)</pre></div>
+</span>BOOST_LOCAL_FUNCTION_PARAMS(parameters)</pre></div>
+<div class="refsect1">
+<a name="id913906"></a><h2>Description</h2>
+<p>This macro must be used within a declarative context, it must follow the local function result type, it must be followed by the local function body code and then by the <code class="computeroutput"><a class="link" href="BOOST_LOCAL_FUNCTION_NAME.html" title="Macro BOOST_LOCAL_FUNCTION_NAME">BOOST_LOCAL_FUNCTION_NAME</a></code> macro (see the <a class="link" href="boost_local/Tutorial.html" title="Tutorial">Tutorial</a> and <a class="link" href="boost_local/Advanced.html" title="Advanced Topics">Advanced Topics</a> sections): </p>
+<pre class="programlisting"> <span class="special">{</span> <span class="comment">// Some declarative context.</span>
+ <span class="special">...</span>
+ <span class="identifier">result_type</span> <span class="identifier">BOOST_LOCAL_FUNCTION_PARAMS</span><span class="special">(</span><span class="identifier">parameters</span><span class="special">)</span> <span class="special">{</span>
+ <span class="special">...</span> <span class="comment">// Body code.</span>
+ <span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">name</span><span class="special">)</span>
+ <span class="special">...</span>
+ <span class="special">}</span>
+</pre>
+<p>As usual, exceptions specifications can be optionally programmed before the body code block (but the specifications will only apply the body code and not to the library code automatically generated by the macro expansion, see <a class="link" href="boost_local/Advanced.html" title="Advanced Topics">Advanced Topics</a>).</p>
+<p>Within templates, the special macro <code class="computeroutput"><a class="link" href="BOOST_LOCAL_FUNCTION_PARAMS_TPL.html" title="Macro BOOST_LOCAL_FUNCTION_PARAMS_TPL">BOOST_LOCAL_FUNCTION_PARAMS_TPL</a></code> must be used instead of <code class="computeroutput"><a class="link" href="BOOST_LOCAL_FUNCTION_PARAMS.html" title="Macro BOOST_LOCAL_FUNCTION_PARAMS">BOOST_LOCAL_FUNCTION_PARAMS</a></code>.</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">parameters</code></strong></span></td>
+<td>On all C++ compilers, the <span class="emphasis"><em>sequencing macro syntax</em></span> defined by the following grammar is used to specify the local function parameters: <pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"> <span class="identifier">parameters</span><span class="special">:</span>
+ <span class="identifier">void_list</span> <span class="special">|</span> <span class="identifier">parameter_list</span>
+ <span class="identifier">void_list</span><span class="special">:</span>
+ <span class="special">(</span><span class="keyword">void</span><span class="special">)</span>
+ <span class="identifier">parameter_list</span><span class="special">:</span>
+ <span class="special">(</span><span class="identifier">parameter1</span><span class="special">)</span> <span class="special">(</span><span class="identifier">parameter2</span><span class="special">)</span> <span class="special">...</span>
+ <span class="identifier">parameter</span><span class="special">:</span>
+ <span class="identifier">normal_parameter</span> <span class="special">|</span> <span class="identifier">bound_parameter</span>
+ <span class="identifier">normal_parameter</span><span class="special">:</span>
+ <span class="special">[</span><span class="keyword">auto</span> <span class="special">|</span> <span class="keyword">register</span><span class="special">]</span> <span class="identifier">parameter_type</span> <span class="identifier">parameter_name</span>
+ <span class="special">[</span><span class="identifier">default_parameter_value</span><span class="special">]</span>
+ <span class="identifier">default_parameter_value</span><span class="special">:</span>
+ <span class="special">(</span><span class="identifier">default_value</span><span class="special">)</span>
+ <span class="identifier">default_value</span><span class="special">:</span>
+ <span class="keyword">default</span> <span class="identifier">default_vale_expression</span>
+ <span class="identifier">bound_parameter</span><span class="special">:</span>
+ <span class="special">[</span><span class="keyword">const</span><span class="special">]</span> <span class="identifier">bind</span><span class="special">[</span><span class="special">&</span><span class="special">]</span> <span class="identifier">variable_name</span>
+</pre> Where the following lexical conventions have been used: <code class="computeroutput">token1 | token2</code> means either <code class="computeroutput">token1</code> or <code class="computeroutput">token2</code>; <code class="computeroutput">[token]</code> means either <code class="computeroutput">token</code> or nothing (i.e., <code class="computeroutput">token</code> is optional).On C99 and later compilers which support variadic macros, the above grammar can be modified as follow to define the <span class="emphasis"><em>variadic macro syntax</em></span> that can also be used to specify the local functions parameters: <pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"> <span class="identifier">void_list</span><span class="special">:</span>
+ <span class="keyword">void</span>
+ <span class="identifier">parameter_list</span><span class="special">:</span>
+ <span class="identifier">parameter1</span><span class="special">,</span> <span class="identifier">parameter2</span><span class="special">,</span> <span class="special">...</span>
+ <span class="identifier">default_parameter_value</span><span class="special">:</span>
+ <span class="special">,</span> <span class="identifier">default_value</span>
+</pre> Note that the variadic macro syntax uses commas <code class="computeroutput">,</code> instead of parenthesis <code class="computeroutput">()</code> to separate the parameters and therefore resembles the usual C++ function parameter declaration syntax more closely than the sequencing macro syntax. However, the variadic macro syntax will only work on C++ compilers that support variadic macros so it should be used with care in order to avoid portability issues.Finally, on C++ compilers which support empty macro parameters, the above grammars can be modified as follow to define the <span class="emphasis"><em>empty macro syntax</em></span> that can can also be used to specify an empty parameter list: <pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"> <span class="identifier">void_list</span><span class="special">:</span>
+ <span class="special">(</span><span class="special">)</span>
+</pre> Note that the empty macro parameter syntax uses the usual C++ syntax to specify empty function parameter list but it will only work on compilers that support empty macro parameters so it should be used with care in order to avoid portability issues. </td>
+</tr></tbody>
+</table></div>
+<p>
+</p>
+<p><span class="bold"><strong>Note:</strong></span> Local functions are functors. They cannot be copied but they can be assigned to other functor objects like <code class="computeroutput"><a class="link" href="boost/local/function.html" title="Struct template function">boost::local::function</a></code>.</p>
+<p><span class="bold"><strong>See:</strong></span> <a class="link" href="boost_local/Tutorial.html" title="Tutorial">Tutorial</a> section, <a class="link" href="boost_local/Advanced.html" title="Advanced Topics">Advanced Topics</a> section, <code class="computeroutput"><a class="link" href="BOOST_LOCAL_FUNCTION_PARAMS_TPL.html" title="Macro BOOST_LOCAL_FUNCTION_PARAMS_TPL">BOOST_LOCAL_FUNCTION_PARAMS_TPL</a></code>, <code class="computeroutput"><a class="link" href="BOOST_LOCAL_FUNCTION_NAME.html" title="Macro BOOST_LOCAL_FUNCTION_NAME">BOOST_LOCAL_FUNCTION_NAME</a></code>, <code class="computeroutput"><a class="link" href="boost/local/function.html" title="Struct template function">boost::local::function</a></code>. </p>
+</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
Modified: sandbox/local/libs/local/doc/html/BOOST_LOCAL_FUNCTION_PARAMS_TPL.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_LOCAL_FUNCTION_PARAMS_TPL.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_LOCAL_FUNCTION_PARAMS_TPL.html 2011-03-18 17:38:31 EDT (Fri, 18 Mar 2011)
@@ -26,12 +26,16 @@
<a name="BOOST_LOCAL_FUNCTION_PARAMS_TPL"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Macro BOOST_LOCAL_FUNCTION_PARAMS_TPL</span></h2>
-<p>BOOST_LOCAL_FUNCTION_PARAMS_TPL</p>
+<p>BOOST_LOCAL_FUNCTION_PARAMS_TPL — This macro is the same as <code class="computeroutput"><a class="link" href="BOOST_LOCAL_FUNCTION_PARAMS.html" title="Macro BOOST_LOCAL_FUNCTION_PARAMS">BOOST_LOCAL_FUNCTION_PARAMS</a></code> but it must be used when declaring local functions within templates. </p>
</div>
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.local.function_hpp" title="Header <boost/local/function.hpp>">boost/local/function.hpp</a>>
-</span>BOOST_LOCAL_FUNCTION_PARAMS_TPL(...)</pre></div>
+</span>BOOST_LOCAL_FUNCTION_PARAMS_TPL(parameters)</pre></div>
+<div class="refsect1">
+<a name="id914789"></a><h2>Description</h2>
+<p><span class="bold"><strong>See:</strong></span> <code class="computeroutput"><a class="link" href="BOOST_LOCAL_FUNCTION_PARAMS.html" title="Macro BOOST_LOCAL_FUNCTION_PARAMS">BOOST_LOCAL_FUNCTION_PARAMS</a></code>, <a class="link" href="boost_local/Tutorial.html" title="Tutorial">Tutorial</a> section. </p>
+</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
Modified: sandbox/local/libs/local/doc/html/boost/local/function.html
==============================================================================
--- sandbox/local/libs/local/doc/html/boost/local/function.html (original)
+++ sandbox/local/libs/local/doc/html/boost/local/function.html 2011-03-18 17:38:31 EDT (Fri, 18 Mar 2011)
@@ -26,7 +26,7 @@
<a name="boost.local.function"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Struct template function</span></h2>
-<p>boost::local::function — Template to hold a reference to a local function while supporting eventual default function parameters. </p>
+<p>boost::local::function — Functor with support for default function parameters. </p>
</div>
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="../../reference.html#header.boost.local.function_hpp" title="Header <boost/local/function.hpp>">boost/local/function.hpp</a>>
@@ -35,34 +35,36 @@
<span class="keyword">struct</span> <a class="link" href="function.html" title="Struct template function">function</a> <span class="special">{</span>
<span class="special">}</span><span class="special">;</span></pre></div>
<div class="refsect1">
-<a name="id906798"></a><h2>Description</h2>
-<p>This template defines several specializations to handle a generic number <code class="computeroutput">N</code> of function parameters some of which can have default values. The number of supported function parameters goes from <code class="computeroutput">0</code> (for a function with no parameter) to a maximum of <code class="computeroutput"><a class="link" href="../../BOOST_LOCAL_CONFIG_FUNCTION_ARITY_MAX.html" title="Macro BOOST_LOCAL_CONFIG_FUNCTION_ARITY_MAX">BOOST_LOCAL_CONFIG_FUNCTION_ARITY_MAX</a></code>.</p>
+<a name="id912779"></a><h2>Description</h2>
+<p>This template defines several specializations to handle a generic number of function parameters some of which can have default values. The number of supported function parameters <code class="computeroutput">N</code> goes from <code class="computeroutput">0</code> (for a function with no parameter) to a maximum of <code class="computeroutput"><a class="link" href="../../BOOST_LOCAL_CONFIG_FUNCTION_ARITY_MAX.html" title="Macro BOOST_LOCAL_CONFIG_FUNCTION_ARITY_MAX">BOOST_LOCAL_CONFIG_FUNCTION_ARITY_MAX</a></code>.</p>
<p>Each template specialization defines call operators <code class="computeroutput">operator()(...)</code> with a different set of parameters to handle the number of default parameters specified by <code class="computeroutput">defaults</code> (see <a class="link" href="../../boost_local/Advanced.html" title="Advanced Topics">Advanced</a> section): </p>
<pre class="programlisting"> <span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Result</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Arg1</span><span class="special">,</span> <span class="special">...</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">ArgN</span><span class="special">,</span> <span class="identifier">size_t</span> <span class="identifier">defaults</span> <span class="special">=</span> <span class="number">0</span><span class="special">></span>
- <span class="keyword">class</span> <span class="identifier">function_ref</span><span class="special"><</span><span class="identifier">Result</span> <span class="special">(</span><span class="identifier">Arg1</span><span class="special">,</span> <span class="special">...</span><span class="special">,</span> <span class="identifier">ArgN</span><span class="special">)</span><span class="special">,</span> <span class="identifier">defaults</span><span class="special">></span> <span class="special">{</span>
+ <span class="keyword">class</span> <span class="identifier">function</span><span class="special"><</span><span class="identifier">Result</span> <span class="special">(</span><span class="identifier">Arg1</span><span class="special">,</span> <span class="special">...</span><span class="special">,</span> <span class="identifier">ArgN</span><span class="special">)</span><span class="special">,</span> <span class="identifier">defaults</span><span class="special">></span> <span class="special">{</span>
<span class="keyword">public</span><span class="special">:</span>
<span class="identifier">Result</span> <span class="keyword">operator</span><span class="special">(</span><span class="special">)</span><span class="special">(</span><span class="identifier">Arg1</span><span class="special">,</span> <span class="special">...</span><span class="special">,</span> <span class="identifier">ArgN</span><span class="special">-</span><span class="number">2</span><span class="special">,</span> <span class="identifier">ArgN</span><span class="special">-</span><span class="number">1</span><span class="special">,</span> <span class="identifier">ArgN</span><span class="special">)</span><span class="special">;</span>
<span class="comment">// Call operators to handle default parameters:</span>
- <span class="identifier">Result</span> <span class="keyword">operator</span><span class="special">(</span><span class="special">)</span><span class="special">(</span><span class="identifier">Arg1</span><span class="special">,</span> <span class="special">...</span><span class="special">,</span> <span class="identifier">ArgN</span><span class="special">-</span><span class="number">2</span><span class="special">,</span> <span class="identifier">ArgN</span><span class="special">-</span><span class="number">1</span><span class="special">)</span><span class="special">;</span> <span class="comment">// iff defaults >= 1</span>
- <span class="identifier">Result</span> <span class="keyword">operator</span><span class="special">(</span><span class="special">)</span><span class="special">(</span><span class="identifier">Arg1</span><span class="special">,</span> <span class="special">...</span><span class="special">,</span> <span class="identifier">ArgN</span><span class="special">-</span><span class="number">2</span><span class="special">)</span><span class="special">;</span> <span class="comment">// iff defaults >= 2</span>
- <span class="special">...</span> <span class="comment">// etc</span>
+ <span class="identifier">Result</span> <span class="keyword">operator</span><span class="special">(</span><span class="special">)</span><span class="special">(</span><span class="identifier">Arg1</span><span class="special">,</span> <span class="special">...</span><span class="special">,</span> <span class="identifier">ArgN</span><span class="special">-</span><span class="number">2</span><span class="special">,</span> <span class="identifier">ArgN</span><span class="special">-</span><span class="number">1</span><span class="special">)</span><span class="special">;</span> <span class="comment">// iff defaults >= 1</span>
+ <span class="identifier">Result</span> <span class="keyword">operator</span><span class="special">(</span><span class="special">)</span><span class="special">(</span><span class="identifier">Arg1</span><span class="special">,</span> <span class="special">...</span><span class="special">,</span> <span class="identifier">ArgN</span><span class="special">-</span><span class="number">2</span><span class="special">)</span><span class="special">;</span> <span class="comment">// iff defaults >= 2</span>
+ <span class="special">...</span> <span class="comment">// etc</span>
- <span class="comment">// Copy constructor and assignment operator for local functions:</span>
- <span class="identifier">function_ref</span><span class="special">(</span><span class="identifier">local_function</span><span class="special"><</span><span class="identifier">F</span><span class="special">,</span> <span class="identifier">defaults</span><span class="special">></span><span class="special">&</span> <span class="identifier">ref</span><span class="special">)</span><span class="special">;</span>
- <span class="identifier">function_ref</span><span class="special">&</span> <span class="keyword">operator</span><span class="special">=</span><span class="special">(</span><span class="identifier">local_function</span><span class="special"><</span><span class="identifier">F</span><span class="special">,</span> <span class="identifier">defaults</span><span class="special">></span><span class="special">&</span> <span class="identifier">ref</span><span class="special">)</span><span class="special">;</span>
+ <span class="comment">// Default and copy constructors, and assignment operator.</span>
+ <span class="identifier">function</span><span class="special">(</span><span class="special">)</span><span class="special">;</span>
+ <span class="identifier">function</span><span class="special">(</span><span class="identifier">local_function_type</span><span class="special"><</span><span class="identifier">F</span><span class="special">,</span> <span class="identifier">defaults</span><span class="special">></span> <span class="identifier">local_function</span><span class="special">)</span><span class="special">;</span>
+ <span class="identifier">function</span><span class="special">&</span> <span class="keyword">operator</span><span class="special">=</span><span class="special">(</span><span class="identifier">local_function_type</span><span class="special"><</span><span class="identifier">F</span><span class="special">,</span> <span class="identifier">defaults</span><span class="special">></span> <span class="identifier">local_function</span><span class="special">)</span><span class="special">;</span>
<span class="special">}</span><span class="special">;</span>
</pre>
<p> Where:</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p><code class="computeroutput">Result</code> is the function result type. It can be <code class="computeroutput">void</code>.</p></li>
-<li class="listitem"><p><code class="computeroutput">ArgN</code> is the last function parameter type, <code class="computeroutput">ArgN-1</code> is the second last function parameter type, etc. These are all optional (none is specified for a function with no parameter, only <code class="computeroutput">Arg1</code> is specified for a function with only one parameter, etc).</p></li>
-<li class="listitem"><p>The operator <code class="computeroutput">Result operator()(Arg1, ..., ArgN-2, ArgN-1)</code> is defined if and only if there are one or more default parameters (<code class="computeroutput">defaults >= 1</code>), the operator <code class="computeroutput">Result operator()(Arg1, ..., ArgN-2)</code> is defined if and only if there are two or more default parameters (<code class="computeroutput">defaults >= 2</code>), etc.</p></li>
-<li class="listitem"><p><code class="computeroutput">local_function<F, defaults></code> is an internal type for a local function with a signature matching <code class="computeroutput">F</code> and with a number of default parameters equal to <code class="computeroutput">defaults</code>.</p></li>
-<li class="listitem"><p>The copy constructor and assignment operator <code class="computeroutput">operator=</code> allow to assign this template to a reference to a local function with a signature matching <code class="computeroutput">F</code> and with a number of default parameters equal to <code class="computeroutput">defaults</code>.</p></li>
+<li class="listitem"><p><code class="computeroutput">ArgN</code> is the last function parameter type, <code class="computeroutput">ArgN-1</code> is the second last function parameter type, etc. These are all optional: None is specified for a function with no parameter; Only <code class="computeroutput">Arg1</code> is specified for a function with only one parameter; Etc.</p></li>
+<li class="listitem"><p>The operator <code class="computeroutput">Result operator()(Arg1, ..., ArgN-2, ArgN-1)</code> is declared if and only if there are one or more default parameters (<code class="computeroutput">defaults >= 1</code>), the operator <code class="computeroutput">Result operator()(Arg1, ..., ArgN-2)</code> is defined if and only if there are two or more default parameters (<code class="computeroutput">defaults >= 2</code>), etc.</p></li>
+<li class="listitem"><p><code class="computeroutput">local_function_type<F, defaults></code> is an internal (i.e., implementation specific) type for a local function with a signature matching <code class="computeroutput">F</code> and with a number of default parameters equal to <code class="computeroutput">defaults</code>.</p></li>
+<li class="listitem"><p>The default constructor allows to constructor this functor without assigning it to any function. A run-time error is generated if the call operator <code class="computeroutput">operator()</code> is invoked for a functor not assigned to any function.</p></li>
+<li class="listitem"><p>The copy constructor and assignment operator <code class="computeroutput">operator=</code> allow to assign this functor to a local function with a signature matching <code class="computeroutput">F</code> and with a number of default parameters equal to <code class="computeroutput">defaults</code>.</p></li>
</ul></div>
<p>
</p>
-<p><span class="bold"><strong>Warning:</strong></span> Programmers must make sure that the local function survives the scope of the function reference (otherwise the reference will be invalid and its use will generate a run-time error as usual with C++ references).</p>
+<p><span class="bold"><strong>Warning:</strong></span> Programmers must make sure that the local function assigned to this functor survives the scope of the functor (otherwise the functor will be invalid and its use will generate a run-time error as usual with C++ functors).</p>
<p><span class="bold"><strong>Parameters:</strong></span> </p>
<div class="informaltable"><table class="table">
<colgroup>
@@ -72,7 +74,7 @@
<tbody>
<tr>
<td><span class="bold"><strong><code class="computeroutput">F</code></strong></span></td>
-<td>The function signature expressed using the Boost.Function's preferred syntax: <code class="computeroutput">F = Result (Arg1, ..., ArgN)</code>. </td>
+<td>The function type specifying function signature expressed using the same syntax as Boost.Function's preferred syntax: <code class="computeroutput">F = Result (Arg1, ..., ArgN)</code>. </td>
</tr>
<tr>
<td><span class="bold"><strong><code class="computeroutput">defaults</code></strong></span></td>
@@ -82,8 +84,8 @@
</table></div>
<p>
</p>
-<p><span class="bold"><strong>Note:</strong></span> This template is similar to <code class="computeroutput">boost::function<></code> but it also supports eventual default parameters.</p>
-<p><span class="bold"><strong>See:</strong></span> <a class="link" href="../../boost_local/Advanced.html" title="Advanced Topics">Advanced</a> section, <code class="computeroutput"><a class="link" href="../../BOOST_LOCAL_CONFIG_FUNCTION_ARITY_MAX.html" title="Macro BOOST_LOCAL_CONFIG_FUNCTION_ARITY_MAX">BOOST_LOCAL_CONFIG_FUNCTION_ARITY_MAX</a></code>, <code class="computeroutput">BOOST_LOCAL_FUNCTION</code>, Boost.Function. </p>
+<p><span class="bold"><strong>Note:</strong></span> This functor is similar to Boost.Funciton's <code class="computeroutput">boost::function<></code> but it also supports eventual default parameters.</p>
+<p><span class="bold"><strong>See:</strong></span> <a class="link" href="../../boost_local/Advanced.html" title="Advanced Topics">Advanced Topics</a> section, <code class="computeroutput"><a class="link" href="../../BOOST_LOCAL_CONFIG_FUNCTION_ARITY_MAX.html" title="Macro BOOST_LOCAL_CONFIG_FUNCTION_ARITY_MAX">BOOST_LOCAL_CONFIG_FUNCTION_ARITY_MAX</a></code>, <code class="computeroutput"><a class="link" href="../../BOOST_LOCAL_FUNCTION_PARAMS.html" title="Macro BOOST_LOCAL_FUNCTION_PARAMS">BOOST_LOCAL_FUNCTION_PARAMS</a></code>, <code class="computeroutput"><a class="link" href="../../BOOST_LOCAL_FUNCTION_NAME.html" title="Macro BOOST_LOCAL_FUNCTION_NAME">BOOST_LOCAL_FUNCTION_NAME</a></code>, Boost.Function. </p>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
Modified: sandbox/local/libs/local/doc/html/boost_local/Advanced.html
==============================================================================
--- sandbox/local/libs/local/doc/html/boost_local/Advanced.html (original)
+++ sandbox/local/libs/local/doc/html/boost_local/Advanced.html 2011-03-18 17:38:31 EDT (Fri, 18 Mar 2011)
@@ -29,19 +29,19 @@
<div class="toc"><dl>
<dt><span class="section"><a href="Advanced.html#boost_local.Advanced.commas_and_symbols_in_macro_parameters">Commas
and Symbols in Macro Parameters</a></span></dt>
-<dt><span class="section"><a href="Advanced.html#boost_local.Advanced.deducing_bound_types">Deducing Bound
- Types</a></span></dt>
+<dt><span class="section"><a href="Advanced.html#boost_local.Advanced.deducing_bound_types__concepts__etc_">Deducing
+ Bound Types (concepts, etc)</a></span></dt>
<dt><span class="section"><a href="Advanced.html#boost_local.Advanced.passing_local_functions">Passing
Local Functions</a></span></dt>
<dt><span class="section"><a href="Advanced.html#boost_local.Advanced.exception_specifications">Exception
Specifications</a></span></dt>
-<dt><span class="section"><a href="Advanced.html#boost_local.Advanced.storage_classifiers__auto__and__register_">Storage
- Classifiers <code class="computeroutput"><span class="keyword">auto</span></code> and <code class="computeroutput"><span class="keyword">register</span></code></a></span></dt>
+<dt><span class="section"><a href="Advanced.html#boost_local.Advanced.storage_classifiers___auto__and__register__">Storage
+ Classifiers (<code class="computeroutput"><span class="keyword">auto</span></code> and <code class="computeroutput"><span class="keyword">register</span></code>)</a></span></dt>
<dt><span class="section"><a href="Advanced.html#boost_local.Advanced.recursive_local_functions">Recursive
Local Functions</a></span></dt>
<dt><span class="section">Nested Declarations</span></dt>
-<dt><span class="section"><a href="Advanced.html#boost_local.Advanced.limitations__overloading_and_operators">Limitations:
- Overloading and Operators</a></span></dt>
+<dt><span class="section"><a href="Advanced.html#boost_local.Advanced.limitations__overloading__operators__etc_">Limitations
+ (overloading, operators, etc)</a></span></dt>
</dl></div>
<p>
This section illustrates advanced usage of this library. At the end of this
@@ -82,7 +82,7 @@
<p>
In addition, local function parameter types cannot start with non-alphanumeric
symbols (alphanumeric symbols are <code class="computeroutput"><span class="identifier">A</span><span class="special">-</span><span class="identifier">Z</span></code>, <code class="computeroutput"><span class="identifier">a</span><span class="special">-</span><span class="identifier">z</span></code>,
- and <code class="computeroutput"><span class="number">0</span><span class="special">-</span><span class="number">9</span></code>). <sup>[<a name="id880823" href="#ftn.id880823" class="footnote">15</a>]</sup> The library will generate (cryptic) preprocessor errors if a
+ and <code class="computeroutput"><span class="number">0</span><span class="special">-</span><span class="number">9</span></code>). <sup>[<a name="id881895" href="#ftn.id881895" class="footnote">15</a>]</sup> The library will generate (cryptic) preprocessor errors if a
parameter type starts with a non-alphanumeric symbol.
</p>
<p>
@@ -205,7 +205,7 @@
<li class="listitem">
Parenthesis to wrap the type expression (and therefore any commas <code class="computeroutput"><span class="special">,</span></code> that it contains) passed as parameter
to the <code class="computeroutput"><a class="link" href="../BOOST_IDENTITY_TYPE.html" title="Macro BOOST_IDENTITY_TYPE">BOOST_IDENTITY_TYPE</a></code>
- macro. <sup>[<a name="id882181" href="#ftn.id882181" class="footnote">16</a>]</sup>
+ macro. <sup>[<a name="id883253" href="#ftn.id883253" class="footnote">16</a>]</sup>
</li>
</ol></div>
<p>
@@ -406,7 +406,7 @@
</p></td></tr>
</table></div>
<p>
- Consider the following complete example: <sup>[<a name="id883486" href="#ftn.id883486" class="footnote">17</a>]</sup>
+ Consider the following complete example: <sup>[<a name="id884557" href="#ftn.id884557" class="footnote">17</a>]</sup>
</p>
<div class="informaltable"><table class="table">
<colgroup>
@@ -517,8 +517,8 @@
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
-<a name="boost_local.Advanced.deducing_bound_types"></a><a class="link" href="Advanced.html#boost_local.Advanced.deducing_bound_types" title="Deducing Bound Types">Deducing Bound
- Types</a>
+<a name="boost_local.Advanced.deducing_bound_types__concepts__etc_"></a><a class="link" href="Advanced.html#boost_local.Advanced.deducing_bound_types__concepts__etc_" title="Deducing Bound Types (concepts, etc)">Deducing
+ Bound Types (concepts, etc)</a>
</h3></div></div></div>
<p>
While the ISO C++ standard does not allow for member functions of local classes
@@ -537,21 +537,30 @@
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">typeof</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
<span class="special">...</span> <span class="comment">// Within a local function, local block, or local exit.
-</span><code class="computeroutput">BOOST_LOCAL_TYPEOF</code><span class="special">(</span><span class="emphasis"><em>bound-variable</em></span><span class="special">)</span> <span class="special">...</span>
+</span><code class="computeroutput"><a class="link" href="../BOOST_LOCAL_TYPEOF.html" title="Macro BOOST_LOCAL_TYPEOF">BOOST_LOCAL_TYPEOF</a></code><span class="special">(</span><span class="emphasis"><em>bound-variable</em></span><span class="special">)</span> <span class="special">...</span>
<span class="special">...</span>
</pre>
<p>
This macro expands to a type expression that evaluates (at compile-time)
- to the fully qualified type of the specified bound variable. This type expression
- is fully qualified in the sense that it will be constant if the variable
- is bound by constant and it will also be a reference is the variable is bound
- by reference (if needed, programmers can strip away the <code class="computeroutput"><span class="keyword">const</span></code>
- and <code class="computeroutput"><span class="special">&</span></code> qualifiers using
- <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">remove_const</span></code> and <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">remove_reference</span></code>,
- or similar template metafunctions).
+ to the fully qualified type of the specified bound variable.
</p>
+<div class="note"><table border="0" summary="Note">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../doc/src/images/note.png"></td>
+<th align="left">Note</th>
+</tr>
+<tr><td align="left" valign="top"><p>
+ This type expression is fully qualified in the sense that it will be constant
+ if the variable is bound by constant and it will also be a reference is
+ the variable is bound by reference (if needed, programmers can strip away
+ the <code class="computeroutput"><span class="keyword">const</span></code> and <code class="computeroutput"><span class="special">&</span></code> qualifiers using <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">remove_const</span></code>
+ and <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">remove_reference</span></code>, or similar template
+ metafunctions).
+ </p></td></tr>
+</table></div>
<p>
- For example:
+ The deduced bound type can be used within the body to declare a local variable,
+ to check concepts, etc. For example:
</p>
<div class="informaltable"><table class="table">
<colgroup>
@@ -580,6 +589,7 @@
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">exit</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">typeof</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> <span class="comment">// Typeof header.
</span><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">type_traits</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">concept_check</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">algorithm</span><span class="special">></span>
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">cassert</span><span class="special">></span>
@@ -589,7 +599,8 @@
<span class="keyword">double</span> <span class="identifier">BOOST_LOCAL_FUNCTION_PARAMS</span><span class="special">(</span><span class="keyword">double</span> <span class="identifier">num</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">bind</span> <span class="identifier">factor</span><span class="special">,</span>
<span class="identifier">bind</span><span class="special">&</span> <span class="identifier">sum</span><span class="special">)</span> <span class="special">{</span>
- <span class="identifier">BOOST_LOCAL_TYPEOF</span><span class="special">(</span><span class="identifier">factor</span><span class="special">)</span> <span class="identifier">f</span> <span class="special">=</span> <span class="identifier">factor</span><span class="special">;</span>
+ <span class="comment">// Typeof for variable declaration.
+</span> <span class="identifier">BOOST_LOCAL_TYPEOF</span><span class="special">(</span><span class="identifier">factor</span><span class="special">)</span> <span class="identifier">f</span> <span class="special">=</span> <span class="identifier">factor</span><span class="special">;</span>
<span class="keyword">return</span> <span class="identifier">sum</span> <span class="special">+=</span> <span class="identifier">f</span> <span class="special">*</span> <span class="identifier">num</span><span class="special">;</span>
<span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">add</span><span class="special">)</span>
<span class="identifier">add</span><span class="special">(</span><span class="identifier">x</span><span class="special">);</span>
@@ -597,7 +608,10 @@
<span class="identifier">size_t</span> <span class="identifier">size</span> <span class="special">=</span> <span class="number">2</span><span class="special">;</span>
<span class="keyword">double</span><span class="special">*</span> <span class="identifier">nums</span> <span class="special">=</span> <span class="keyword">new</span> <span class="keyword">double</span><span class="special">[</span><span class="identifier">size</span><span class="special">];</span>
<span class="identifier">BOOST_LOCAL_EXIT</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">bind</span><span class="special">&</span> <span class="identifier">size</span><span class="special">,</span> <span class="identifier">bind</span> <span class="identifier">nums</span><span class="special">)</span> <span class="special">{</span>
- <span class="identifier">BOOST_LOCAL_TYPEOF</span><span class="special">(</span><span class="identifier">size</span><span class="special">)</span> <span class="identifier">s</span> <span class="special">=</span> <span class="identifier">size</span><span class="special">;</span>
+ <span class="comment">// Typeof is qualified with eventual bind's `const` and `&`.
+</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">remove_const</span><span class="special"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">remove_reference</span><span class="special"><</span>
+ <span class="identifier">BOOST_LOCAL_TYPEOF</span><span class="special">(</span><span class="identifier">size</span><span class="special">)>::</span><span class="identifier">type</span><span class="special">>::</span><span class="identifier">type</span> <span class="identifier">s</span><span class="special">;</span>
+ <span class="identifier">s</span> <span class="special">=</span> <span class="identifier">size</span><span class="special">;</span>
<span class="keyword">if</span> <span class="special">(</span><span class="identifier">s</span> <span class="special">&&</span> <span class="identifier">nums</span><span class="special">)</span> <span class="keyword">delete</span><span class="special">[]</span> <span class="identifier">nums</span><span class="special">;</span>
<span class="special">}</span> <span class="identifier">BOOST_LOCAL_EXIT_END</span>
@@ -606,11 +620,10 @@
<span class="identifier">BOOST_LOCAL_BLOCK</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">bind</span> <span class="special">&</span><span class="identifier">sum</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">bind</span><span class="special">&</span> <span class="identifier">factor</span><span class="special">,</span>
<span class="keyword">const</span> <span class="identifier">bind</span><span class="special">&</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">bind</span><span class="special">&</span> <span class="identifier">y</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">bind</span><span class="special">&</span> <span class="identifier">z</span><span class="special">)</span> <span class="special">{</span>
- <span class="comment">// Typeof qualified with eventual bind's `const` and `&`.
-</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">remove_const</span><span class="special"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">remove_reference</span><span class="special"><</span>
- <span class="identifier">BOOST_LOCAL_TYPEOF</span><span class="special">(</span><span class="identifier">sum</span><span class="special">)>::</span><span class="identifier">type</span><span class="special">>::</span><span class="identifier">type</span> <span class="identifier">s</span><span class="special">;</span>
- <span class="identifier">s</span> <span class="special">=</span> <span class="identifier">sum</span><span class="special">;</span>
- <span class="identifier">assert</span><span class="special">(</span><span class="identifier">s</span> <span class="special">==</span> <span class="identifier">factor</span> <span class="special">*</span> <span class="special">(</span><span class="identifier">x</span> <span class="special">+</span> <span class="identifier">y</span> <span class="special">+</span> <span class="identifier">z</span><span class="special">));</span>
+ <span class="comment">// Typeof for concept checking.
+</span> <span class="identifier">BOOST_CONCEPT_ASSERT</span><span class="special">((</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">EqualityComparable</span><span class="special"><</span>
+ <span class="identifier">BOOST_LOCAL_TYPEOF</span><span class="special">(</span><span class="identifier">sum</span><span class="special">)>));</span>
+ <span class="identifier">assert</span><span class="special">(</span><span class="identifier">sum</span> <span class="special">==</span> <span class="identifier">factor</span> <span class="special">*</span> <span class="special">(</span><span class="identifier">x</span> <span class="special">+</span> <span class="identifier">y</span> <span class="special">+</span> <span class="identifier">z</span><span class="special">));</span>
<span class="special">}</span> <span class="identifier">BOOST_LOCAL_BLOCK_END</span>
<span class="keyword">return</span> <span class="identifier">sum</span><span class="special">;</span>
@@ -633,6 +646,7 @@
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">exit</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">typeof</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> <span class="comment">// Typeof header.
</span><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">type_traits</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">concept_check</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">algorithm</span><span class="special">></span>
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">cassert</span><span class="special">></span>
@@ -642,7 +656,8 @@
<span class="keyword">double</span> <span class="identifier">BOOST_LOCAL_FUNCTION_PARAMS</span><span class="special">(</span> <span class="special">(</span><span class="keyword">double</span> <span class="identifier">num</span><span class="special">)</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">bind</span> <span class="identifier">factor</span><span class="special">)</span>
<span class="special">(</span><span class="identifier">bind</span><span class="special">&</span> <span class="identifier">sum</span><span class="special">)</span> <span class="special">)</span> <span class="special">{</span>
- <span class="identifier">BOOST_LOCAL_TYPEOF</span><span class="special">(</span><span class="identifier">factor</span><span class="special">)</span> <span class="identifier">f</span> <span class="special">=</span> <span class="identifier">factor</span><span class="special">;</span>
+ <span class="comment">// Typeof for variable declaration.
+</span> <span class="identifier">BOOST_LOCAL_TYPEOF</span><span class="special">(</span><span class="identifier">factor</span><span class="special">)</span> <span class="identifier">f</span> <span class="special">=</span> <span class="identifier">factor</span><span class="special">;</span>
<span class="keyword">return</span> <span class="identifier">sum</span> <span class="special">+=</span> <span class="identifier">f</span> <span class="special">*</span> <span class="identifier">num</span><span class="special">;</span>
<span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">add</span><span class="special">)</span>
<span class="identifier">add</span><span class="special">(</span><span class="identifier">x</span><span class="special">);</span>
@@ -650,7 +665,10 @@
<span class="identifier">size_t</span> <span class="identifier">size</span> <span class="special">=</span> <span class="number">2</span><span class="special">;</span>
<span class="keyword">double</span><span class="special">*</span> <span class="identifier">nums</span> <span class="special">=</span> <span class="keyword">new</span> <span class="keyword">double</span><span class="special">[</span><span class="identifier">size</span><span class="special">];</span>
<span class="identifier">BOOST_LOCAL_EXIT</span><span class="special">(</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">bind</span><span class="special">&</span> <span class="identifier">size</span><span class="special">)</span> <span class="special">(</span><span class="identifier">bind</span> <span class="identifier">nums</span><span class="special">)</span> <span class="special">)</span> <span class="special">{</span>
- <span class="identifier">BOOST_LOCAL_TYPEOF</span><span class="special">(</span><span class="identifier">size</span><span class="special">)</span> <span class="identifier">s</span> <span class="special">=</span> <span class="identifier">size</span><span class="special">;</span>
+ <span class="comment">// Typeof is qualified with eventual bind's `const` and `&`.
+</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">remove_const</span><span class="special"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">remove_reference</span><span class="special"><</span>
+ <span class="identifier">BOOST_LOCAL_TYPEOF</span><span class="special">(</span><span class="identifier">size</span><span class="special">)>::</span><span class="identifier">type</span><span class="special">>::</span><span class="identifier">type</span> <span class="identifier">s</span><span class="special">;</span>
+ <span class="identifier">s</span> <span class="special">=</span> <span class="identifier">size</span><span class="special">;</span>
<span class="keyword">if</span> <span class="special">(</span><span class="identifier">s</span> <span class="special">&&</span> <span class="identifier">nums</span><span class="special">)</span> <span class="keyword">delete</span><span class="special">[]</span> <span class="identifier">nums</span><span class="special">;</span>
<span class="special">}</span> <span class="identifier">BOOST_LOCAL_EXIT_END</span>
@@ -659,11 +677,10 @@
<span class="identifier">BOOST_LOCAL_BLOCK</span><span class="special">(</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">bind</span> <span class="special">&</span><span class="identifier">sum</span><span class="special">)</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">bind</span><span class="special">&</span> <span class="identifier">factor</span><span class="special">)</span>
<span class="special">(</span><span class="keyword">const</span> <span class="identifier">bind</span><span class="special">&</span> <span class="identifier">x</span><span class="special">)</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">bind</span><span class="special">&</span> <span class="identifier">y</span><span class="special">)</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">bind</span><span class="special">&</span> <span class="identifier">z</span><span class="special">)</span> <span class="special">)</span> <span class="special">{</span>
- <span class="comment">// Typeof qualified with eventual bind's `const` and `&`.
-</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">remove_const</span><span class="special"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">remove_reference</span><span class="special"><</span>
- <span class="identifier">BOOST_LOCAL_TYPEOF</span><span class="special">(</span><span class="identifier">sum</span><span class="special">)>::</span><span class="identifier">type</span><span class="special">>::</span><span class="identifier">type</span> <span class="identifier">s</span><span class="special">;</span>
- <span class="identifier">s</span> <span class="special">=</span> <span class="identifier">sum</span><span class="special">;</span>
- <span class="identifier">assert</span><span class="special">(</span><span class="identifier">s</span> <span class="special">==</span> <span class="identifier">factor</span> <span class="special">*</span> <span class="special">(</span><span class="identifier">x</span> <span class="special">+</span> <span class="identifier">y</span> <span class="special">+</span> <span class="identifier">z</span><span class="special">));</span>
+ <span class="comment">// Typeof for concept checking.
+</span> <span class="identifier">BOOST_CONCEPT_ASSERT</span><span class="special">((</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">EqualityComparable</span><span class="special"><</span>
+ <span class="identifier">BOOST_LOCAL_TYPEOF</span><span class="special">(</span><span class="identifier">sum</span><span class="special">)>));</span>
+ <span class="identifier">assert</span><span class="special">(</span><span class="identifier">sum</span> <span class="special">==</span> <span class="identifier">factor</span> <span class="special">*</span> <span class="special">(</span><span class="identifier">x</span> <span class="special">+</span> <span class="identifier">y</span> <span class="special">+</span> <span class="identifier">z</span><span class="special">));</span>
<span class="special">}</span> <span class="identifier">BOOST_LOCAL_BLOCK_END</span>
<span class="keyword">return</span> <span class="identifier">sum</span><span class="special">;</span>
@@ -680,7 +697,7 @@
</tr></tbody>
</table></div>
<p>
- Within templates, <code class="computeroutput">BOOST_LOCAL_TYPEOF</code>
+ Within templates, <code class="computeroutput"><a class="link" href="../BOOST_LOCAL_TYPEOF.html" title="Macro BOOST_LOCAL_TYPEOF">BOOST_LOCAL_TYPEOF</a></code>
does not require to be prefixed by the <code class="computeroutput"><span class="keyword">typename</span></code>
keyword but eventual type manipulations need the <code class="computeroutput"><span class="keyword">typename</span></code>
prefix as usual:
@@ -712,6 +729,7 @@
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">exit</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">typeof</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> <span class="comment">// Typeof header.
</span><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">type_traits</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">concept_check</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">algorithm</span><span class="special">></span>
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">cassert</span><span class="special">></span>
@@ -722,7 +740,8 @@
<span class="identifier">T</span> <span class="identifier">BOOST_LOCAL_FUNCTION_PARAMS_TPL</span><span class="special">(</span><span class="identifier">T</span> <span class="identifier">num</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">bind</span> <span class="identifier">factor</span><span class="special">,</span>
<span class="identifier">bind</span><span class="special">&</span> <span class="identifier">sum</span><span class="special">)</span> <span class="special">{</span>
- <span class="identifier">BOOST_LOCAL_TYPEOF</span><span class="special">(</span><span class="identifier">factor</span><span class="special">)</span> <span class="identifier">f</span> <span class="special">=</span> <span class="identifier">factor</span><span class="special">;</span>
+ <span class="comment">// Typeof for variable declaratin.
+</span> <span class="identifier">BOOST_LOCAL_TYPEOF</span><span class="special">(</span><span class="identifier">factor</span><span class="special">)</span> <span class="identifier">f</span> <span class="special">=</span> <span class="identifier">factor</span><span class="special">;</span>
<span class="keyword">return</span> <span class="identifier">sum</span> <span class="special">+=</span> <span class="identifier">f</span> <span class="special">*</span> <span class="identifier">num</span><span class="special">;</span>
<span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">add</span><span class="special">)</span>
<span class="identifier">add</span><span class="special">(</span><span class="identifier">x</span><span class="special">);</span>
@@ -730,7 +749,10 @@
<span class="identifier">size_t</span> <span class="identifier">size</span> <span class="special">=</span> <span class="number">2</span><span class="special">;</span>
<span class="identifier">T</span><span class="special">*</span> <span class="identifier">nums</span> <span class="special">=</span> <span class="keyword">new</span> <span class="identifier">T</span><span class="special">[</span><span class="identifier">size</span><span class="special">];</span>
<span class="identifier">BOOST_LOCAL_EXIT_TPL</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">bind</span><span class="special">&</span> <span class="identifier">size</span><span class="special">,</span> <span class="identifier">bind</span> <span class="identifier">nums</span><span class="special">)</span> <span class="special">{</span>
- <span class="identifier">BOOST_LOCAL_TYPEOF</span><span class="special">(</span><span class="identifier">size</span><span class="special">)</span> <span class="identifier">s</span> <span class="special">=</span> <span class="identifier">size</span><span class="special">;</span>
+ <span class="comment">// Typeof is qualified with eventual bind's `const` and `&`.
+</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">remove_const</span><span class="special"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">remove_reference</span><span class="special"><</span>
+ <span class="identifier">BOOST_LOCAL_TYPEOF</span><span class="special">(</span><span class="identifier">size</span><span class="special">)>::</span><span class="identifier">type</span><span class="special">>::</span><span class="identifier">type</span> <span class="identifier">s</span><span class="special">;</span>
+ <span class="identifier">s</span> <span class="special">=</span> <span class="identifier">size</span><span class="special">;</span>
<span class="keyword">if</span> <span class="special">(</span><span class="identifier">s</span> <span class="special">&&</span> <span class="identifier">nums</span><span class="special">)</span> <span class="keyword">delete</span><span class="special">[]</span> <span class="identifier">nums</span><span class="special">;</span>
<span class="special">}</span> <span class="identifier">BOOST_LOCAL_EXIT_END</span>
@@ -739,11 +761,10 @@
<span class="identifier">BOOST_LOCAL_BLOCK_TPL</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">bind</span> <span class="special">&</span><span class="identifier">sum</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">bind</span><span class="special">&</span> <span class="identifier">factor</span><span class="special">,</span>
<span class="keyword">const</span> <span class="identifier">bind</span><span class="special">&</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">bind</span><span class="special">&</span> <span class="identifier">y</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">bind</span><span class="special">&</span> <span class="identifier">z</span><span class="special">)</span> <span class="special">{</span>
- <span class="comment">// Typeof qualified with eventual bind's `const` and `&`.
-</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">remove_const</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">remove_reference</span><span class="special"><</span>
- <span class="identifier">BOOST_LOCAL_TYPEOF</span><span class="special">(</span><span class="identifier">sum</span><span class="special">)>::</span><span class="identifier">type</span><span class="special">>::</span><span class="identifier">type</span> <span class="identifier">s</span><span class="special">;</span>
- <span class="identifier">s</span> <span class="special">=</span> <span class="identifier">sum</span><span class="special">;</span>
- <span class="identifier">assert</span><span class="special">(</span><span class="identifier">s</span> <span class="special">==</span> <span class="identifier">factor</span> <span class="special">*</span> <span class="special">(</span><span class="identifier">x</span> <span class="special">+</span> <span class="identifier">y</span> <span class="special">+</span> <span class="identifier">z</span><span class="special">));</span>
+ <span class="comment">// Tyepof for concept checking.
+</span> <span class="identifier">BOOST_CONCEPT_ASSERT</span><span class="special">((</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">EqualityComparable</span><span class="special"><</span>
+ <span class="identifier">BOOST_LOCAL_TYPEOF</span><span class="special">(</span><span class="identifier">sum</span><span class="special">)>));</span>
+ <span class="identifier">assert</span><span class="special">(</span><span class="identifier">sum</span> <span class="special">==</span> <span class="identifier">factor</span> <span class="special">*</span> <span class="special">(</span><span class="identifier">x</span> <span class="special">+</span> <span class="identifier">y</span> <span class="special">+</span> <span class="identifier">z</span><span class="special">));</span>
<span class="special">}</span> <span class="identifier">BOOST_LOCAL_BLOCK_END</span>
<span class="keyword">return</span> <span class="identifier">sum</span><span class="special">;</span>
@@ -766,6 +787,7 @@
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">exit</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">typeof</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> <span class="comment">// Typeof header.
</span><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">type_traits</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">concept_check</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">algorithm</span><span class="special">></span>
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">cassert</span><span class="special">></span>
@@ -776,7 +798,8 @@
<span class="identifier">T</span> <span class="identifier">BOOST_LOCAL_FUNCTION_PARAMS_TPL</span><span class="special">(</span> <span class="special">(</span><span class="identifier">T</span> <span class="identifier">num</span><span class="special">)</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">bind</span> <span class="identifier">factor</span><span class="special">)</span>
<span class="special">(</span><span class="identifier">bind</span><span class="special">&</span> <span class="identifier">sum</span><span class="special">)</span> <span class="special">)</span> <span class="special">{</span>
- <span class="identifier">BOOST_LOCAL_TYPEOF</span><span class="special">(</span><span class="identifier">factor</span><span class="special">)</span> <span class="identifier">f</span> <span class="special">=</span> <span class="identifier">factor</span><span class="special">;</span>
+ <span class="comment">// Typeof for variable declaration.
+</span> <span class="identifier">BOOST_LOCAL_TYPEOF</span><span class="special">(</span><span class="identifier">factor</span><span class="special">)</span> <span class="identifier">f</span> <span class="special">=</span> <span class="identifier">factor</span><span class="special">;</span>
<span class="keyword">return</span> <span class="identifier">sum</span> <span class="special">+=</span> <span class="identifier">f</span> <span class="special">*</span> <span class="identifier">num</span><span class="special">;</span>
<span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">add</span><span class="special">)</span>
<span class="identifier">add</span><span class="special">(</span><span class="identifier">x</span><span class="special">);</span>
@@ -784,7 +807,10 @@
<span class="identifier">size_t</span> <span class="identifier">size</span> <span class="special">=</span> <span class="number">2</span><span class="special">;</span>
<span class="identifier">T</span><span class="special">*</span> <span class="identifier">nums</span> <span class="special">=</span> <span class="keyword">new</span> <span class="identifier">T</span><span class="special">[</span><span class="identifier">size</span><span class="special">];</span>
<span class="identifier">BOOST_LOCAL_EXIT_TPL</span><span class="special">(</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">bind</span><span class="special">&</span> <span class="identifier">size</span><span class="special">)</span> <span class="special">(</span><span class="identifier">bind</span> <span class="identifier">nums</span><span class="special">)</span> <span class="special">)</span> <span class="special">{</span>
- <span class="identifier">BOOST_LOCAL_TYPEOF</span><span class="special">(</span><span class="identifier">size</span><span class="special">)</span> <span class="identifier">s</span> <span class="special">=</span> <span class="identifier">size</span><span class="special">;</span>
+ <span class="comment">// Typeof is qualified with eventual bind's `const` and `&`.
+</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">remove_const</span><span class="special"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">remove_reference</span><span class="special"><</span>
+ <span class="identifier">BOOST_LOCAL_TYPEOF</span><span class="special">(</span><span class="identifier">size</span><span class="special">)>::</span><span class="identifier">type</span><span class="special">>::</span><span class="identifier">type</span> <span class="identifier">s</span><span class="special">;</span>
+ <span class="identifier">s</span> <span class="special">=</span> <span class="identifier">size</span><span class="special">;</span>
<span class="keyword">if</span> <span class="special">(</span><span class="identifier">s</span> <span class="special">&&</span> <span class="identifier">nums</span><span class="special">)</span> <span class="keyword">delete</span><span class="special">[]</span> <span class="identifier">nums</span><span class="special">;</span>
<span class="special">}</span> <span class="identifier">BOOST_LOCAL_EXIT_END</span>
@@ -793,11 +819,10 @@
<span class="identifier">BOOST_LOCAL_BLOCK_TPL</span><span class="special">(</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">bind</span> <span class="special">&</span><span class="identifier">sum</span><span class="special">)</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">bind</span><span class="special">&</span> <span class="identifier">factor</span><span class="special">)</span>
<span class="special">(</span><span class="keyword">const</span> <span class="identifier">bind</span><span class="special">&</span> <span class="identifier">x</span><span class="special">)</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">bind</span><span class="special">&</span> <span class="identifier">y</span><span class="special">)</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">bind</span><span class="special">&</span> <span class="identifier">z</span><span class="special">)</span> <span class="special">)</span> <span class="special">{</span>
- <span class="comment">// Typeof qualified with eventual bind's `const` and `&`.
-</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">remove_const</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">remove_reference</span><span class="special"><</span>
- <span class="identifier">BOOST_LOCAL_TYPEOF</span><span class="special">(</span><span class="identifier">sum</span><span class="special">)>::</span><span class="identifier">type</span><span class="special">>::</span><span class="identifier">type</span> <span class="identifier">s</span><span class="special">;</span>
- <span class="identifier">s</span> <span class="special">=</span> <span class="identifier">sum</span><span class="special">;</span>
- <span class="identifier">assert</span><span class="special">(</span><span class="identifier">s</span> <span class="special">==</span> <span class="identifier">factor</span> <span class="special">*</span> <span class="special">(</span><span class="identifier">x</span> <span class="special">+</span> <span class="identifier">y</span> <span class="special">+</span> <span class="identifier">z</span><span class="special">));</span>
+ <span class="comment">// Typeof for concept checking.
+</span> <span class="identifier">BOOST_CONCEPT_ASSERT</span><span class="special">((</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">EqualityComparable</span><span class="special"><</span>
+ <span class="identifier">BOOST_LOCAL_TYPEOF</span><span class="special">(</span><span class="identifier">sum</span><span class="special">)>));</span>
+ <span class="identifier">assert</span><span class="special">(</span><span class="identifier">sum</span> <span class="special">==</span> <span class="identifier">factor</span> <span class="special">*</span> <span class="special">(</span><span class="identifier">x</span> <span class="special">+</span> <span class="identifier">y</span> <span class="special">+</span> <span class="identifier">z</span><span class="special">));</span>
<span class="special">}</span> <span class="identifier">BOOST_LOCAL_BLOCK_END</span>
<span class="keyword">return</span> <span class="identifier">sum</span><span class="special">;</span>
@@ -820,8 +845,11 @@
Local Functions</a>
</h3></div></div></div>
<p>
- It is possible to obtain a reference to a local function so to assign it
- to a variable, to pass it as a function parameter, etc.
+ Local functions can be used as functors. For example, it is possible to assign
+ a local function to a functor parameter (using <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span></code>,
+ etc) in order to pass the local function to another function. However, it
+ is in general recommended to use the <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">local</span><span class="special">::</span><a class="link" href="../boost/local/function.html" title="Struct template function">function</a></code>
+ functor because it supports default parameters.
</p>
<div class="important"><table border="0" summary="Important">
<tr>
@@ -829,23 +857,17 @@
<th align="left">Important</th>
</tr>
<tr><td align="left" valign="top"><p>
- Local functions are never copied by value. You can only obtain a reference
- to a local function therefore you need to make sure that the <span class="bold"><strong>local function survives the scope of its reference</strong></span>
- otherwise the reference will be invalid and its use will generate a run-time
- error (as usual with C++ references). <sup>[<a name="id893596" href="#ftn.id893596" class="footnote">18</a>]</sup>
+ When assigning a local function to a functor, programmers need to make
+ sure that the <span class="bold"><strong>local function survives the scope of
+ the functor</strong></span> otherwise the functor will be invalid and its use
+ will generate a run-time error (as usual with C++ functors).
</p></td></tr>
</table></div>
<p>
- For this purpose, it is possible to assign a <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span></code>
- functor to a local function (see also Boost.Function).
- However, it is in general preferable to use the <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">local</span><span class="special">::</span><a class="link" href="../boost/local/function.html" title="Struct template function">function</a></code>
- functor instead because its API also supports default parameters.
- </p>
-<p>
The <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">local</span><span class="special">::</span><a class="link" href="../boost/local/function.html" title="Struct template function">function</a></code> template takes two
parameters (see the Reference section):
</p>
-<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span> <span class="keyword">typename</span> <span class="identifier">F</span><span class="special">,</span> <span class="identifier">size_t</span> <span class="identifier">defaults</span> <span class="special">=</span> <span class="number">0</span> <span class="special">></span> <span class="keyword">class</span> <code class="computeroutput"><a class="link" href="../boost/local/function.html" title="Struct template function">function</a></code><span class="special">;</span>
+<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">F</span><span class="special">,</span> <span class="identifier">size_t</span> <span class="identifier">defaults</span> <span class="special">=</span> <span class="number">0</span><span class="special">></span> <span class="keyword">class</span> <code class="computeroutput"><a class="link" href="../boost/local/function.html" title="Struct template function">function</a></code><span class="special">;</span>
</pre>
<div class="variablelist">
<p class="title"><b></b></p>
@@ -854,11 +876,12 @@
<dd>
<p>
The template parameter <code class="computeroutput"><span class="identifier">F</span></code>
- specifies the function signature using the same syntax as Boost.Function's
+ is a function type specifying the function signature using the same
+ syntax as Boost.Function's
preferred syntax. For example:
</p>
-<pre class="programlisting"><code class="computeroutput"><a class="link" href="../boost/local/function.html" title="Struct template function">function</a></code><span class="special"><</span> <span class="keyword">int</span><span class="special">()</span> <span class="special">></span> <span class="comment">// Returns `int` and takes no parameter.
-</span><code class="computeroutput"><a class="link" href="../boost/local/function.html" title="Struct template function">function</a></code><span class="special"><</span> <span class="keyword">int</span><span class="special">(</span><span class="keyword">double</span><span class="special">,</span> <span class="keyword">char</span><span class="special">)</span> <span class="special">></span> <span class="comment">// Returns `int`and takes two parameters: a `double` followed by a `char`.
+<pre class="programlisting"><code class="computeroutput"><a class="link" href="../boost/local/function.html" title="Struct template function">function</a></code><span class="special"><</span><span class="keyword">int</span><span class="special">()></span> <span class="comment">// Returns `int` and takes no parameter.
+</span><code class="computeroutput"><a class="link" href="../boost/local/function.html" title="Struct template function">function</a></code><span class="special"><</span><span class="keyword">int</span><span class="special">(</span><span class="keyword">double</span><span class="special">,</span> <span class="keyword">char</span><span class="special">)></span> <span class="comment">// Returns `int`and takes two parameters: a `double` followed by a `char`.
</span></pre>
<p>
</p>
@@ -867,19 +890,18 @@
<dd>
<p>
The template parameter <code class="computeroutput"><span class="identifier">defaults</span></code>
- specifies the number of defaults parameters counting from the last
- parameter: <code class="computeroutput"><span class="number">0</span></code> if no parameter
- is optional, <code class="computeroutput"><span class="number">1</span></code> if the last
- parameter is optional, <code class="computeroutput"><span class="number">2</span></code>
- if the last two parameters are optional, etc. This template parameter
- must be between <code class="computeroutput"><span class="number">0</span></code> and the
- total number of parameters as specified by <code class="computeroutput"><span class="identifier">F</span></code>.
- This template parameter is optional and it is <code class="computeroutput"><span class="number">0</span></code>
+ is a non-negative integer number specifying the number of defaults
+ parameters (counting from the last parameter as usual): <code class="computeroutput"><span class="number">0</span></code> if no parameter is optional, <code class="computeroutput"><span class="number">1</span></code> if the last parameter is optional,
+ <code class="computeroutput"><span class="number">2</span></code> if the last two parameters
+ are optional, etc. The <code class="computeroutput"><span class="identifier">defaults</span></code>
+ template parameter must be between <code class="computeroutput"><span class="number">0</span></code>
+ and the total number of parameters as specified by <code class="computeroutput"><span class="identifier">F</span></code>,
+ it is optional and it is <code class="computeroutput"><span class="number">0</span></code>
by default. For example:
</p>
-<pre class="programlisting"><code class="computeroutput"><a class="link" href="../boost/local/function.html" title="Struct template function">function</a></code><span class="special"><</span> <span class="keyword">int</span><span class="special">(</span><span class="keyword">double</span><span class="special">,</span> <span class="keyword">char</span><span class="special">)</span> <span class="special">></span> <span class="comment">// No default: All parameters must be specified.
-</span><code class="computeroutput"><a class="link" href="../boost/local/function.html" title="Struct template function">function</a></code><span class="special"><</span> <span class="keyword">int</span><span class="special">(</span><span class="keyword">double</span><span class="special">,</span> <span class="keyword">char</span><span class="special">),</span> <span class="number">1</span> <span class="special">></span> <span class="comment">// 1 default: The last `char` parameter is optional.
-</span><code class="computeroutput"><a class="link" href="../boost/local/function.html" title="Struct template function">function</a></code><span class="special"><</span> <span class="keyword">int</span><span class="special">(</span><span class="keyword">double</span><span class="special">,</span> <span class="keyword">char</span><span class="special">),</span> <span class="number">2</span> <span class="special">></span> <span class="comment">// 2 defaults: All parameters are optional.
+<pre class="programlisting"><code class="computeroutput"><a class="link" href="../boost/local/function.html" title="Struct template function">function</a></code><span class="special"><</span><span class="keyword">int</span><span class="special">(</span><span class="keyword">double</span><span class="special">,</span> <span class="keyword">char</span><span class="special">)></span> <span class="comment">// No default: All parameters must be specified.
+</span><code class="computeroutput"><a class="link" href="../boost/local/function.html" title="Struct template function">function</a></code><span class="special"><</span><span class="keyword">int</span><span class="special">(</span><span class="keyword">double</span><span class="special">,</span> <span class="keyword">char</span><span class="special">),</span> <span class="number">1</span><span class="special">></span> <span class="comment">// 1 default: The last `char` parameter is optional.
+</span><code class="computeroutput"><a class="link" href="../boost/local/function.html" title="Struct template function">function</a></code><span class="special"><</span><span class="keyword">int</span><span class="special">(</span><span class="keyword">double</span><span class="special">,</span> <span class="keyword">char</span><span class="special">),</span> <span class="number">2</span><span class="special">></span> <span class="comment">// 2 defaults: All parameters are optional.
</span></pre>
<p>
</p>
@@ -1147,16 +1169,92 @@
</h3></div></div></div>
<p>
It is possible to program exception specifications for local functions, local
- blocks, and local exits.
+ blocks, and local exits. Exception specifications are programmed outside
+ the macros and just before the body definition as usual in C++.
</p>
+<div class="important"><table border="0" summary="Important">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Important]" src="../../../../../doc/src/images/important.png"></td>
+<th align="left">Important</th>
+</tr>
+<tr><td align="left" valign="top"><p>
+ However, note that the exception specifications only apply to the body
+ code specified by programmers and they do not apply to the rest of the
+ code automatically generated by the macro expansions to implement local
+ functions, local blocks, and local exits. For example, even if the body
+ code is specified to throw no exception using <code class="computeroutput"><span class="keyword">throw</span>
+ <span class="special">()</span> <span class="special">{</span> <span class="special">...</span> <span class="special">}</span></code>, the
+ execution of the library code automatically generated by the macros could
+ still throw (if there is no memory, etc).
+ </p></td></tr>
+</table></div>
<p>
- Exception specifications are programmed just before the body (and outside
- the macros). For example:
+ For example:
</p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<thead><tr>
+<th>
+ <p>
+ Variadic Macro Syntax (C99 and later compilers)
+ </p>
+ </th>
+<th>
+ <p>
+ Sequencing Macro Syntax (all C++ compilers)
+ </p>
+ </th>
+</tr></thead>
+<tbody><tr>
+<td>
+ <p>
+
+</p>
+<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">function</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">block</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">exit</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">stdexcept</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">algorithm</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">cassert</span><span class="special">></span>
+
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span> <span class="special">{</span>
+ <span class="keyword">double</span> <span class="identifier">sum</span> <span class="special">=</span> <span class="number">0.0</span><span class="special">;</span>
+ <span class="keyword">int</span> <span class="identifier">factor</span> <span class="special">=</span> <span class="number">10</span><span class="special">;</span>
+
+ <span class="keyword">void</span> <span class="identifier">BOOST_LOCAL_FUNCTION_PARAMS</span><span class="special">(</span><span class="keyword">double</span> <span class="identifier">num</span><span class="special">,</span>
+ <span class="keyword">const</span> <span class="identifier">bind</span> <span class="identifier">factor</span><span class="special">,</span> <span class="identifier">bind</span><span class="special">&</span> <span class="identifier">sum</span><span class="special">)</span>
+ <span class="keyword">throw</span> <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">runtime_error</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">logic_error</span><span class="special">)</span> <span class="special">{</span> <span class="comment">// Throw two except.
+</span> <span class="identifier">sum</span> <span class="special">+=</span> <span class="identifier">factor</span> <span class="special">*</span> <span class="identifier">num</span><span class="special">;</span>
+ <span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">add</span><span class="special">)</span>
+ <span class="identifier">add</span><span class="special">(</span><span class="number">100.0</span><span class="special">);</span>
+
+ <span class="identifier">size_t</span> <span class="identifier">size</span> <span class="special">=</span> <span class="number">2</span><span class="special">;</span>
+ <span class="keyword">double</span><span class="special">*</span> <span class="identifier">nums</span> <span class="special">=</span> <span class="keyword">new</span> <span class="keyword">double</span><span class="special">[</span><span class="identifier">size</span><span class="special">];</span>
+ <span class="identifier">BOOST_LOCAL_EXIT</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">bind</span><span class="special">&</span> <span class="identifier">size</span><span class="special">,</span> <span class="identifier">bind</span> <span class="identifier">nums</span><span class="special">)</span> <span class="keyword">throw</span><span class="special">()</span> <span class="special">{</span> <span class="comment">// Throw none.
+</span> <span class="keyword">if</span> <span class="special">(</span><span class="identifier">size</span> <span class="special">&&</span> <span class="identifier">nums</span><span class="special">)</span> <span class="keyword">delete</span><span class="special">[]</span> <span class="identifier">nums</span><span class="special">;</span>
+ <span class="special">}</span> <span class="identifier">BOOST_LOCAL_EXIT_END</span>
+
+ <span class="identifier">nums</span><span class="special">[</span><span class="number">0</span><span class="special">]</span> <span class="special">=</span> <span class="number">90.5</span><span class="special">;</span> <span class="identifier">nums</span><span class="special">[</span><span class="number">1</span><span class="special">]</span> <span class="special">=</span> <span class="number">7.0</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">for_each</span><span class="special">(</span><span class="identifier">nums</span><span class="special">,</span> <span class="identifier">nums</span> <span class="special">+</span> <span class="identifier">size</span><span class="special">,</span> <span class="identifier">add</span><span class="special">);</span>
+
+ <span class="identifier">BOOST_LOCAL_BLOCK</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">bind</span><span class="special">&</span> <span class="identifier">sum</span><span class="special">)</span> <span class="keyword">throw</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">exception</span><span class="special">)</span> <span class="special">{</span> <span class="comment">// Thow one.
+</span> <span class="identifier">assert</span><span class="special">(</span><span class="identifier">sum</span> <span class="special">==</span> <span class="number">1975.0</span><span class="special">);</span>
+ <span class="special">}</span> <span class="identifier">BOOST_LOCAL_BLOCK_END</span>
+
+ <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
<p>
-
+ </p>
+ </td>
+<td>
+ <p>
+
</p>
-<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">function</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">function</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">block</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">exit</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">stdexcept</span><span class="special">></span>
@@ -1191,36 +1289,75 @@
<span class="special">}</span>
</pre>
<p>
- </p>
+ </p>
+ </td>
+</tr></tbody>
+</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
-<a name="boost_local.Advanced.storage_classifiers__auto__and__register_"></a><a class="link" href="Advanced.html#boost_local.Advanced.storage_classifiers__auto__and__register_" title="Storage Classifiers auto and register">Storage
- Classifiers <code class="computeroutput"><span class="keyword">auto</span></code> and <code class="computeroutput"><span class="keyword">register</span></code></a>
+<a name="boost_local.Advanced.storage_classifiers___auto__and__register__"></a><a class="link" href="Advanced.html#boost_local.Advanced.storage_classifiers___auto__and__register__" title="Storage Classifiers (auto and register)">Storage
+ Classifiers (<code class="computeroutput"><span class="keyword">auto</span></code> and <code class="computeroutput"><span class="keyword">register</span></code>)</a>
</h3></div></div></div>
<p>
- As specified in the <a class="link" href="../">Grammar</a> section,
- the parenthesized signature also supports <code class="computeroutput"><span class="keyword">inline</span></code>d
- local functions, and the <code class="computeroutput"><span class="keyword">auto</span></code>
- and <code class="computeroutput"><span class="keyword">register</span></code> classifiers for
- local function parameters.
+ Local function parameters support the storage classifiers as usual in C++.
+ The <code class="computeroutput"><span class="keyword">auto</span></code> storage classifier
+ is specified as:
</p>
-<div class="note"><table border="0" summary="Note">
-<tr>
-<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../doc/src/images/note.png"></td>
-<th align="left">Note</th>
-</tr>
-<tr><td align="left" valign="top"><p>
- However, note that local functions will always add some overhead because
- of the functor object used to internally implement them. Compilers might
- not be able to optimize away the local function overhead even when <code class="computeroutput"><span class="keyword">inline</span></code>, <code class="computeroutput"><span class="keyword">auto</span></code>,
- and <code class="computeroutput"><span class="keyword">register</span></code> are used.
- </p></td></tr>
-</table></div>
+<pre class="programlisting"><span class="keyword">auto</span> <span class="emphasis"><em>parameter-type parameter-name</em></span>
+</pre>
<p>
-
+ and the <code class="computeroutput"><span class="keyword">register</span></code> storage classifier
+ is specified as:
+ </p>
+<pre class="programlisting"><span class="keyword">register</span> <span class="emphasis"><em>parameter-type parameter-name</em></span>
+</pre>
+<p>
+ For example:
+ </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<thead><tr>
+<th>
+ <p>
+ Variadic Macro Syntax (C99 and later compilers)
+ </p>
+ </th>
+<th>
+ <p>
+ Sequencing Macro Syntax (all C++ compilers)
+ </p>
+ </th>
+</tr></thead>
+<tbody><tr>
+<td>
+ <p>
+
</p>
-<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">function</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">function</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span>
+
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span> <span class="special">{</span>
+ <span class="keyword">int</span> <span class="identifier">BOOST_LOCAL_FUNCTION_PARAMS</span><span class="special">(</span><span class="keyword">auto</span> <span class="keyword">int</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">register</span> <span class="keyword">int</span> <span class="identifier">y</span><span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">x</span> <span class="special">+</span> <span class="identifier">y</span><span class="special">;</span>
+ <span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">add</span><span class="special">)</span>
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">add</span><span class="special">(</span><span class="number">3</span><span class="special">,</span> <span class="number">5</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+
+ <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+ </td>
+<td>
+ <p>
+
+</p>
+<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">function</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span>
<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span> <span class="special">{</span>
@@ -1234,7 +1371,10 @@
<span class="special">}</span>
</pre>
<p>
- </p>
+ </p>
+ </td>
+</tr></tbody>
+</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
@@ -1248,10 +1388,64 @@
For example, the following local function is used to recursively calculate
and print the factorial of the specified numbers:
</p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<thead><tr>
+<th>
+ <p>
+ Variadic Macro Syntax (C99 and later compilers)
+ </p>
+ </th>
+<th>
+ <p>
+ Sequencing Macro Syntax (all C++ compilers)
+ </p>
+ </th>
+</tr></thead>
+<tbody><tr>
+<td>
+ <p>
+
+</p>
+<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">function</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">sstream</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">algorithm</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">vector</span><span class="special">></span>
+
+<span class="keyword">int</span> <span class="identifier">main</span> <span class="special">()</span> <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostringstream</span> <span class="identifier">output</span><span class="special">;</span>
+
+ <span class="keyword">int</span> <span class="identifier">BOOST_LOCAL_FUNCTION_PARAMS</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">n</span><span class="special">,</span> <span class="keyword">bool</span> <span class="identifier">recursion</span><span class="special">,</span> <span class="keyword">default</span> <span class="keyword">false</span><span class="special">,</span>
+ <span class="identifier">bind</span><span class="special">&</span> <span class="identifier">output</span><span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">int</span> <span class="identifier">result</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
+
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">n</span> <span class="special"><</span> <span class="number">2</span> <span class="special">)</span> <span class="identifier">result</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span>
+ <span class="keyword">else</span> <span class="identifier">result</span> <span class="special">=</span> <span class="identifier">n</span> <span class="special">*</span> <span class="identifier">factorial</span><span class="special">(</span><span class="identifier">n</span> <span class="special">-</span> <span class="number">1</span><span class="special">,</span> <span class="keyword">true</span><span class="special">);</span> <span class="comment">// Recursive call.
+</span>
+ <span class="keyword">if</span> <span class="special">(!</span><span class="identifier">recursion</span><span class="special">)</span> <span class="identifier">output</span> <span class="special"><<</span> <span class="identifier">result</span> <span class="special"><<</span> <span class="string">" "</span><span class="special">;</span>
+ <span class="keyword">return</span> <span class="identifier">result</span><span class="special">;</span>
+ <span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">factorial</span><span class="special">)</span>
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">int</span><span class="special">></span> <span class="identifier">v</span><span class="special">(</span><span class="number">3</span><span class="special">);</span>
+ <span class="identifier">v</span><span class="special">[</span><span class="number">0</span><span class="special">]</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> <span class="identifier">v</span><span class="special">[</span><span class="number">1</span><span class="special">]</span> <span class="special">=</span> <span class="number">4</span><span class="special">;</span> <span class="identifier">v</span><span class="special">[</span><span class="number">2</span><span class="special">]</span> <span class="special">=</span> <span class="number">7</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">for_each</span><span class="special">(</span><span class="identifier">v</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">end</span><span class="special">(),</span> <span class="identifier">factorial</span><span class="special">);</span>
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">output</span><span class="special">.</span><span class="identifier">str</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
<p>
-
+ </p>
+ </td>
+<td>
+ <p>
+
</p>
-<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">function</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">function</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span>
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">sstream</span><span class="special">></span>
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">algorithm</span><span class="special">></span>
@@ -1280,133 +1474,137 @@
<span class="special">}</span>
</pre>
<p>
- </p>
-<p>
- The original local function name as specified in the parenthesized signature
- passed to <code class="computeroutput"><span class="identifier">__BOOST_LOCAL_FUNCTION__</span></code>
- must always be used for recursive calls even when the function is renamed
- using <code class="computeroutput"><span class="identifier">__BOOST_LOCAL_FUNCTION_END_RENAME__</span></code>
- (see renamed local functions later in this section).
- </p>
+ </p>
+ </td>
+</tr></tbody>
+</table></div>
</div>
-<div class="section"><div class="titlepage"><div><div><h3 class="title">
-<a name="boost_local.Advanced.nested_declarations"></a><a class="link" href="Advanced.html#boost_local.Advanced.nested_declarations" title="Nested Declarations">Nested Declarations</a>
-</h3></div></div></div></div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
-<a name="boost_local.Advanced.limitations__overloading_and_operators"></a><a class="link" href="Advanced.html#boost_local.Advanced.limitations__overloading_and_operators" title="Limitations: Overloading and Operators">Limitations:
- Overloading and Operators</a>
+<a name="boost_local.Advanced.nested_declarations"></a><a class="link" href="Advanced.html#boost_local.Advanced.nested_declarations" title="Nested Declarations">Nested Declarations</a>
</h3></div></div></div>
<p>
- This is a list of limitations of this library's local functions compared
- to usual features of C++ functions.
+ It is possible to nest local function, local block, and local exit declarations
+ into one another.
</p>
-<a name="boost_local.Advanced.limitations__overloading_and_operators.overloading"></a><h6>
-<a name="id903180"></a>
- <a class="link" href="Advanced.html#boost_local.Advanced.limitations__overloading_and_operators.overloading">Overloading</a>
- </h6>
<p>
- It is not possible to overload local functions. Declaring multiple local
- functions with the same name within the same enclosing scope generates a
- compile-time error (even if the different declarations specify different
- parameters). <sup>[<a name="id903199" href="#ftn.id903199" class="footnote">19</a>]</sup>
- </p>
-<p>
- For example, the following code will <span class="bold"><strong>not</strong></span>
- compile:
- </p>
-<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">f</span><span class="special">()</span> <span class="special">{</span>
- <span class="identifier">__BOOST_LOCAL_FUNCTION__</span><span class="special">(</span>
- <span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">(</span><span class="identifier">l</span><span class="special">)(</span> <span class="special">(</span><span class="keyword">const</span> <span class="keyword">int</span><span class="special">&)(</span><span class="identifier">i</span><span class="special">)</span> <span class="special">)</span>
- <span class="special">)</span> <span class="special">{</span>
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">i</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
- <span class="special">}</span> <span class="identifier">__BOOST_LOCAL_FUNCTION_END__</span><span class="special">(</span><span class="identifier">l</span><span class="special">)</span>
-
- <span class="identifier">__BOOST_LOCAL_FUNCTION__</span><span class="special">(</span>
- <span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">(</span><span class="identifier">l</span><span class="special">)(</span> <span class="special">(</span><span class="keyword">const</span> <span class="keyword">double</span><span class="special">&)(</span><span class="identifier">d</span><span class="special">)</span> <span class="special">)</span>
- <span class="special">)</span> <span class="special">{</span>
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">d</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
- <span class="special">}</span> <span class="identifier">__BOOST_LOCAL_FUNCTION_END__</span><span class="special">(</span><span class="identifier">l</span><span class="special">)</span> <span class="comment">// Error: Cannot overload.
-</span>
- <span class="special">...</span>
-<span class="special">}</span>
-</pre>
-<a name="boost_local.Advanced.limitations__overloading_and_operators.nesting"></a><h6>
-<a name="id903640"></a>
- <a class="link" href="Advanced.html#boost_local.Advanced.limitations__overloading_and_operators.nesting">Nesting</a>
- </h6>
-<p>
- It is not possible to nest local functions, local blocks, or local exits
- within each other. Nesting will generate a compile-time error. <sup>[<a name="id903662" href="#ftn.id903662" class="footnote">20</a>]</sup>
- </p>
-<p>
- For example, the following code will <span class="bold"><strong>not</strong></span>
- compile:
+ For example:
</p>
-<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">f</span><span class="special">()</span> <span class="special">{</span>
- <span class="identifier">__BOOST_LOCAL_FUNCTION__</span><span class="special">(</span>
- <span class="special">(</span><span class="keyword">int</span><span class="special">)</span> <span class="special">(</span><span class="identifier">l</span><span class="special">)(</span> <span class="special">(</span><span class="keyword">int</span><span class="special">)(</span><span class="identifier">i</span><span class="special">)</span> <span class="special">)</span>
- <span class="special">)</span> <span class="special">{</span>
- <span class="identifier">__BOOST_LOCAL_FUNCTION__</span><span class="special">(</span> <span class="comment">// Error: Cannot nest.
-</span> <span class="special">(</span><span class="keyword">int</span><span class="special">)</span> <span class="special">(</span><span class="identifier">m</span><span class="special">)(</span> <span class="special">(</span><span class="keyword">int</span><span class="special">)(</span><span class="identifier">j</span><span class="special">)</span> <span class="special">)</span>
- <span class="special">)</span> <span class="special">{</span>
- <span class="keyword">return</span> <span class="identifier">j</span> <span class="special">*</span> <span class="number">10</span><span class="special">;</span>
- <span class="special">}</span> <span class="identifier">__BOOST_LOCAL_FUNCTION_END__</span><span class="special">(</span><span class="identifier">m</span><span class="special">)</span>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<thead><tr>
+<th>
+ <p>
+ Variadic Macro Syntax (C99 and later compilers)
+ </p>
+ </th>
+<th>
+ <p>
+ Sequencing Macro Syntax (all C++ compilers)
+ </p>
+ </th>
+</tr></thead>
+<tbody><tr>
+<td>
+ <p>
+
+</p>
+<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">function</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">block</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">exit</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">cassert</span><span class="special">></span>
- <span class="keyword">return</span> <span class="identifier">m</span><span class="special">(</span><span class="identifier">i</span><span class="special">)</span> <span class="special">*</span> <span class="number">10</span><span class="special">;</span>
- <span class="special">}</span> <span class="identifier">__BOOST_LOCAL_FUNCTION_END__</span><span class="special">(</span><span class="identifier">l</span><span class="special">)</span>
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span> <span class="special">{</span>
+ <span class="keyword">int</span> <span class="identifier">x</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
- <span class="special">...</span>
+ <span class="comment">// Local functions nested into one another.
+</span> <span class="keyword">void</span> <span class="identifier">BOOST_LOCAL_FUNCTION_PARAMS</span><span class="special">(</span><span class="identifier">bind</span><span class="special">&</span> <span class="identifier">x</span><span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"l: "</span> <span class="special"><<</span> <span class="identifier">x</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+
+ <span class="keyword">void</span> <span class="identifier">BOOST_LOCAL_FUNCTION_PARAMS</span><span class="special">(</span><span class="identifier">bind</span><span class="special">&</span> <span class="identifier">x</span><span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"m: "</span> <span class="special"><<</span> <span class="identifier">x</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">m</span><span class="special">)</span>
+
+ <span class="identifier">x</span><span class="special">--;</span> <span class="identifier">m</span><span class="special">();</span>
+ <span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">l</span><span class="special">)</span>
+
+ <span class="comment">// Local functions, blocks and exits nested into each other.
+</span> <span class="keyword">void</span> <span class="identifier">BOOST_LOCAL_FUNCTION_PARAMS</span><span class="special">(</span><span class="identifier">bind</span><span class="special">&</span> <span class="identifier">x</span><span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">BOOST_LOCAL_EXIT</span><span class="special">(</span><span class="identifier">bind</span><span class="special">&</span> <span class="identifier">x</span><span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">x</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
+ <span class="identifier">BOOST_LOCAL_BLOCK</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">bind</span><span class="special">&</span> <span class="identifier">x</span><span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">assert</span><span class="special">(</span><span class="identifier">x</span> <span class="special">==</span> <span class="number">0</span><span class="special">);</span>
+ <span class="special">}</span> <span class="identifier">BOOST_LOCAL_BLOCK_END</span>
+ <span class="special">}</span> <span class="identifier">BOOST_LOCAL_EXIT_END</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"n: "</span> <span class="special"><<</span> <span class="identifier">x</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">n</span><span class="special">)</span>
+
+ <span class="identifier">x</span><span class="special">--;</span> <span class="identifier">l</span><span class="special">();</span>
+ <span class="identifier">x</span><span class="special">--;</span> <span class="identifier">n</span><span class="special">();</span>
+ <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
<span class="special">}</span>
</pre>
-<a name="boost_local.Advanced.limitations__overloading_and_operators.operators"></a><h6>
-<a name="id904064"></a>
- <a class="link" href="Advanced.html#boost_local.Advanced.limitations__overloading_and_operators.operators">Operators</a>
- </h6>
-<p>
- Local functions cannot be operators. Naming a local function <code class="computeroutput"><span class="keyword">operator</span><span class="special">...</span></code>
- will generate a compile-time error. <sup>[<a name="id904100" href="#ftn.id904100" class="footnote">21</a>]</sup>
- </p>
<p>
- For example, the following code will <span class="bold"><strong>not</strong></span>
- compile:
- </p>
-<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">f</span><span class="special">()</span> <span class="special">{</span>
- <span class="keyword">struct</span> <span class="identifier">point</span> <span class="special">{</span>
- <span class="keyword">double</span> <span class="identifier">x</span><span class="special">;</span>
- <span class="keyword">double</span> <span class="identifier">y</span><span class="special">;</span>
- <span class="special">};</span>
+ </p>
+ </td>
+<td>
+ <p>
+
+</p>
+<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">function</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">block</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">exit</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">cassert</span><span class="special">></span>
- <span class="identifier">__BOOST_LOCAL_FUNCTION__</span><span class="special">(</span> <span class="comment">// Error: Cannot be `operator==`.
-</span> <span class="special">(</span><span class="keyword">bool</span><span class="special">)</span> <span class="special">(</span><span class="keyword">operator</span><span class="special">==)(</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">point</span><span class="special">&)(</span><span class="identifier">p</span><span class="special">)</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">point</span><span class="special">&)(</span><span class="identifier">q</span><span class="special">)</span> <span class="special">)</span>
- <span class="special">)</span> <span class="special">{</span>
- <span class="keyword">return</span> <span class="identifier">p</span><span class="special">.</span><span class="identifier">x</span> <span class="special">==</span> <span class="identifier">q</span><span class="special">.</span><span class="identifier">x</span> <span class="special">&&</span> <span class="identifier">p</span><span class="special">.</span><span class="identifier">y</span> <span class="special">==</span> <span class="identifier">q</span><span class="special">.</span><span class="identifier">y</span><span class="special">;</span>
- <span class="special">)</span> <span class="identifier">__BOOST_LOCAL_FUNCTION_END__</span><span class="special">(</span><span class="keyword">operator</span><span class="special">==)</span>
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span> <span class="special">{</span>
+ <span class="keyword">int</span> <span class="identifier">x</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
- <span class="special">...</span>
+ <span class="comment">// Local functions nested into one another.
+</span> <span class="keyword">void</span> <span class="identifier">BOOST_LOCAL_FUNCTION_PARAMS</span><span class="special">(</span> <span class="special">(</span><span class="identifier">bind</span><span class="special">&</span> <span class="identifier">x</span><span class="special">)</span> <span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"l: "</span> <span class="special"><<</span> <span class="identifier">x</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+
+ <span class="keyword">void</span> <span class="identifier">BOOST_LOCAL_FUNCTION_PARAMS</span><span class="special">(</span> <span class="special">(</span><span class="identifier">bind</span><span class="special">&</span> <span class="identifier">x</span><span class="special">)</span> <span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"m: "</span> <span class="special"><<</span> <span class="identifier">x</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">m</span><span class="special">)</span>
+
+ <span class="identifier">x</span><span class="special">--;</span> <span class="identifier">m</span><span class="special">();</span>
+ <span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">l</span><span class="special">)</span>
+
+ <span class="comment">// Local functions, blocks and exits nested into each other.
+</span> <span class="keyword">void</span> <span class="identifier">BOOST_LOCAL_FUNCTION_PARAMS</span><span class="special">(</span> <span class="special">(</span><span class="identifier">bind</span><span class="special">&</span> <span class="identifier">x</span><span class="special">)</span> <span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">BOOST_LOCAL_EXIT</span><span class="special">(</span> <span class="special">(</span><span class="identifier">bind</span><span class="special">&</span> <span class="identifier">x</span><span class="special">)</span> <span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">x</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
+ <span class="identifier">BOOST_LOCAL_BLOCK</span><span class="special">(</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">bind</span><span class="special">&</span> <span class="identifier">x</span><span class="special">)</span> <span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">assert</span><span class="special">(</span><span class="identifier">x</span> <span class="special">==</span> <span class="number">0</span><span class="special">);</span>
+ <span class="special">}</span> <span class="identifier">BOOST_LOCAL_BLOCK_END</span>
+ <span class="special">}</span> <span class="identifier">BOOST_LOCAL_EXIT_END</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"n: "</span> <span class="special"><<</span> <span class="identifier">x</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">n</span><span class="special">)</span>
+
+ <span class="identifier">x</span><span class="special">--;</span> <span class="identifier">l</span><span class="special">();</span>
+ <span class="identifier">x</span><span class="special">--;</span> <span class="identifier">n</span><span class="special">();</span>
+ <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
<span class="special">}</span>
</pre>
-<a name="boost_local.Advanced.limitations__overloading_and_operators.etc"></a><h6>
-<a name="id904493"></a>
- <a class="link" href="Advanced.html#boost_local.Advanced.limitations__overloading_and_operators.etc">Etc</a>
- </h6>
<p>
- Some usual C++ function features like <code class="computeroutput"><span class="keyword">inline</span></code>
- and default parameters are supported for local functions while other features
- are not supported. The parenthesized syntax itself (see the <a class="link" href="../">Grammar</a>
- section) could be extended to support <span class="emphasis"><em>all</em></span> C++ function
- features even with the addition of concepts and named parameters (see Contract++):
- </p>
-<pre class="programlisting"><span class="emphasis"><em>parenthesized-signature:</em></span>
- <span class="emphasis"><em>[</em></span><span class="special">(</span><span class="keyword">export</span><span class="special">)</span><span class="emphasis"><em>]</em></span> <span class="emphasis"><em>[</em></span><span class="special">(</span><span class="keyword">template</span><span class="special">)(</span><span class="emphasis"><em>template-parameter-list</em></span><span class="special">)</span><span class="emphasis"><em>]</em></span> <span class="emphasis"><em>[</em></span><span class="special">(</span><span class="identifier">requires</span><span class="special">)(</span><span class="emphasis"><em>concept-list</em></span><span class="special">)</span><span class="emphasis"><em>]</em></span>
- <span class="emphasis"><em>[</em></span><span class="special">(</span><span class="keyword">explicit</span><span class="special">)</span><span class="emphasis"><em>]</em></span>
- <span class="emphasis"><em>[</em></span><span class="special">(</span><span class="keyword">inline</span><span class="special">)</span><span class="emphasis"><em>]</em></span> <span class="emphasis"><em>[</em></span><span class="special">(</span><span class="keyword">extern</span><span class="special">)</span><span class="emphasis"><em>]</em></span>
- <span class="emphasis"><em>[</em></span><span class="special">(</span><span class="keyword">static</span><span class="special">)</span><span class="emphasis"><em>]</em></span> <span class="emphasis"><em>[</em></span><span class="special">(</span><span class="keyword">virtual</span><span class="special">)</span><span class="emphasis"><em>]</em></span>
- <span class="special">(</span><span class="emphasis"><em>result-type</em></span><span class="special">)</span> <span class="special">(</span><span class="emphasis"><em>function-name</em></span><span class="special">)(</span><span class="emphasis"><em>parameter-list</em></span><span class="special">)</span>
- <span class="emphasis"><em>[</em></span><span class="special">(</span><span class="keyword">const</span><span class="special">)</span><span class="emphasis"><em>]</em></span> <span class="emphasis"><em>[</em></span><span class="special">(</span><span class="keyword">volatile</span><span class="special">)</span><span class="emphasis"><em>]</em></span>
-</pre>
+ </p>
+ </td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_local.Advanced.limitations__overloading__operators__etc_"></a><a class="link" href="Advanced.html#boost_local.Advanced.limitations__overloading__operators__etc_" title="Limitations (overloading, operators, etc)">Limitations
+ (overloading, operators, etc)</a>
+</h3></div></div></div>
<p>
- However, not all these features apply to local functions:
+ The following table summarizes all the usual C++ function features that are
+ not supported for local functions.
</p>
<div class="informaltable"><table class="table">
<colgroup>
@@ -1427,7 +1625,7 @@
</th>
<th>
<p>
- Rationale
+ Reason
</p>
</th>
</tr></thead>
@@ -1435,7 +1633,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="special">(</span><span class="keyword">export</span><span class="special">)</span></code>
+ <code class="computeroutput"><span class="keyword">export</span></code>
</p>
</td>
<td>
@@ -1453,7 +1651,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="special">(</span><span class="keyword">template</span><span class="special">)(</span></code><span class="emphasis"><em>template-parameter-list</em></span><code class="computeroutput"><span class="special">)</span></code>
+ <code class="computeroutput"><span class="keyword">template</span><span class="special"><</span></code><span class="emphasis"><em>template-parameter-list</em></span><code class="computeroutput"><span class="special">></span></code>
</p>
</td>
<td>
@@ -1471,27 +1669,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="special">(</span><span class="identifier">requires</span><span class="special">)(</span></code><span class="emphasis"><em>concept-list</em></span><code class="computeroutput"><span class="special">)</span></code>
- </p>
- </td>
-<td>
- <p>
- No
- </p>
- </td>
-<td>
- <p>
- This library could internally use Boost.ConceptCheck
- to check the concepts specified by using the parenthesized syntax.
- However, concept checking is not supported because local functions
- cannot be templates.
- </p>
- </td>
-</tr>
-<tr>
-<td>
- <p>
- <code class="computeroutput"><span class="special">(</span><span class="keyword">explicit</span><span class="special">)</span></code>
+ <code class="computeroutput"><span class="keyword">explicit</span></code>
</p>
</td>
<td>
@@ -1508,25 +1686,26 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="special">(</span><span class="keyword">inline</span><span class="special">)</span></code>
+ <code class="computeroutput"><span class="keyword">inline</span></code>
</p>
</td>
<td>
<p>
- Yes
+ No
</p>
</td>
<td>
<p>
- This is supported (see the <a class="link" href="Advanced.html" title="Advanced Topics">Advanced</a>
- section).
+ Local functions are always defined together with their declarations
+ so they are always inlined and there is no need to specify them
+ <code class="computeroutput"><span class="keyword">inline</span></code>.
</p>
</td>
</tr>
<tr>
<td>
<p>
- <code class="computeroutput"><span class="special">(</span><span class="keyword">extern</span><span class="special">)</span></code>
+ <code class="computeroutput"><span class="keyword">extern</span></code>
</p>
</td>
<td>
@@ -1544,7 +1723,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="special">(</span><span class="keyword">static</span><span class="special">)</span></code>
+ <code class="computeroutput"><span class="keyword">static</span></code>
</p>
</td>
<td>
@@ -1561,7 +1740,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="special">(</span><span class="keyword">virtual</span><span class="special">)</span></code>
+ <code class="computeroutput"><span class="keyword">virtual</span></code>
</p>
</td>
<td>
@@ -1589,7 +1768,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="special">(</span></code><span class="emphasis"><em>result-type</em></span><code class="computeroutput"><span class="special">)</span></code>
+ <code class="literal"><span class="emphasis"><em>result-type</em></span></code>
</p>
</td>
<td>
@@ -1607,7 +1786,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="special">(</span></code><span class="emphasis"><em>function-name</em></span><code class="computeroutput"><span class="special">)</span></code>
+ <code class="literal"><span class="emphasis"><em>function-name</em></span></code>
</p>
</td>
<td>
@@ -1619,14 +1798,15 @@
<p>
This is supported but it cannot be overloaded and it cannot be
an operator (see the <a class="link" href="Tutorial.html" title="Tutorial">Tutorial</a>
- and <a class="link" href="Advanced.html" title="Advanced Topics">Advanced</a> sections).
+ and <a class="link" href="../">Advanced Topics</a>
+ sections).
</p>
</td>
</tr>
<tr>
<td>
<p>
- <code class="computeroutput"><span class="special">(</span></code><span class="emphasis"><em>parameter-list</em></span><code class="computeroutput"><span class="special">)</span></code>
+ <code class="literal"><span class="emphasis"><em>parameter-list</em></span></code>
</p>
</td>
<td>
@@ -1637,26 +1817,18 @@
<td>
<p>
This is supported and it also supports the <code class="computeroutput"><span class="keyword">auto</span></code>
- and <code class="computeroutput"><span class="keyword">register</span></code> parameter
+ and <code class="computeroutput"><span class="keyword">register</span></code> storage
classifiers, default parameters, and binding of variables in scope
(see the <a class="link" href="Tutorial.html" title="Tutorial">Tutorial</a> and
- <a class="link" href="Advanced.html" title="Advanced Topics">Advanced</a> sections).
- </p>
- <p>
- In addition, the parenthesized syntax could support named parameters
- introducing the "keywords" <code class="computeroutput"><span class="special">(</span><span class="identifier">in</span><span class="special">)</span></code>,
- <code class="computeroutput"><span class="special">(</span><span class="identifier">out</span><span class="special">)</span></code>, <code class="computeroutput"><span class="special">(</span><span class="identifier">inout</span><span class="special">)</span></code>,
- and then using Boost.Paramater
- to internally implement named parameters. However, local functions
- cannot be templates so they cannot be used with Boost.Paramater
- thus named parameters are not supported for local functions.
+ <a class="link" href="../">Advanced Topics</a>
+ sections).
</p>
</td>
</tr>
<tr>
<td>
<p>
- Trailing <code class="computeroutput"><span class="special">(</span><span class="keyword">const</span><span class="special">)</span></code>
+ Trailing <code class="computeroutput"><span class="keyword">const</span></code> qualifier
</p>
</td>
<td>
@@ -1673,7 +1845,8 @@
<tr>
<td>
<p>
- Trailing <code class="computeroutput"><span class="special">(</span><span class="keyword">volatile</span><span class="special">)</span></code>
+ Trailing <code class="computeroutput"><span class="keyword">volatile</span></code>
+ qualifier
</p>
</td>
<td>
@@ -1689,24 +1862,76 @@
</tr>
</tbody>
</table></div>
+<a name="boost_local.Advanced.limitations__overloading__operators__etc_.overloading"></a><h6>
+<a name="id909609"></a>
+ <a class="link" href="Advanced.html#boost_local.Advanced.limitations__overloading__operators__etc_.overloading">Overloading</a>
+ </h6>
+<p>
+ It is not possible to overload local functions. Declaring multiple local
+ functions with the same name within the same enclosing scope generates a
+ compile-time error (even if the different declarations specify different
+ parameters). <sup>[<a name="id909633" href="#ftn.id909633" class="footnote">18</a>]</sup>
+ </p>
+<p>
+ For example, the following code will <span class="bold"><strong>not</strong></span>
+ compile:
+ </p>
+<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">f</span><span class="special">()</span> <span class="special">{</span>
+ <span class="keyword">void</span> <code class="computeroutput"><a class="link" href="../BOOST_LOCAL_FUNCTION_PARAMS.html" title="Macro BOOST_LOCAL_FUNCTION_PARAMS">BOOST_LOCAL_FUNCTION_PARAMS</a></code><span class="special">(</span> <span class="special">(</span><span class="keyword">const</span> <span class="keyword">int</span><span class="special">&</span> <span class="identifier">i</span><span class="special">)</span> <span class="special">)</span> <span class="special">{</span>
+ <span class="special">...</span>
+ <span class="special">}</span> <code class="computeroutput"><a class="link" href="../BOOST_LOCAL_FUNCTION_NAME.html" title="Macro BOOST_LOCAL_FUNCTION_NAME">BOOST_LOCAL_FUNCTION_NAME</a></code><span class="special">(</span><span class="identifier">l</span><span class="special">)</span>
+
+ <span class="keyword">void</span> <code class="computeroutput"><a class="link" href="../BOOST_LOCAL_FUNCTION_PARAMS.html" title="Macro BOOST_LOCAL_FUNCTION_PARAMS">BOOST_LOCAL_FUNCTION_PARAMS</a></code><span class="special">(</span> <span class="special">(</span><span class="keyword">const</span> <span class="keyword">double</span><span class="special">&</span> <span class="identifier">d</span><span class="special">)</span> <span class="special">)</span> <span class="special">{</span>
+ <span class="special">...</span>
+ <span class="special">}</span> <code class="computeroutput"><a class="link" href="../BOOST_LOCAL_FUNCTION_NAME.html" title="Macro BOOST_LOCAL_FUNCTION_NAME">BOOST_LOCAL_FUNCTION_NAME</a></code><span class="special">(</span><span class="identifier">l</span><span class="special">)</span> <span class="comment">// Error: Cannot overload.
+</span>
+ <span class="special">...</span>
+<span class="special">}</span>
+</pre>
+<a name="boost_local.Advanced.limitations__overloading__operators__etc_.operators"></a><h6>
+<a name="id909938"></a>
+ <a class="link" href="Advanced.html#boost_local.Advanced.limitations__overloading__operators__etc_.operators">Operators</a>
+ </h6>
+<p>
+ Local functions cannot be operators. Naming a local function <code class="computeroutput"><span class="keyword">operator</span><span class="special">...</span></code>
+ will generate a compile-time error. <sup>[<a name="id909975" href="#ftn.id909975" class="footnote">19</a>]</sup>
+ </p>
+<p>
+ For example, the following code will <span class="bold"><strong>not</strong></span>
+ compile:
+ </p>
+<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">f</span><span class="special">()</span> <span class="special">{</span>
+ <span class="keyword">struct</span> <span class="identifier">point</span> <span class="special">{</span>
+ <span class="keyword">double</span> <span class="identifier">x</span><span class="special">;</span>
+ <span class="keyword">double</span> <span class="identifier">y</span><span class="special">;</span>
+ <span class="special">};</span>
+
+ <span class="keyword">bool</span> <code class="computeroutput"><a class="link" href="../BOOST_LOCAL_FUNCTION_PARAMS.html" title="Macro BOOST_LOCAL_FUNCTION_PARAMS">BOOST_LOCAL_FUNCTION_PARAMS</a></code><span class="special">(</span>
+ <span class="special">(</span><span class="keyword">const</span> <span class="identifier">point</span><span class="special">&)(</span><span class="identifier">p</span><span class="special">)</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">point</span><span class="special">&)(</span><span class="identifier">q</span><span class="special">)</span> <span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">p</span><span class="special">.</span><span class="identifier">x</span> <span class="special">==</span> <span class="identifier">q</span><span class="special">.</span><span class="identifier">x</span> <span class="special">&&</span> <span class="identifier">p</span><span class="special">.</span><span class="identifier">y</span> <span class="special">==</span> <span class="identifier">q</span><span class="special">.</span><span class="identifier">y</span><span class="special">;</span>
+ <span class="special">)</span> <code class="computeroutput"><a class="link" href="../BOOST_LOCAL_FUNCTION_NAME.html" title="Macro BOOST_LOCAL_FUNCTION_NAME">BOOST_LOCAL_FUNCTION_NAME</a></code><span class="special">(</span><span class="keyword">operator</span><span class="special">==)</span> <span class="comment">// Error: Cannot be `operator==`.
+</span>
+ <span class="special">...</span>
+<span class="special">}</span>
+</pre>
</div>
<div class="footnotes">
<br><hr width="100" align="left">
-<div class="footnote"><p><sup>[<a id="ftn.id880823" href="#id880823" class="para">15</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id881895" href="#id881895" class="para">15</a>] </sup>
<span class="bold"><strong>Rationale.</strong></span> This limitation derives from
the fact that <code class="computeroutput"><a class="link" href="../BOOST_LOCAL_FUNCTION_PARAMS.html" title="Macro BOOST_LOCAL_FUNCTION_PARAMS">BOOST_LOCAL_FUNCTION_PARAMS</a></code>
uses preprocessor token concatenation to inspect the parameter type token
to see if the token is a parameter or a bound variable. The C++ preprocessor
does not allow to concatenate non-alphanumeric tokens.
</p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id882181" href="#id882181" class="para">16</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id883253" href="#id883253" class="para">16</a>] </sup>
<span class="bold"><strong>Rationale.</strong></span> Using variadic macros,
this extra set of parenthesis could be eliminated requiring only the
parenthesis to invoke the <code class="computeroutput"><a class="link" href="../BOOST_IDENTITY_TYPE.html" title="Macro BOOST_IDENTITY_TYPE">BOOST_IDENTITY_TYPE</a></code>
macro. However, this feature is currently not implemented and the double
parenthesis are always needed when invoking this macro.
</p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id883486" href="#id883486" class="para">17</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id884557" href="#id884557" class="para">17</a>] </sup>
The authors recognize that the use of the <span class="emphasis"><em>identity macros</em></span>
adds extra parenthesis to the already significant number of parenthesis
required by the sequencing macro syntax. However, macro parameters usually
@@ -1714,26 +1939,14 @@
(unless template metaprogramming is being used) so this is usually not
a problem.
</p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id893596" href="#id893596" class="para">18</a>] </sup>
- The suffix <code class="computeroutput"><span class="identifier">ref</span></code> of <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">local</span><span class="special">::</span><a class="link" href="../boost/local/function.html" title="Struct template function">function</a></code> is meant to
- help programmers remember that they are dealing with references to (and
- not copies of) local functions.
- </p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id903199" href="#id903199" class="para">19</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id909633" href="#id909633" class="para">18</a>] </sup>
<span class="bold"><strong>Rationale.</strong></span> This is because a local function
is a functor object declared as a local variable within the enclosing scope.
Therefore, declaring two local functions with the same name within the
same enclosing scope declares two local variables with the same name within
the same scope and that is not allowed in C++.
</p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id903662" href="#id903662" class="para">20</a>] </sup>
- <span class="bold"><strong>Rationale.</strong></span> This is because within a nested
- code block only global or static variables can be accessed while Boost.ScopeExit
- variable <a href="http://lists.boost.org/Archives/boost/2006/11/113658.php" target="_top">binding
- mechanism</a> requires to access local variables that hold the bound
- variables.
- </p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id904100" href="#id904100" class="para">21</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id909975" href="#id909975" class="para">19</a>] </sup>
<span class="bold"><strong>Rationale.</strong></span> This is the because a local
function name must be a valid local variable name (the local variable to
hold the local functor object) and operators cannot be used as local variable
Modified: sandbox/local/libs/local/doc/html/boost_local/Bibliography.html
==============================================================================
--- sandbox/local/libs/local/doc/html/boost_local/Bibliography.html (original)
+++ sandbox/local/libs/local/doc/html/boost_local/Bibliography.html 2011-03-18 17:38:31 EDT (Fri, 18 Mar 2011)
@@ -6,7 +6,7 @@
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="../index.html" title="Boost.Local 0.1.1">
<link rel="up" href="../index.html" title="Boost.Local 0.1.1">
-<link rel="prev" href="Releases.html" title="Releases">
+<link rel="prev" href="Release.html" title="Release Notes">
<link rel="next" href="Acknowledgments.html" title="Acknowledgments">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
@@ -20,7 +20,7 @@
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="Releases.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="Acknowledgments.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
+<a accesskey="p" href="Release.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="Acknowledgments.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
@@ -61,7 +61,7 @@
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="Releases.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="Acknowledgments.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
+<a accesskey="p" href="Release.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="Acknowledgments.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
Modified: sandbox/local/libs/local/doc/html/boost_local/Implementation.html
==============================================================================
--- sandbox/local/libs/local/doc/html/boost_local/Implementation.html (original)
+++ sandbox/local/libs/local/doc/html/boost_local/Implementation.html 2011-03-18 17:38:31 EDT (Fri, 18 Mar 2011)
@@ -7,7 +7,7 @@
<link rel="home" href="../index.html" title="Boost.Local 0.1.1">
<link rel="up" href="../index.html" title="Boost.Local 0.1.1">
<link rel="prev" href="Alternatives.html" title="Appendix: Alternatives">
-<link rel="next" href="Releases.html" title="Releases">
+<link rel="next" href="Release.html" title="Release Notes">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
@@ -20,7 +20,7 @@
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="Alternatives.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="Releases.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
+<a accesskey="p" href="Alternatives.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="Release.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
@@ -66,7 +66,7 @@
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="Alternatives.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="Releases.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
+<a accesskey="p" href="Alternatives.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="Release.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
Modified: sandbox/local/libs/local/doc/html/boost_local/Starting.html
==============================================================================
--- sandbox/local/libs/local/doc/html/boost_local/Starting.html (original)
+++ sandbox/local/libs/local/doc/html/boost_local/Starting.html 2011-03-18 17:38:31 EDT (Fri, 18 Mar 2011)
@@ -183,7 +183,7 @@
</h3></div></div></div>
<p>
The following symbols are part of the library private API, they are not documented,
- and they should not be directly used by programmers: <sup>[<a name="id865347" href="#ftn.id865347" class="footnote">2</a>]</sup>
+ and they should not be directly used by programmers: <sup>[<a name="id866461" href="#ftn.id866461" class="footnote">2</a>]</sup>
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
@@ -223,7 +223,7 @@
</div>
<div class="footnotes">
<br><hr width="100" align="left">
-<div class="footnote"><p><sup>[<a id="ftn.id865347" href="#id865347" class="para">2</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id866461" href="#id866461" class="para">2</a>] </sup>
<span class="bold"><strong>Rationale.</strong></span> This library concatenates symbols
specified by the programmers (e.g., the local function name) with other
symbols (e.g., special prefixes or preprocessor line numbers) to make internal
Modified: sandbox/local/libs/local/doc/html/boost_local/Tutorial.html
==============================================================================
--- sandbox/local/libs/local/doc/html/boost_local/Tutorial.html (original)
+++ sandbox/local/libs/local/doc/html/boost_local/Tutorial.html 2011-03-18 17:38:31 EDT (Fri, 18 Mar 2011)
@@ -6,7 +6,7 @@
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="../index.html" title="Boost.Local 0.1.1">
<link rel="up" href="../index.html" title="Boost.Local 0.1.1">
-<link rel="prev" href="Starting.html" title="Getting Started">
+<link rel="prev" href="Getting.html" title="Getting Started">
<link rel="next" href="Advanced.html" title="Advanced Topics">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
@@ -20,7 +20,7 @@
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="Starting.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="Advanced.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
+<a accesskey="p" href="Getting.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="Advanced.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
@@ -115,12 +115,12 @@
<span class="special">...</span> <span class="special">}</span></code>
using the usual C++ syntax. The body is specified outside any of the macros
so eventual compiler error messages and line numbers retain their usual meaning.
- <sup>[<a name="id866036" href="#ftn.id866036" class="footnote">3</a>]</sup>
+ <sup>[<a name="id867127" href="#ftn.id867127" class="footnote">3</a>]</sup>
</p>
<p>
The macro <code class="computeroutput"><a class="link" href="../BOOST_LOCAL_FUNCTION_NAME.html" title="Macro BOOST_LOCAL_FUNCTION_NAME">BOOST_LOCAL_FUNCTION_NAME</a></code>
is used to end the local function definition and to specify the local function
- name. <sup>[<a name="id866072" href="#ftn.id866072" class="footnote">4</a>]</sup>
+ name. <sup>[<a name="id867163" href="#ftn.id867163" class="footnote">4</a>]</sup>
</p>
<p>
For example, let's program a local function named <code class="computeroutput"><span class="identifier">add</span></code>
@@ -366,7 +366,7 @@
This library also allows to specify default values for the local function
parameters. However, the usual C++ syntax for default parameters that uses
the assignment symbol <code class="computeroutput"><span class="special">=</span></code> cannot
- be used. <sup>[<a name="id867998" href="#ftn.id867998" class="footnote">5</a>]</sup> The keyword <code class="computeroutput"><span class="keyword">default</span></code>
+ be used. <sup>[<a name="id869089" href="#ftn.id869089" class="footnote">5</a>]</sup> The keyword <code class="computeroutput"><span class="keyword">default</span></code>
is used instead:
</p>
<div class="informaltable"><table class="table">
@@ -508,7 +508,7 @@
variables, the object <code class="computeroutput"><span class="keyword">this</span></code>,
etc) can be bound to a local function declaration. The types of bound variables
are automatically deduced by this library using Boost.Typeof.
- <sup>[<a name="id869232" href="#ftn.id869232" class="footnote">6</a>]</sup>
+ <sup>[<a name="id870313" href="#ftn.id870313" class="footnote">6</a>]</sup>
</p>
<div class="important"><table border="0" summary="Important">
<tr>
@@ -525,7 +525,7 @@
</table></div>
<p>
This library introduces the new "keyword" <code class="computeroutput"><span class="identifier">bind</span></code>
- <sup>[<a name="id869327" href="#ftn.id869327" class="footnote">7</a>]</sup> which is used in place of the parameter type to specify the name
+ <sup>[<a name="id870408" href="#ftn.id870408" class="footnote">7</a>]</sup> which is used in place of the parameter type to specify the name
of a variable in scope to bind. The variable can be bound by value:
</p>
<pre class="programlisting"><span class="identifier">bind</span> <span class="emphasis"><em>variable-name</em></span> <span class="comment">// Bind by value.
@@ -566,7 +566,7 @@
unless constant binding is forced using <code class="computeroutput"><span class="keyword">const</span>
<span class="identifier">bind</span> <span class="special">...</span></code>
(note that binding by constant reference is not supported by <a href="http://en.wikipedia.org/wiki/C%2B%2B0x#Lambda_functions_and_expressions" target="_top">C++0x
- lambda</a> functions). <sup>[<a name="id869592" href="#ftn.id869592" class="footnote">8</a>]</sup> Programmers might want to bind variables of complex types by
+ lambda</a> functions). <sup>[<a name="id870663" href="#ftn.id870663" class="footnote">8</a>]</sup> Programmers might want to bind variables of complex types by
(constant) reference instead than by value to avoid expensive copy operations
when these variables are automatically passed to the local function (as usual
with C++ function parameter passing).
@@ -647,7 +647,7 @@
</tr></tbody>
</table></div>
<a name="boost_local.Tutorial.Binding.binding_the_object__code__phrase_role__keyword__this__phrase___code_"></a><h6>
-<a name="id870581"></a>
+<a name="id871651"></a>
<a class="link" href="Tutorial.html#boost_local.Tutorial.Binding.binding_the_object__code__phrase_role__keyword__this__phrase___code_">Binding
the Object <code class="computeroutput"><span class="keyword">this</span></code></a>
</h6>
@@ -701,12 +701,12 @@
to a local function, the local function <span class="bold"><strong>body must
use the special symbol</strong></span> <code class="computeroutput"><span class="identifier">this_</span></code>
(instead of <code class="computeroutput"><span class="keyword">this</span></code>) to access
- the bound object. <sup>[<a name="id870899" href="#ftn.id870899" class="footnote">9</a>]</sup>
+ the bound object. <sup>[<a name="id871970" href="#ftn.id871970" class="footnote">9</a>]</sup>
</p>
<p>
Unfortunately, mistakenly using <code class="computeroutput"><span class="keyword">this</span></code>
within the local function body instead of <code class="computeroutput"><span class="identifier">this_</span></code>
- will not necessarily generate a compile-time error. <sup>[<a name="id870993" href="#ftn.id870993" class="footnote">10</a>]</sup> Programmers are responsible to make sure that <code class="computeroutput"><span class="keyword">this</span></code> is never used within a local function
+ will not necessarily generate a compile-time error. <sup>[<a name="id872064" href="#ftn.id872064" class="footnote">10</a>]</sup> Programmers are responsible to make sure that <code class="computeroutput"><span class="keyword">this</span></code> is never used within a local function
body which should only use the special symbol <code class="computeroutput"><span class="identifier">this_</span></code>.
</p>
</td></tr>
@@ -867,7 +867,7 @@
A <code class="computeroutput"><span class="keyword">return</span><span class="special">;</span></code>
instruction from within a local block jumps to the end of the local block
body and <span class="bold"><strong>it does not return the enclosing function</strong></span>.
- <sup>[<a name="id873437" href="#ftn.id873437" class="footnote">11</a>]</sup>
+ <sup>[<a name="id874515" href="#ftn.id874515" class="footnote">11</a>]</sup>
</p></td></tr>
</table></div>
<p>
@@ -970,7 +970,7 @@
If multiple local exits are declared within the same scope, their bodies
will be executed in the reverse order in which they have been declared. The
execution of the local exit code can be guaranteed only if the program does
- not terminate because of an uncaught exception. <sup>[<a name="id874641" href="#ftn.id874641" class="footnote">12</a>]</sup>
+ not terminate because of an uncaught exception. <sup>[<a name="id875720" href="#ftn.id875720" class="footnote">12</a>]</sup>
</p>
<p>
Only bound variables specified by <code class="literal"><span class="emphasis"><em>bindings</em></span></code>
@@ -1074,10 +1074,10 @@
Local exits are very similar to the <span class="emphasis"><em>scope exits</em></span> provided
by Boost.ScopeExit
with the addition that they also support constant binding and binding of
- the object <code class="computeroutput"><span class="keyword">this</span></code>. <sup>[<a name="id875892" href="#ftn.id875892" class="footnote">13</a>]</sup>
+ the object <code class="computeroutput"><span class="keyword">this</span></code>. <sup>[<a name="id876971" href="#ftn.id876971" class="footnote">13</a>]</sup>
</p>
<a name="boost_local.Tutorial.local_exits.d_s_scope_guards"></a><h6>
-<a name="id876119"></a>
+<a name="id877198"></a>
<a class="link" href="Tutorial.html#boost_local.Tutorial.local_exits.d_s_scope_guards">D's Scope
Guards</a>
</h6>
@@ -1169,7 +1169,7 @@
When local functions, local blocks, and local exits are programmed within
templates, they need to be declared using the following special macros ending
with the <code class="computeroutput"><span class="identifier">TPL</span></code> postfix (see
- the Reference section): <sup>[<a name="id877674" href="#ftn.id877674" class="footnote">14</a>]</sup>
+ the Reference section): <sup>[<a name="id878746" href="#ftn.id878746" class="footnote">14</a>]</sup>
</p>
<pre class="programlisting"><code class="computeroutput"><a class="link" href="../BOOST_LOCAL_FUNCTION_PARAMS_TPL.html" title="Macro BOOST_LOCAL_FUNCTION_PARAMS_TPL">BOOST_LOCAL_FUNCTION_PARAMS_TPL</a></code><span class="special">(</span><span class="emphasis"><em>parameters</em></span><span class="special">)</span>
<code class="computeroutput"><a class="link" href="../BOOST_LOCAL_BLOCK_TPL.html" title="Macro BOOST_LOCAL_BLOCK_TPL">BOOST_LOCAL_BLOCK_TPL</a></code><span class="special">(</span><span class="emphasis"><em>bindings</em></span><span class="special">)</span>
@@ -1302,20 +1302,20 @@
</div>
<div class="footnotes">
<br><hr width="100" align="left">
-<div class="footnote"><p><sup>[<a id="ftn.id866036" href="#id866036" class="para">3</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id867127" href="#id867127" class="para">3</a>] </sup>
<span class="bold"><strong>Rationale.</strong></span> If the local function body
were instead passed as a macro parameter, it would be expanded on a single
line of code (because macros always expand as a single line of code). Therefore,
eventual compiler error line numbers would all have the same value and
would no longer be useful to pinpoint the error.
</p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id866072" href="#id866072" class="para">4</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id867163" href="#id867163" class="para">4</a>] </sup>
<span class="bold"><strong>Rationale.</strong></span> The local function name must
be passed to the macro <code class="computeroutput"><a class="link" href="../BOOST_LOCAL_FUNCTION_NAME.html" title="Macro BOOST_LOCAL_FUNCTION_NAME">BOOST_LOCAL_FUNCTION_NAME</a></code>
ending the function definition so this macro can declare a local variable
with the local function name to hold the local functor object.
</p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id867998" href="#id867998" class="para">5</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id869089" href="#id869089" class="para">5</a>] </sup>
<span class="bold"><strong>Rationale.</strong></span> The assignment symbol <code class="computeroutput"><span class="special">=</span></code> cannot be used to specify default parameter
values because default values are not part of the parameter type so they
cannot be handled using template metaprogamming. Default parameter values
@@ -1325,7 +1325,7 @@
it counts the number of default values to provide the correct set of call
operators for the local functor object.
</p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id869232" href="#id869232" class="para">6</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id870313" href="#id870313" class="para">6</a>] </sup>
<span class="bold"><strong>Rationale.</strong></span> By binding a variable in scope,
the local function declaration is specifying that such a variable should
be accessible within the local function body regardless of its type. Semantically,
@@ -1338,7 +1338,7 @@
This is especially useful for maintenance so if a bound variable type is
changed, the local function declaration does not have to change.
</p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id869327" href="#id869327" class="para">7</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id870408" href="#id870408" class="para">7</a>] </sup>
The token <code class="computeroutput"><span class="identifier">bind</span></code> is not a
real keyword of the C++ language. This library parses <code class="computeroutput"><span class="identifier">bind</span></code>
during macro expansion using preprocessor metaprogramming. Therefore,
@@ -1347,7 +1347,7 @@
within the syntax defined by the macros of this library -- thus it is referred
to as a "keyword" only within quotes.
</p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id869592" href="#id869592" class="para">8</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id870663" href="#id870663" class="para">8</a>] </sup>
An historical note: Constant binding of variables in scope was the main
use case that originally motivated the authors in developing this library.
The authors needed to locally create a chuck of code to assert some correctness
@@ -1362,7 +1362,7 @@
generates an error because the bound variable is of <code class="computeroutput"><span class="keyword">const</span></code>
type within the local function body.
</p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id870899" href="#id870899" class="para">9</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id871970" href="#id871970" class="para">9</a>] </sup>
<span class="bold"><strong>Rationale.</strong></span> This limitation comes from
the fact that <code class="computeroutput"><span class="keyword">this</span></code> is a
reserved C++ keyword so it cannot be used as the name of the internal
@@ -1376,7 +1376,7 @@
behaviour of <code class="computeroutput"><span class="keyword">static_cast</span></code></a>
(which might not work on all platforms at the cost of portability).
</p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id870993" href="#id870993" class="para">10</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id872064" href="#id872064" class="para">10</a>] </sup>
<span class="bold"><strong>Rationale.</strong></span> The local function body cannot
be a static member function of the local functor object in order to support
recursion (because the local function name is specified by the <code class="computeroutput"><a class="link" href="../BOOST_LOCAL_FUNCTION_NAME.html" title="Macro BOOST_LOCAL_FUNCTION_NAME">BOOST_LOCAL_FUNCTION_NAME</a></code>
@@ -1389,7 +1389,7 @@
is visible but it refers to the local functor object and not to the bound
object.
</p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id873437" href="#id873437" class="para">11</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id874515" href="#id874515" class="para">11</a>] </sup>
<span class="bold"><strong>Rationale.</strong></span> Programmers might expect
<code class="computeroutput"><span class="keyword">return</span><span class="special">;</span></code>
to exit the enclosing function instead of the local block (or local exit),
@@ -1407,7 +1407,7 @@
<code class="computeroutput"><span class="identifier">BOOST_LOCAL_RETURN</span><span class="special">;</span></code>)
to exit local blocks (and local exits).
</p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id874641" href="#id874641" class="para">12</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id875720" href="#id875720" class="para">12</a>] </sup>
<span class="bold"><strong>Rationale.</strong></span> This library (as well as Boost.ScopeExit)
uses the destructor of a local variable to automatically execute the local
exit code upon exit of the enclosing scope. However, in C++ it is no possible
@@ -1416,7 +1416,7 @@
different from the D programming language which executes the scope exit
code even if the main program terminates because of an uncaught exception.)
</p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id875892" href="#id875892" class="para">13</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id876971" href="#id876971" class="para">13</a>] </sup>
<span class="bold"><strong>Rationale.</strong></span> This library could be merged
together with Boost.ScopeExit
into a new library named Boost.Scope (from the meaning of the word "scope"
@@ -1443,7 +1443,7 @@
name of "<a href="http://gcc.gnu.org/onlinedocs/gcc/Nested-Functions.html" target="_top">nested
functions</a>".
</p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id877674" href="#id877674" class="para">14</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id878746" href="#id878746" class="para">14</a>] </sup>
<span class="bold"><strong>Rationale.</strong></span> Within templates, this library
needs to use <code class="computeroutput"><span class="keyword">typename</span></code> to explicitly
indicate that some expressions evaluate to a type. Because C++ does not
@@ -1465,7 +1465,7 @@
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="Starting.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="Advanced.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
+<a accesskey="p" href="Getting.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="Advanced.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
Modified: sandbox/local/libs/local/doc/html/index.html
==============================================================================
--- sandbox/local/libs/local/doc/html/index.html (original)
+++ sandbox/local/libs/local/doc/html/index.html 2011-03-18 17:38:31 EDT (Fri, 18 Mar 2011)
@@ -5,7 +5,7 @@
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="Boost.Local 0.1.1">
-<link rel="next" href="boost_local/Starting.html" title="Getting Started">
+<link rel="next" href="boost_local/Getting.html" title="Getting Started">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
@@ -17,7 +17,7 @@
<td align="center">More</td>
</tr></table>
<hr>
-<div class="spirit-nav"><a accesskey="n" href="boost_local/Starting.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a></div>
+<div class="spirit-nav"><a accesskey="n" href="boost_local/Getting.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a></div>
<div class="preface">
<div class="titlepage"><div>
<div><h2 class="title">
@@ -27,7 +27,7 @@
</h3></div></div></div>
<div><p class="copyright">Copyright © 2009 -2011 Lorenzo Caminiti</p></div>
<div><div class="legalnotice">
-<a name="id809313"></a><p>
+<a name="id810406"></a><p>
Use, modification, and distribution is subject to the Boost Software License,
Version 1.0 (see accompanying file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt).
</p>
@@ -37,14 +37,14 @@
<p><b>Table of Contents</b></p>
<dl>
<dt><span class="section">Introduction</span></dt>
-<dt><span class="section">Getting Started</span></dt>
+<dt><span class="section">Getting Started</span></dt>
<dt><span class="section">Tutorial</span></dt>
<dt><span class="section">Advanced Topics</span></dt>
<dt><span class="section">Reference</span></dt>
<dt><span class="section">Appendix: Examples</span></dt>
<dt><span class="section">Appendix: Alternatives</span></dt>
<dt><span class="section">Appendix: Implementation</span></dt>
-<dt><span class="section">Releases</span></dt>
+<dt><span class="section">Release Notes</span></dt>
<dt><span class="section">Bibliography</span></dt>
<dt><span class="section">Acknowledgments</span></dt>
</dl>
@@ -109,7 +109,7 @@
</li>
</ul></div>
<a name="boost_local.Introduction.two_syntaxes"></a><h6>
-<a name="id809120"></a>
+<a name="id810200"></a>
<a class="link" href="index.html#boost_local.Introduction.two_syntaxes">Two Syntaxes</a>
</h6>
<p>
@@ -126,7 +126,7 @@
<li class="listitem">
The <span class="emphasis"><em>variadic macro synstax</em></span> is available only on C++
compilers that support <a href="http://en.wikipedia.org/wiki/Variadic_macro" target="_top">variadic
- macros</a>. <sup>[<a name="id851524" href="#ftn.id851524" class="footnote">1</a>]</sup> This syntax allow to use commas <code class="computeroutput"><span class="special">,</span></code>
+ macros</a>. <sup>[<a name="id852604" href="#ftn.id852604" class="footnote">1</a>]</sup> This syntax allow to use commas <code class="computeroutput"><span class="special">,</span></code>
to separate macro parameters therefore resembling the usual C++ syntax
for function parameter declaration.
</li>
@@ -141,7 +141,7 @@
of both syntaxes.
</p>
<a name="boost_local.Introduction.an_example"></a><h6>
-<a name="id851586"></a>
+<a name="id852666"></a>
<a class="link" href="index.html#boost_local.Introduction.an_example">An Example</a>
</h6>
<p>
@@ -353,12 +353,13 @@
usual meaning. Exceptions specifications can be programmed outside the
macro and just before the body code block <code class="computeroutput"><span class="special">{...}</span></code>
as usual. Finally, within the local function body the type of a bound variable
- can be accessed using <code class="literal"><code class="computeroutput">BOOST_LOCAL_TYPEOF</code>(<span class="emphasis"><em>variable-name</em></span>)</code>.
+ can be accessed using <code class="literal"><code class="computeroutput"><a class="link" href="BOOST_LOCAL_TYPEOF.html" title="Macro BOOST_LOCAL_TYPEOF">BOOST_LOCAL_TYPEOF</a></code>(<span class="emphasis"><em>variable-name</em></span>)</code>.
(See the <a class="link" href="boost_local/Tutorial.html" title="Tutorial">Tutorial</a> section.)
</li>
<li class="listitem">
The macro ending the local function definition specifies the local function
- name.
+ name. No semicolon <code class="computeroutput"><span class="special">;</span></code> is required
+ after the ending macro.
</li>
<li class="listitem">
The local function macros declare a functor object local to the enclosing
@@ -381,7 +382,9 @@
is exited.
</li>
<li class="listitem">
- Local exits are anonymous so their ending macro takes no argument.
+ Local exits are anonymous so their ending macro takes no argument. No semicolon
+ <code class="computeroutput"><span class="special">;</span></code> is required after the ending
+ macro.
</li>
<li class="listitem">
The local function <code class="computeroutput"><span class="identifier">add</span></code>
@@ -403,13 +406,15 @@
is bound by constant reference so it cannot be modified.
</li>
<li class="listitem">
- Local blocks are anonymous so their ending macro takes no argument.
+ Local blocks are anonymous so their ending macro takes no argument. No
+ semicolon <code class="computeroutput"><span class="special">;</span></code> is required after
+ the ending macro.
</li>
</ol></div>
</div>
<div class="footnotes">
<br><hr width="100" align="left">
-<div class="footnote"><p><sup>[<a id="ftn.id851524" href="#id851524" class="para">1</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id852604" href="#id852604" class="para">1</a>] </sup>
Variadic macros were first introduced by the C99 preprocessor (via the
use of the special macro symbols ellipses <code class="computeroutput"><span class="special">...</span></code>
and <code class="computeroutput"><span class="identifier">__VA_ARGS__</span></code>). They
@@ -419,10 +424,10 @@
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
-<td align="left"><p><small>Last revised: March 10, 2011 at 21:42:14 GMT</small></p></td>
+<td align="left"><p><small>Last revised: March 18, 2011 at 21:16:56 GMT</small></p></td>
<td align="right"><div class="copyright-footer"></div></td>
</tr></table>
<hr>
-<div class="spirit-nav"><a accesskey="n" href="boost_local/Starting.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a></div>
+<div class="spirit-nav"><a accesskey="n" href="boost_local/Getting.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a></div>
</body>
</html>
Modified: sandbox/local/libs/local/doc/html/reference.html
==============================================================================
--- sandbox/local/libs/local/doc/html/reference.html (original)
+++ sandbox/local/libs/local/doc/html/reference.html 2011-03-18 17:38:31 EDT (Fri, 18 Mar 2011)
@@ -30,6 +30,7 @@
<dt><span class="section">Header <boost/local/config.hpp></span></dt>
<dt><span class="section">Header <boost/local/exit.hpp></span></dt>
<dt><span class="section">Header <boost/local/function.hpp></span></dt>
+<dt><span class="section">Header <boost/local/typeof.hpp></span></dt>
<dt><span class="section">Header <boost/utility/identity.hpp></span></dt>
</dl></div>
<div class="section">
@@ -38,8 +39,8 @@
<p>Local blocks allow to program code that is executed accessing some of the variables in scope as constants. </p>
<pre class="synopsis">
-<a class="link" href="BOOST_LOCAL_BLOCK.html" title="Macro BOOST_LOCAL_BLOCK">BOOST_LOCAL_BLOCK</a>(...)
-<a class="link" href="BOOST_LOCAL_BLOCK_TPL.html" title="Macro BOOST_LOCAL_BLOCK_TPL">BOOST_LOCAL_BLOCK_TPL</a>(...)
+<a class="link" href="BOOST_LOCAL_BLOCK.html" title="Macro BOOST_LOCAL_BLOCK">BOOST_LOCAL_BLOCK</a>(bindings)
+<a class="link" href="BOOST_LOCAL_BLOCK_TPL.html" title="Macro BOOST_LOCAL_BLOCK_TPL">BOOST_LOCAL_BLOCK_TPL</a>(bindings)
<a class="link" href="BOOST_LOCAL_BLOCK_END.html" title="Macro BOOST_LOCAL_BLOCK_END">BOOST_LOCAL_BLOCK_END</a></pre>
</div>
<div class="section">
@@ -48,6 +49,7 @@
<p>Configuration macros allow to change the behaviour of this library at compile-time. </p>
<pre class="synopsis">
+<a class="link" href="BOOST_LOCAL_CONFIG_COMPLIANT.html" title="Macro BOOST_LOCAL_CONFIG_COMPLIANT">BOOST_LOCAL_CONFIG_COMPLIANT</a>
<a class="link" href="BOOST_LOCAL_CONFIG_FUNCTION_ARITY_MAX.html" title="Macro BOOST_LOCAL_CONFIG_FUNCTION_ARITY_MAX">BOOST_LOCAL_CONFIG_FUNCTION_ARITY_MAX</a>
<a class="link" href="BOOST_LOCAL_CONFIG_THIS_PARAM_NAME.html" title="Macro BOOST_LOCAL_CONFIG_THIS_PARAM_NAME">BOOST_LOCAL_CONFIG_THIS_PARAM_NAME</a></pre>
</div>
@@ -57,19 +59,19 @@
<p>Local exits allow to program code that is executed when the enclosing scope is exited. </p>
<pre class="synopsis">
-<a class="link" href="BOOST_LOCAL_EXIT.html" title="Macro BOOST_LOCAL_EXIT">BOOST_LOCAL_EXIT</a>(...)
-<a class="link" href="BOOST_LOCAL_EXIT_TPL.html" title="Macro BOOST_LOCAL_EXIT_TPL">BOOST_LOCAL_EXIT_TPL</a>(...)
+<a class="link" href="BOOST_LOCAL_EXIT.html" title="Macro BOOST_LOCAL_EXIT">BOOST_LOCAL_EXIT</a>(binding_list)
+<a class="link" href="BOOST_LOCAL_EXIT_TPL.html" title="Macro BOOST_LOCAL_EXIT_TPL">BOOST_LOCAL_EXIT_TPL</a>(binding_list)
<a class="link" href="BOOST_LOCAL_EXIT_END.html" title="Macro BOOST_LOCAL_EXIT_END">BOOST_LOCAL_EXIT_END</a></pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="header.boost.local.function_hpp"></a>Header <boost/local/function.hpp></h3></div></div></div>
-<p>Local function references can be passed as function and template parameters, they can be assigned to variables, etc. </p>
+<p>Local functions allows to program functions locally within the scope where they are needed (within enclosing functions, etc). </p>
<pre class="synopsis">
-<a class="link" href="BOOST_LOCAL_FUNCTION_PARAMS.html" title="Macro BOOST_LOCAL_FUNCTION_PARAMS">BOOST_LOCAL_FUNCTION_PARAMS</a>(...)
-<a class="link" href="BOOST_LOCAL_FUNCTION_PARAMS_TPL.html" title="Macro BOOST_LOCAL_FUNCTION_PARAMS_TPL">BOOST_LOCAL_FUNCTION_PARAMS_TPL</a>(...)
-<a class="link" href="BOOST_LOCAL_FUNCTION_NAME.html" title="Macro BOOST_LOCAL_FUNCTION_NAME">BOOST_LOCAL_FUNCTION_NAME</a>(local_function_name)</pre>
+<a class="link" href="BOOST_LOCAL_FUNCTION_PARAMS.html" title="Macro BOOST_LOCAL_FUNCTION_PARAMS">BOOST_LOCAL_FUNCTION_PARAMS</a>(parameters)
+<a class="link" href="BOOST_LOCAL_FUNCTION_PARAMS_TPL.html" title="Macro BOOST_LOCAL_FUNCTION_PARAMS_TPL">BOOST_LOCAL_FUNCTION_PARAMS_TPL</a>(parameters)
+<a class="link" href="BOOST_LOCAL_FUNCTION_NAME.html" title="Macro BOOST_LOCAL_FUNCTION_NAME">BOOST_LOCAL_FUNCTION_NAME</a>(name)</pre>
<pre class="synopsis"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>
<span class="keyword">namespace</span> <span class="identifier">local</span> <span class="special">{</span>
<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> F<span class="special">,</span> <span class="identifier">size_t</span> defaults <span class="special">=</span> <span class="number">0</span><span class="special">></span> <span class="keyword">struct</span> <a class="link" href="boost/local/function.html" title="Struct template function">function</a><span class="special">;</span>
@@ -78,6 +80,14 @@
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
+<a name="header.boost.local.typeof_hpp"></a>Header <boost/local/typeof.hpp></h3></div></div></div>
+<p>Deduce the type of variables that are bound to local functions, local blocks, and local exits. </p>
+<pre class="synopsis">
+
+<a class="link" href="BOOST_LOCAL_TYPEOF.html" title="Macro BOOST_LOCAL_TYPEOF">BOOST_LOCAL_TYPEOF</a>(bound_variable_name)</pre>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
<a name="header.boost.utility.identity_hpp"></a>Header <boost/utility/identity.hpp></h3></div></div></div>
<p>Identity macros are used to pass expressions with commas (not already wrapped within round parenthesis) as macros parameters. </p>
<p><span class="bold"><strong>Note:</strong></span> The only way (at least as far as the authors know) to pass an arbitrary number of commas within macro parameters without explicitly indicating the number of commas is to wrap the parameter within round parenthesis that are not replaced by macro expansion and then to remove the extra parenthesis at compile-time (for type expressions) or at run-time (for value expressions). This is what these macros do. </p>
Modified: sandbox/local/libs/local/doc/html/standalone_HTML.manifest
==============================================================================
--- sandbox/local/libs/local/doc/html/standalone_HTML.manifest (original)
+++ sandbox/local/libs/local/doc/html/standalone_HTML.manifest 2011-03-18 17:38:31 EDT (Fri, 18 Mar 2011)
@@ -1,11 +1,12 @@
index.html
-boost_local/Starting.html
+boost_local/Getting.html
boost_local/Tutorial.html
boost_local/Advanced.html
reference.html
BOOST_LOCAL_BLOCK.html
BOOST_LOCAL_BLOCK_TPL.html
BOOST_LOCAL_BLOCK_END.html
+BOOST_LOCAL_CONFIG_COMPLIANT.html
BOOST_LOCAL_CONFIG_FUNCTION_ARITY_MAX.html
BOOST_LOCAL_CONFIG_THIS_PARAM_NAME.html
BOOST_LOCAL_EXIT.html
@@ -15,11 +16,12 @@
BOOST_LOCAL_FUNCTION_PARAMS.html
BOOST_LOCAL_FUNCTION_PARAMS_TPL.html
BOOST_LOCAL_FUNCTION_NAME.html
+BOOST_LOCAL_TYPEOF.html
BOOST_IDENTITY_TYPE.html
BOOST_IDENTITY_VALUE.html
boost_local/Examples.html
boost_local/Alternatives.html
boost_local/Implementation.html
-boost_local/Releases.html
+boost_local/Release.html
boost_local/Bibliography.html
boost_local/Acknowledgments.html
Deleted: sandbox/local/libs/local/doc/qbk/advanced.qbk
==============================================================================
--- sandbox/local/libs/local/doc/qbk/advanced.qbk 2011-03-18 17:38:31 EDT (Fri, 18 Mar 2011)
+++ (empty file)
@@ -1,477 +0,0 @@
-
-[/ Copyright (C) 2009-2011 Lorenzo Caminiti ]
-[/ Use, modification, and distribution is subject to the Boost Software ]
-[/ License, Version 1.0 (see accompanying file LICENSE_1_0.txt or a ]
-[/ copy at http://www.boost.org/LICENSE_1_0.txt). ]
-
-[section:Advanced Advanced Topics]
-
-This section illustrates advanced usage of this library.
-At the end of this section there is also a list of knwon limitations of this library.
-
-[section Commas and Symbols in Macro Parameters]
-
-The C++ preprocessor does not allow commas `,` within macro parameters unless they are wrapped by the round parenthesis `()`.
-Therefore, using commas within the local function parameters and bindings will generate (cryptic) preprocessor errors unless they are wrapped within extra round parenthesis `()` as explained here.
-
-[note
-*Macro parameters with commas* which are already wrapped by round parenthesis `()` are fine (function calls, etc).
-However, macro parameters with commas that are not wrapped by round parenthesis need to be wrapped by an extra set of round parenthesis `()` as described here.
-Also macro parameters with commas wrapped by angular parenthesis `<>` (templates, etc) or square parenthesis `[]` (multidimensional array access, etc) need to be wrapped by the extra round parenthesis `()` as explained here (this is because the preprocessor only recognizes the round parenthesis and it does not recognize angular, square, or any other type of parenthesis).
-]
-
-In addition, local function parameter types cannot start with non-alphanumeric symbols (alphanumeric symbols are `A-Z`, `a-z`, and `0-9`).
-[footnote
-*Rationale.*
-This limitation derives from the fact that `__BOOST_LOCAL_FUNCTION_PARAMS__` uses preprocessor token concatenation to inspect the parameter type token to see if the token is a parameter or a bound variable.
-The C++ preprocessor does not allow to concatenate non-alphanumeric tokens.
-]
-The library will generate (cryptic) preprocessor errors if a parameter type starts with a non-alphanumeric symbol.
-
-Let's consider the following example:
-
-[table
-[ [Variadic Macro Syntax (C99 and later compilers)] [Sequencing Macro Syntax (all C++ compilers)] ]
-[ [``
- ... __BOOST_LOCAL_FUNCTION_PARAMS__(
- const std::map<std::string, size_t>& m, // (1) Error.
- ::sign_t sign, // (2) Error.
- const size_t& factor, default
- key_size<std::string, size_t>::value, // (3) Error.
- const std::string& separator, default cat(":", " "), // (4) OK.
- ) ...
-``] [``
- ... __BOOST_LOCAL_FUNCTION_PARAMS__(
- (const std::map<std::string, size_t>& m) // (1) Error.
- (::sign_t sign) // (2) Error.
- (const size_t& factor)(default
- key_size<std::string, size_t>::value) // (3) Error.
- (const std::string& separator)(default cat(":", " ")) // (4) OK.
- ) ...
-``] ]
-]
-
-[*(1)] The parameter type `const std::map<std::string, size_t>&` contains a comma `,` after the first template parameter `std::string`.
-This comma is not wrapped by any round parenthesis `()` (the outer parenthesis `()` that make the sequencing macro syntax do not count) thus it will cause a preprocessor error.
-The macro `__BOOST_IDENTITY_TYPE__(`/parenthesized-type/`)` can be used to wrap a type within extra parenthesis `()` so to overcome this issue:
-
-[table
-[ [Variadic Macro Syntax (C99 and later compilers)] [Sequencing Macro Syntax (all C++ compilers)] ]
-[ [``
- ... __BOOST_LOCAL_FUNCTION_PARAMS__(
- __BOOST_IDENTITY_TYPE__((const std::map<std::string, size_t>&)) m, // OK.
- ...
- ) ...
-``] [``
- ... __BOOST_LOCAL_FUNCTION_PARAMS__(
- (__BOOST_IDENTITY_TYPE__((const std::map<std::string, size_t>&)) m) // OK.
- ...
- ) ...
-``] ]
-]
-
-This macro expands to an expression that evaluates (at compile-time) exactly to the specified type.
-Note that a total of two set of parenthesis `()` are added:
-
-# Parenthesis to invoke the `__BOOST_IDENTITY_TYPE__` macro.
-# Parenthesis to wrap the type expression (and therefore any commas `,` that it contains) passed as parameter to the `__BOOST_IDENTITY_TYPE__` macro.
-[footnote
-*Rationale.*
-Using variadic macros, this extra set of parenthesis could be eliminated requiring only the parenthesis to invoke the `__BOOST_IDENTITY_TYPE__` macro.
-However, this feature is currently not implemented and the double parenthesis are always needed when invoking this macro.
-]
-
-[*(2)] The parameter type `::sign_t` start with the non-alphanumeric symbols `::` thus it will generate preprocessor errors if used as a local function parameter type.
-The macros `__BOOST_IDENTITY_TYPE__` can also be used to overcome this issue:
-
-[table
-[ [Variadic Macro Syntax (C99 and later compilers)] [Sequencing Macro Syntax (all C++ compilers)] ]
-[ [``
- ... __BOOST_LOCAL_FUNCTION_PARAMS__(
- ...
- __BOOST_IDENTITY_TYPE__((::sign_t)) sign, // OK.
- ...
- ) ...
-``] [``
- ... __BOOST_LOCAL_FUNCTION_PARAMS__(
- ...
- (__BOOST_IDENTITY_TYPE__((::sign_t)) sign) // OK.
- ...
- ) ...
-``] ]
-]
-
-Often, there might be better ways to overcome this limitation that lead to code which is more readable than the one using the `__BOOST_IDENTITY_TYPE__` macro.
-For example, in this case the symbols `::` could have been simply dropped to obtain the following valid and more readable code:
-
-[table
-[ [Variadic Macro Syntax (C99 and later compilers)] [Sequencing Macro Syntax (all C++ compilers)] ]
-[ [``
- ... __BOOST_LOCAL_FUNCTION_PARAMS__(
- ...
- sign_t sign, // OK.
- ...
- ) ...
-``] [``
- ... __BOOST_LOCAL_FUNCTION_PARAMS__(
- ...
- (sign_t sign) // OK.
- ...
- ) ...
-``] ]
-]
-
-[*(3)] The default parameter value `key_size<std::string, size_t>::value` contains a comma `,` after the first template parameter `std::string`.
-Again, this comma is not wrapped by any parenthesis `()` so it will cause a preprocessor error.
-Because this is a value expression (and not a type expression), it can be simply wrapped within an extra set of round parenthesis `()`:
-
-[table
-[ [Variadic Macro Syntax (C99 and later compilers)] [Sequencing Macro Syntax (all C++ compilers)] ]
-[ [``
- ... __BOOST_LOCAL_FUNCTION_PARAMS__(
- ...
- const size_t& factor, default
- (key_size<std::string, size_t>::value), // OK.
- ...
- ) ...
-``] [``
- ... __BOOST_LOCAL_FUNCTION_PARAMS__(
- ...
- (const size_t& factor)(default
- (key_size<std::string, size_t>::value)) // OK.
- ...
- ) ...
-``] ]
-]
-
-
-[note
-Alternatively, the macro `__BOOST_IDENTITY_VALUE__(`/parenthesized-value/`)` could have been used.
-This macro expands to an expression that evaluates (at run-time) exactly to the specified value -- but it adds overhead compared with simply using the extra parenthesis `()`.
-Note that, similarly to `__BOOST_IDENTITY_TYPE__`, the `__BOOST_IDENTITY_VALUE__` macro also requires two sets of extra parenthesis one set for invoking the macro and another set to wrap the value expression passed as the macro parameter.
-]
-
-[*(4)] The default parameter value `cat(":", " ")` is instead fine because it contains a comma `,` which is already wrapped by the parenthesis `()` of the function call `cat(...)`.
-
-[important
-The `__BOOST_IDENTITY_TYPE__` macro must be prefixed by the `typename` keyword when used within templates.
-]
-
-Consider the following complete example:
-[footnote
-The authors recognize that the use of the /identity macros/ adds extra parenthesis to the already significant number of parenthesis required by the sequencing macro syntax.
-However, macro parameters usually do not contain unwrapped commas `,` (unless template metaprogramming is being used) so this is usually not a problem.
-]
-
-[table
-[ [Variadic Macro Syntax (C99 and later compilers)] [Sequencing Macro Syntax (all C++ compilers)] ]
-[ [ [print_map_va_cpp] ] [ [print_map_cpp] ] ]
-]
-
-[endsect]
-
-[section Deducing Bound Types]
-
-While the ISO C++ standard does not allow for member functions of local classes to have template parameters, this library allows to call template functions from within a local function, a local block, or a local exit passing bound variables without explicitly specifying their types.
-This essentially allows local functions, local blocks, and local exits to be [@http://en.wikipedia.org/wiki/Type_polymorphism polymorphic] in the type of the bound variables (like a template is polymorphic in the type of its template parameters).
-
-Furthermore, this library allow to access the type of the bound variables from within the local function, local block, or local exit using the following macro:
-
- #include <boost/local/typeof.hpp>
-
- ... // Within a local function, local block, or local exit.
- __BOOST_LOCAL_TYPEOF__(``/bound-variable/``) ...
- ...
-
-This macro expands to a type expression that evaluates (at compile-time) to the fully qualified type of the specified bound variable.
-This type expression is fully qualified in the sense that it will be constant if the variable is bound by constant and it will also be a reference is the variable is bound by reference (if needed, programmers can strip away the `const` and `&` qualifiers using `boost::remove_const` and `boost::remove_reference`, or similar template metafunctions).
-
-For example:
-
-[table
-[ [Variadic Macro Syntax (C99 and later compilers)] [Sequencing Macro Syntax (all C++ compilers)] ]
-[ [ [typeof_va_cpp] ] [ [typeof_cpp] ] ]
-]
-
-Within templates, `__BOOST_LOCAL_TYPEOF__` does not require to be prefixed by the `typename` keyword but eventual type manipulations need the `typename` prefix as usual:
-
-[table
-[ [Variadic Macro Syntax (C99 and later compilers)] [Sequencing Macro Syntax (all C++ compilers)] ]
-[ [ [typeof_tpl_va_cpp] ] [ [typeof_tpl_cpp] ] ]
-]
-
-[endsect]
-
-[section Passing Local Functions]
-
-It is possible to assign a local function to a functor (e.g., `boost::function`) in order to pass the local function to another function, etc.
-It is in general recommended to use the `boost::local::__function__` functor instead because its API also supports default parameters.
-
-[important
-When assigning a local function to a functor programmers need to make sure that the *local function survives the scope of the functor* otherwise the functor will be invalid and its use will generate a run-time error (as usual with C++ functors).
-]
-
-The `boost::local::__function__` template takes two parameters (see the __Reference__ section):
-
- template< typename F, size_t defaults = 0 > class __function__;
-
-[variablelist
-[ [F] [
-The template parameter `F` specifies the function signature using the same
-syntax as __Boost_Function__'s preferred syntax.
-For example:``
- __function__< int() > // Returns `int` and takes no parameter.
- __function__< int(double, char) > // Returns `int`and takes two parameters: a `double` followed by a `char`.
-``] ]
-[ [defaults] [
-The template parameter `defaults` specifies the number of defaults parameters (counting from the last parameter as usual): `0` if no parameter is optional, `1` if the last parameter is optional, `2` if the last two parameters are optional, etc.
-The `defaults` template parameter must be between `0` and the total number of parameters as specified by `F`, it is optional and it is `0` by default.
-For example:``
- __function__< int(double, char) > // No default: All parameters must be specified.
- __function__< int(double, char), 1 > // 1 default: The last `char` parameter is optional.
- __function__< int(double, char), 2 > // 2 defaults: All parameters are optional.
-``] ]
-]
-
-For example:
-
-[table
-[ [Variadic Macro Syntax (C99 and later compilers)] [Sequencing Macro Syntax (all C++ compilers)] ]
-[ [ [doit_va_cpp] ] [ [doit_cpp] ] ]
-]
-
-In addition, a local function can bind and call another local function.
-For example, the following local function `inc_sum` binds the local function `inc` so `inc_sum` can call `inc`:
-
-[table
-[ [Variadic Macro Syntax (C99 and later compilers)] [Sequencing Macro Syntax (all C++ compilers)] ]
-[ [ [transform_va_cpp] ] [ [transform_cpp] ] ]
-]
-
-[endsect]
-
-[section Exception Specifications]
-
-It is possible to program exception specifications for local functions, local blocks, and local exits.
-
-Exception specifications are programmed just before the body (and outside the macros).
-For example:
-
-[add_except_cpp]
-
-[endsect]
-
-[section Storage Classifiers `auto` and `register`]
-
-As specified in the __Grammar__ section, the parenthesized signature also supports `inline`d local functions, and the `auto` and `register` classifiers for local function parameters.
-
-[note
-However, note that local functions will always add some overhead because of the functor object used to internally implement them.
-Compilers might not be able to optimize away the local function overhead even when `inline`, `auto`, and `register` are used.
-]
-
-[add_optimizers_cpp]
-
-[endsect]
-
-[section Recursive Local Functions]
-
-A local function can recursively call itself as usual with C++ functions.
-
-For example, the following local function is used to recursively calculate and print the factorial of the specified numbers:
-
-[factorial_cpp]
-
-The original local function name as specified in the parenthesized signature passed to `__BOOST_LOCAL_FUNCTION__` must always be used for recursive calls even when the function is renamed using `__BOOST_LOCAL_FUNCTION_END_RENAME__` (see renamed local functions later in this section).
-
-[endsect]
-
-[section Nested Declarations]
-
-[endsect]
-
-[section Limitations: Overloading and Operators]
-
-This is a list of limitations of this library's local functions compared to usual features of C++ functions.
-
-[h5 Overloading]
-
-It is not possible to overload local functions.
-Declaring multiple local functions with the same name within the same enclosing scope generates a compile-time error (even if the different declarations specify different parameters).
-[footnote
-*Rationale.*
-This is because a local function is a functor object declared as a local variable within the enclosing scope.
-Therefore, declaring two local functions with the same name within the same enclosing scope declares two local variables with the same name within the same scope and that is not allowed in C++.
-]
-
-For example, the following code will *not* compile:
-
- void f() {
- __BOOST_LOCAL_FUNCTION__(
- (void) (l)( (const int&)(i) )
- ) {
- std::cout << i << std::endl;
- } __BOOST_LOCAL_FUNCTION_END__(l)
-
- __BOOST_LOCAL_FUNCTION__(
- (void) (l)( (const double&)(d) )
- ) {
- std::cout << d << std::endl;
- } __BOOST_LOCAL_FUNCTION_END__(l) // Error: Cannot overload.
-
- ...
- }
-
-[h5 Nesting]
-
-It is not possible to nest local functions, local blocks, or local exits within each other.
-Nesting will generate a compile-time error.
-[footnote
-*Rationale.*
-This is because within a nested code block only global or static variables can be accessed while __Boost_ScopeExit__ variable [@http://lists.boost.org/Archives/boost/2006/11/113658.php binding mechanism] requires to access local variables that hold the bound variables.
-]
-
-For example, the following code will *not* compile:
-
- void f() {
- __BOOST_LOCAL_FUNCTION__(
- (int) (l)( (int)(i) )
- ) {
- __BOOST_LOCAL_FUNCTION__( // Error: Cannot nest.
- (int) (m)( (int)(j) )
- ) {
- return j * 10;
- } __BOOST_LOCAL_FUNCTION_END__(m)
-
- return m(i) * 10;
- } __BOOST_LOCAL_FUNCTION_END__(l)
-
- ...
- }
-
-[h5 Operators]
-
-Local functions cannot be operators.
-Naming a local function `operator...` will generate a compile-time error.
-[footnote
-*Rationale.*
-This is the because a local function name must be a valid local variable name (the local variable to hold the local functor object) and operators cannot be used as local variable names.
-]
-
-For example, the following code will *not* compile:
-
- void f() {
- struct point {
- double x;
- double y;
- };
-
- __BOOST_LOCAL_FUNCTION__( // Error: Cannot be `operator==`.
- (bool) (operator==)( (const point&)(p) (const point&)(q) )
- ) {
- return p.x == q.x && p.y == q.y;
- ) __BOOST_LOCAL_FUNCTION_END__(operator==)
-
- ...
- }
-
-[h5 Etc]
-
-Some usual C++ function features like `inline` and default parameters are supported for local functions while other features are not supported.
-The parenthesized syntax itself (see the __Grammar__ section) could be extended to support /all/ C++ function features even with the addition of concepts and named parameters (see __Contractpp__):
-
- ``/parenthesized-signature:/``
- ``/[/``(export)``/]/`` ``/[/``(template)(``/template-parameter-list/``)``/]/`` ``/[/``(requires)(``/concept-list/``)``/]/``
- ``/[/``(explicit)``/]/``
- ``/[/``(inline)``/]/`` ``/[/``(extern)``/]/``
- ``/[/``(static)``/]/`` ``/[/``(virtual)``/]/``
- (``/result-type/``) (``/function-name/``)(``/parameter-list/``)
- ``/[/``(const)``/]/`` ``/[/``(volatile)``/]/``
-
-However, not all these features apply to local functions:
-
-[table
-[
- [ C++ Function Feature ]
- [ Local Function Support ]
- [ Rationale ]
-]
-[
- [ `(export)` ]
- [ No ]
- [ This is not supported because local functions cannot be templates (plus most C++ compilers do not implement `export`). ]
-]
-[
- [ `(template)(`/template-parameter-list/`)` ]
- [ No ]
- [ This is not supported because local functions are implemented using local classes and C++ local classes cannot be templates. ]
-]
-[
- [ `(requires)(`/concept-list/`)` ]
- [ No ]
- [ This library could internally use __Boost_ConceptCheck__ to check the concepts specified by using the parenthesized syntax. However, concept checking is not supported because local functions cannot be templates. ]
-]
-[
- [ `(explicit)` ]
- [ No ]
- [ This is not supported because local functions are not constructors. ]
-]
-[
- [ `(inline)` ]
- [ Yes ]
- [ This is supported (see the __Advanced__ section). ]
-]
-[
- [ `(extern)` ]
- [ No ]
- [ This is not supported because local functions are always defined locally within the enclosing scope and together with their declarations. ]
-]
-[
- [ `(static)` ]
- [ No ]
- [ This is not supported because local functions are not member functions. ]
-]
-[
- [ `(virtual)` ]
- [ No ]
- [ This is not supported because local functions are not member functions.
-
-In theory, it would be possible for a local functor class to inherit from another local functor class.
-The parenthesized syntax could be extended to specify the eventual base local functor class within the parenthesized signature (e.g., using `... (extends)(`/base/`)`).
-However, this "inheritance" feature is not implemented because it seems of [@http://lists.boost.org/Archives/boost/2010/09/170895.php no use] given that local functions can be bound to one another thus they can simply call each other directly without recurring to dynamic binding or base function call.
- ]
-]
-[
- [ `(`/result-type/`)` ]
- [ Yes ]
- [ This is supported (see the __Tutorial__ section). ]
-]
-[
- [ `(`/function-name/`)` ]
- [ Yes ]
- [ This is supported but it cannot be overloaded and it cannot be an operator (see the __Tutorial__ and __Advanced__ sections). ]
-]
-[
- [ `(`/parameter-list/`)` ]
- [ Yes ]
- [ This is supported and it also supports the `auto` and `register` parameter classifiers, default parameters, and binding of variables in scope (see the __Tutorial__ and __Advanced__ sections).
-
-In addition, the parenthesized syntax could support named parameters introducing the "keywords" `(in)`, `(out)`, `(inout)`, and then using __Boost_Parameter__ to internally implement named parameters.
-However, local functions cannot be templates so they cannot be used with __Boost_Parameter__ thus named parameters are not supported for local functions. ]
-]
-[
- [ Trailing `(const)` ]
- [ No ]
- [ This is not supported because local functions are not member functions. ]
-]
-[
- [ Trailing `(volatile)` ]
- [ No ]
- [ This is not supported because local functions are not member functions. ]
-]
-]
-
-[endsect]
-
-[endsect]
-
Copied: sandbox/local/libs/local/doc/qbk/advanced_topics.qbk (from r69958, /sandbox/local/libs/local/doc/qbk/advanced.qbk)
==============================================================================
--- /sandbox/local/libs/local/doc/qbk/advanced.qbk (original)
+++ sandbox/local/libs/local/doc/qbk/advanced_topics.qbk 2011-03-18 17:38:31 EDT (Fri, 18 Mar 2011)
@@ -170,7 +170,7 @@
[endsect]
-[section Deducing Bound Types]
+[section Deducing Bound Types (concepts, etc)]
While the ISO C++ standard does not allow for member functions of local classes to have template parameters, this library allows to call template functions from within a local function, a local block, or a local exit passing bound variables without explicitly specifying their types.
This essentially allows local functions, local blocks, and local exits to be [@http://en.wikipedia.org/wiki/Type_polymorphism polymorphic] in the type of the bound variables (like a template is polymorphic in the type of its template parameters).
@@ -184,8 +184,12 @@
...
This macro expands to a type expression that evaluates (at compile-time) to the fully qualified type of the specified bound variable.
+
+[note
This type expression is fully qualified in the sense that it will be constant if the variable is bound by constant and it will also be a reference is the variable is bound by reference (if needed, programmers can strip away the `const` and `&` qualifiers using `boost::remove_const` and `boost::remove_reference`, or similar template metafunctions).
+]
+The deduced bound type can be used within the body to declare a local variable, to check concepts, etc.
For example:
[table
@@ -204,32 +208,32 @@
[section Passing Local Functions]
-It is possible to assign a local function to a functor (e.g., `boost::function`) in order to pass the local function to another function, etc.
-It is in general recommended to use the `boost::local::__function__` functor instead because its API also supports default parameters.
+Local functions can be used as functors.
+For example, it is possible to assign a local function to a functor parameter (using `boost::function`, etc) in order to pass the local function to another function.
+However, it is in general recommended to use the `boost::local::__function__` functor because it supports default parameters.
[important
-When assigning a local function to a functor programmers need to make sure that the *local function survives the scope of the functor* otherwise the functor will be invalid and its use will generate a run-time error (as usual with C++ functors).
+When assigning a local function to a functor, programmers need to make sure that the *local function survives the scope of the functor* otherwise the functor will be invalid and its use will generate a run-time error (as usual with C++ functors).
]
The `boost::local::__function__` template takes two parameters (see the __Reference__ section):
- template< typename F, size_t defaults = 0 > class __function__;
+ template<typename F, size_t defaults = 0> class __function__;
[variablelist
[ [F] [
-The template parameter `F` specifies the function signature using the same
-syntax as __Boost_Function__'s preferred syntax.
+The template parameter `F` is a function type specifying the function signature using the same syntax as __Boost_Function__'s preferred syntax.
For example:``
- __function__< int() > // Returns `int` and takes no parameter.
- __function__< int(double, char) > // Returns `int`and takes two parameters: a `double` followed by a `char`.
+ __function__<int()> // Returns `int` and takes no parameter.
+ __function__<int(double, char)> // Returns `int`and takes two parameters: a `double` followed by a `char`.
``] ]
[ [defaults] [
-The template parameter `defaults` specifies the number of defaults parameters (counting from the last parameter as usual): `0` if no parameter is optional, `1` if the last parameter is optional, `2` if the last two parameters are optional, etc.
+The template parameter `defaults` is a non-negative integer number specifying the number of defaults parameters (counting from the last parameter as usual): `0` if no parameter is optional, `1` if the last parameter is optional, `2` if the last two parameters are optional, etc.
The `defaults` template parameter must be between `0` and the total number of parameters as specified by `F`, it is optional and it is `0` by default.
For example:``
- __function__< int(double, char) > // No default: All parameters must be specified.
- __function__< int(double, char), 1 > // 1 default: The last `char` parameter is optional.
- __function__< int(double, char), 2 > // 2 defaults: All parameters are optional.
+ __function__<int(double, char)> // No default: All parameters must be specified.
+ __function__<int(double, char), 1> // 1 default: The last `char` parameter is optional.
+ __function__<int(double, char), 2> // 2 defaults: All parameters are optional.
``] ]
]
@@ -253,186 +257,110 @@
[section Exception Specifications]
It is possible to program exception specifications for local functions, local blocks, and local exits.
+Exception specifications are programmed outside the macros and just before the body definition as usual in C++.
-Exception specifications are programmed just before the body (and outside the macros).
-For example:
-
-[add_except_cpp]
-
-[endsect]
-
-[section Storage Classifiers `auto` and `register`]
+[important
+However, note that the exception specifications only apply to the body code specified by programmers and they do not apply to the rest of the code automatically generated by the macro expansions to implement local functions, local blocks, and local exits.
+For example, even if the body code is specified to throw no exception using `throw () { ... }`, the execution of the library code automatically generated by the macros could still throw (if there is no memory, etc).
+]
-As specified in the __Grammar__ section, the parenthesized signature also supports `inline`d local functions, and the `auto` and `register` classifiers for local function parameters.
+For example:
-[note
-However, note that local functions will always add some overhead because of the functor object used to internally implement them.
-Compilers might not be able to optimize away the local function overhead even when `inline`, `auto`, and `register` are used.
+[table
+[ [Variadic Macro Syntax (C99 and later compilers)] [Sequencing Macro Syntax (all C++ compilers)] ]
+[ [ [add_except_va_cpp] ] [ [add_except_cpp] ] ]
]
-[add_optimizers_cpp]
-
[endsect]
-[section Recursive Local Functions]
+[section Storage Classifiers (`auto` and `register`)]
-A local function can recursively call itself as usual with C++ functions.
-
-For example, the following local function is used to recursively calculate and print the factorial of the specified numbers:
-
-[factorial_cpp]
+Local function parameters support the storage classifiers as usual in C++.
+The `auto` storage classifier is specified as:
-The original local function name as specified in the parenthesized signature passed to `__BOOST_LOCAL_FUNCTION__` must always be used for recursive calls even when the function is renamed using `__BOOST_LOCAL_FUNCTION_END_RENAME__` (see renamed local functions later in this section).
+ auto ``/parameter-type parameter-name/``
-[endsect]
-
-[section Nested Declarations]
+and the `register` storage classifier is specified as:
-[endsect]
+ register ``/parameter-type parameter-name/``
-[section Limitations: Overloading and Operators]
-
-This is a list of limitations of this library's local functions compared to usual features of C++ functions.
-
-[h5 Overloading]
+For example:
-It is not possible to overload local functions.
-Declaring multiple local functions with the same name within the same enclosing scope generates a compile-time error (even if the different declarations specify different parameters).
-[footnote
-*Rationale.*
-This is because a local function is a functor object declared as a local variable within the enclosing scope.
-Therefore, declaring two local functions with the same name within the same enclosing scope declares two local variables with the same name within the same scope and that is not allowed in C++.
+[table
+[ [Variadic Macro Syntax (C99 and later compilers)] [Sequencing Macro Syntax (all C++ compilers)] ]
+[ [ [add_optimizers_va_cpp] ] [ [add_optimizers_cpp] ] ]
]
-For example, the following code will *not* compile:
+[endsect]
- void f() {
- __BOOST_LOCAL_FUNCTION__(
- (void) (l)( (const int&)(i) )
- ) {
- std::cout << i << std::endl;
- } __BOOST_LOCAL_FUNCTION_END__(l)
-
- __BOOST_LOCAL_FUNCTION__(
- (void) (l)( (const double&)(d) )
- ) {
- std::cout << d << std::endl;
- } __BOOST_LOCAL_FUNCTION_END__(l) // Error: Cannot overload.
+[section Recursive Local Functions]
- ...
- }
+A local function can recursively call itself as usual with C++ functions.
-[h5 Nesting]
+For example, the following local function is used to recursively calculate and print the factorial of the specified numbers:
-It is not possible to nest local functions, local blocks, or local exits within each other.
-Nesting will generate a compile-time error.
-[footnote
-*Rationale.*
-This is because within a nested code block only global or static variables can be accessed while __Boost_ScopeExit__ variable [@http://lists.boost.org/Archives/boost/2006/11/113658.php binding mechanism] requires to access local variables that hold the bound variables.
+[table
+[ [Variadic Macro Syntax (C99 and later compilers)] [Sequencing Macro Syntax (all C++ compilers)] ]
+[ [ [factorial_va_cpp] ] [ [factorial_cpp] ] ]
]
-For example, the following code will *not* compile:
-
- void f() {
- __BOOST_LOCAL_FUNCTION__(
- (int) (l)( (int)(i) )
- ) {
- __BOOST_LOCAL_FUNCTION__( // Error: Cannot nest.
- (int) (m)( (int)(j) )
- ) {
- return j * 10;
- } __BOOST_LOCAL_FUNCTION_END__(m)
+[endsect]
- return m(i) * 10;
- } __BOOST_LOCAL_FUNCTION_END__(l)
+[section Nested Declarations]
- ...
- }
+It is possible to nest local function, local block, and local exit declarations into one another.
-[h5 Operators]
+For example:
-Local functions cannot be operators.
-Naming a local function `operator...` will generate a compile-time error.
-[footnote
-*Rationale.*
-This is the because a local function name must be a valid local variable name (the local variable to hold the local functor object) and operators cannot be used as local variable names.
+[table
+[ [Variadic Macro Syntax (C99 and later compilers)] [Sequencing Macro Syntax (all C++ compilers)] ]
+[ [ [nesting_va_cpp] ] [ [nesting_cpp] ] ]
]
-For example, the following code will *not* compile:
-
- void f() {
- struct point {
- double x;
- double y;
- };
-
- __BOOST_LOCAL_FUNCTION__( // Error: Cannot be `operator==`.
- (bool) (operator==)( (const point&)(p) (const point&)(q) )
- ) {
- return p.x == q.x && p.y == q.y;
- ) __BOOST_LOCAL_FUNCTION_END__(operator==)
-
- ...
- }
-
-[h5 Etc]
-
-Some usual C++ function features like `inline` and default parameters are supported for local functions while other features are not supported.
-The parenthesized syntax itself (see the __Grammar__ section) could be extended to support /all/ C++ function features even with the addition of concepts and named parameters (see __Contractpp__):
+[endsect]
- ``/parenthesized-signature:/``
- ``/[/``(export)``/]/`` ``/[/``(template)(``/template-parameter-list/``)``/]/`` ``/[/``(requires)(``/concept-list/``)``/]/``
- ``/[/``(explicit)``/]/``
- ``/[/``(inline)``/]/`` ``/[/``(extern)``/]/``
- ``/[/``(static)``/]/`` ``/[/``(virtual)``/]/``
- (``/result-type/``) (``/function-name/``)(``/parameter-list/``)
- ``/[/``(const)``/]/`` ``/[/``(volatile)``/]/``
+[section Limitations (overloading, operators, etc)]
-However, not all these features apply to local functions:
+The following table summarizes all the usual C++ function features that are not supported for local functions.
[table
[
[ C++ Function Feature ]
[ Local Function Support ]
- [ Rationale ]
+ [ Reason ]
]
[
- [ `(export)` ]
+ [ `export` ]
[ No ]
[ This is not supported because local functions cannot be templates (plus most C++ compilers do not implement `export`). ]
]
[
- [ `(template)(`/template-parameter-list/`)` ]
+ [ `template<`/template-parameter-list/`>` ]
[ No ]
[ This is not supported because local functions are implemented using local classes and C++ local classes cannot be templates. ]
]
[
- [ `(requires)(`/concept-list/`)` ]
- [ No ]
- [ This library could internally use __Boost_ConceptCheck__ to check the concepts specified by using the parenthesized syntax. However, concept checking is not supported because local functions cannot be templates. ]
-]
-[
- [ `(explicit)` ]
+ [ `explicit` ]
[ No ]
[ This is not supported because local functions are not constructors. ]
]
[
- [ `(inline)` ]
- [ Yes ]
- [ This is supported (see the __Advanced__ section). ]
+ [ `inline` ]
+ [ No ]
+ [ Local functions are always defined together with their declarations so they are always inlined and there is no need to specify them `inline`. ]
]
[
- [ `(extern)` ]
+ [ `extern` ]
[ No ]
[ This is not supported because local functions are always defined locally within the enclosing scope and together with their declarations. ]
]
[
- [ `(static)` ]
+ [ `static` ]
[ No ]
[ This is not supported because local functions are not member functions. ]
]
[
- [ `(virtual)` ]
+ [ `virtual` ]
[ No ]
[ This is not supported because local functions are not member functions.
@@ -442,35 +370,81 @@
]
]
[
- [ `(`/result-type/`)` ]
+ [ [^/result-type/] ]
[ Yes ]
[ This is supported (see the __Tutorial__ section). ]
]
[
- [ `(`/function-name/`)` ]
+ [ [^/function-name/] ]
[ Yes ]
- [ This is supported but it cannot be overloaded and it cannot be an operator (see the __Tutorial__ and __Advanced__ sections). ]
+ [ This is supported but it cannot be overloaded and it cannot be an operator (see the __Tutorial__ and __Advanced_Topics__ sections). ]
]
[
- [ `(`/parameter-list/`)` ]
+ [ [^/parameter-list/] ]
[ Yes ]
- [ This is supported and it also supports the `auto` and `register` parameter classifiers, default parameters, and binding of variables in scope (see the __Tutorial__ and __Advanced__ sections).
-
-In addition, the parenthesized syntax could support named parameters introducing the "keywords" `(in)`, `(out)`, `(inout)`, and then using __Boost_Parameter__ to internally implement named parameters.
-However, local functions cannot be templates so they cannot be used with __Boost_Parameter__ thus named parameters are not supported for local functions. ]
+ [ This is supported and it also supports the `auto` and `register` storage classifiers, default parameters, and binding of variables in scope (see the __Tutorial__ and __Advanced_Topics__ sections). ]
]
[
- [ Trailing `(const)` ]
+ [ Trailing `const` qualifier ]
[ No ]
[ This is not supported because local functions are not member functions. ]
]
[
- [ Trailing `(volatile)` ]
+ [ Trailing `volatile` qualifier ]
[ No ]
[ This is not supported because local functions are not member functions. ]
]
]
+[h5 Overloading]
+
+It is not possible to overload local functions.
+Declaring multiple local functions with the same name within the same enclosing scope generates a compile-time error (even if the different declarations specify different parameters).
+[footnote
+*Rationale.*
+This is because a local function is a functor object declared as a local variable within the enclosing scope.
+Therefore, declaring two local functions with the same name within the same enclosing scope declares two local variables with the same name within the same scope and that is not allowed in C++.
+]
+
+For example, the following code will *not* compile:
+
+ void f() {
+ void __BOOST_LOCAL_FUNCTION_PARAMS__( (const int& i) ) {
+ ...
+ } __BOOST_LOCAL_FUNCTION_NAME__(l)
+
+ void __BOOST_LOCAL_FUNCTION_PARAMS__( (const double& d) ) {
+ ...
+ } __BOOST_LOCAL_FUNCTION_NAME__(l) // Error: Cannot overload.
+
+ ...
+ }
+
+[h5 Operators]
+
+Local functions cannot be operators.
+Naming a local function `operator...` will generate a compile-time error.
+[footnote
+*Rationale.*
+This is the because a local function name must be a valid local variable name (the local variable to hold the local functor object) and operators cannot be used as local variable names.
+]
+
+For example, the following code will *not* compile:
+
+ void f() {
+ struct point {
+ double x;
+ double y;
+ };
+
+ bool __BOOST_LOCAL_FUNCTION_PARAMS__(
+ (const point&)(p) (const point&)(q) ) {
+ return p.x == q.x && p.y == q.y;
+ ) __BOOST_LOCAL_FUNCTION_NAME__(operator==) // Error: Cannot be `operator==`.
+
+ ...
+ }
+
[endsect]
[endsect]
Copied: sandbox/local/libs/local/doc/qbk/getting_started.qbk (from r69958, /sandbox/local/libs/local/doc/qbk/starting.qbk)
==============================================================================
--- /sandbox/local/libs/local/doc/qbk/starting.qbk (original)
+++ sandbox/local/libs/local/doc/qbk/getting_started.qbk 2011-03-18 17:38:31 EDT (Fri, 18 Mar 2011)
@@ -4,7 +4,7 @@
[/ License, Version 1.0 (see accompanying file LICENSE_1_0.txt or a ]
[/ copy at http://www.boost.org/LICENSE_1_0.txt). ]
-[section:Starting Getting Started]
+[section:Getting Getting Started]
This section explains how to setup your system to use this library.
@@ -56,10 +56,6 @@
This library implementation uses a number of __Boost__ libraries among which: __Boost_Preprocessor__, __Boost_ScopeExit__, __Boost_Typeof__, __Boost_TypeTraits__, and __Boost_MPL__.
These __Boost__ libraries must be properly installed on your system in order for this library to work.
-[endsect]
-
-[section File Structure]
-
The header files of this library are divided as follow:
``[headerref boost/local/function.hpp] /local functions/``
@@ -69,10 +65,6 @@
``[headerref boost/local/function.hpp] /local functors/``
``[headerref boost/local/config.hpp] /configuration macros/``
-[endsect]
-
-[section Symbols]
-
The following symbols are part of the library private API, they are not documented, and they should not be directly used by programmers:
[footnote
*Rationale.*
Modified: sandbox/local/libs/local/doc/qbk/introduction.qbk
==============================================================================
--- sandbox/local/libs/local/doc/qbk/introduction.qbk (original)
+++ sandbox/local/libs/local/doc/qbk/introduction.qbk 2011-03-18 17:38:31 EDT (Fri, 18 Mar 2011)
@@ -70,17 +70,20 @@
Finally, within the local function body the type of a bound variable can be accessed using [^__BOOST_LOCAL_TYPEOF__(['variable-name])].
(See the __Tutorial__ section.)
# The macro ending the local function definition specifies the local function name.
+No semicolon `;` is required after the ending macro.
# The local function macros declare a functor object local to the enclosing scope named `add`.
The functor `add` has `void` result type, it can be called by specifying one parameter of type `double`, and it has access to the variables in scope `factor` (by constant value) and `sum` (by reference).
# The *local exit* declaration macro only specifies the variables in scope to bind (by reference or value and eventually as constants).
Exceptions specifications can be programmed outside the macro and just before the body code block `{...}` as usual (see the __Tutorial__ section).
# The local exit code will be automatically executed when the enclosing scope is exited.
# Local exits are anonymous so their ending macro takes no argument.
+No semicolon `;` is required after the ending macro.
# The local function `add` can also be passed as a template parameter (for example, to the STL `std::for_each` algorithm).
# The *local block* declaration macro only specifies the variables in scope to bind (by reference or value and eventually as constants).
# The local block code is executed "in place" where it is programmed like a usual C++ block of code `{ ... }`.
In this example, the compiler will correctly generate an error if the assignment operator `=` is mistakenly used instead of the equality operator `==` because the variable `sum` is bound by constant reference so it cannot be modified.
# Local blocks are anonymous so their ending macro takes no argument.
+No semicolon `;` is required after the ending macro.
[endsect]
Modified: sandbox/local/libs/local/doc/qbk/local.qbk
==============================================================================
--- sandbox/local/libs/local/doc/qbk/local.qbk (original)
+++ sandbox/local/libs/local/doc/qbk/local.qbk 2011-03-18 17:38:31 EDT (Fri, 18 Mar 2011)
@@ -40,16 +40,16 @@
[def __StroustrupGlossary__ [@http://www2.research.att.com/~bs/glossary.html \[StroustupGlossary\]]]
[def __Introduction__ [link boost_local.Introduction Introduction]]
-[def __Starting__ [link boost_local.Starting Starting]]
+[def __Getting_Started__ [link boost_local.Getting_Started Getting Started]]
[def __Tutorial__ [link boost_local.Tutorial Tutorial]]
[def __Tutorial_Empty_Parameters__ [link boost_local.Tutorial.Empty_Parameters Empty Parameters]]
[def __Tutorial_Binding__ [link boost_local.Tutorial.Binding Binding]]
-[def __Advanced__ [link boost_local.Advanced Advanced]]
+[def __Advanced_Topics__ [link boost_local.Advanced_Topics Advanced Topics]]
[def __Reference__ [@reference.html Reference]]
-[def __Grammar__ [link boost_local.Grammar Grammar]]
-[def __Alternatives__ [link boost_local.Alternatives Alternatives]]
[def __Examples__ [link boost_local.Examples Examples]]
-[def __Releases__ [link boost_local.Releases Releases]]
+[def __Alternatives__ [link boost_local.Alternatives Alternatives]]
+[def __Implementation__ [link boost_local.Implementation Implementation]]
+[def __Release_Notes__ [link boost_local.Release_Notes Release Notes]]
[def __Bibliography__ [link boost_local.Bibliography Bibliography]]
[def __Acknowledgments__ [link boost_local.Acknowledgments Acknowledgments]]
@@ -100,23 +100,28 @@
[import ../../example/typeof_va.cpp]
[import ../../example/typeof_tpl.cpp]
[import ../../example/typeof_tpl_va.cpp]
-
-[import ../../example/add_num_sum.cpp]
-[import ../../example/factorial.cpp]
[import ../../example/add_except.cpp]
+[import ../../example/add_except_va.cpp]
[import ../../example/add_optimizers.cpp]
+[import ../../example/add_optimizers_va.cpp]
+[import ../../example/factorial.cpp]
+[import ../../example/factorial_va.cpp]
+[import ../../example/nesting.cpp]
+[import ../../example/nesting_va.cpp]
+
+[import ../../example/add_num_sum.cpp]
The Boost Local library implements local functions, local blocks, and local exits for the C++ programming language.
[include introduction.qbk]
-[include starting.qbk]
+[include getting_started.qbk]
[include tutorial.qbk]
-[include advanced.qbk]
+[include advanced_topics.qbk]
[xinclude ../reference.xml]
[include examples.qbk]
[include alternatives.qbk]
[include implementation.qbk]
-[include releases.qbk]
+[include release_notes.qbk]
[include bibliography.qbk]
[include acknowledgements.qbk]
Copied: sandbox/local/libs/local/doc/qbk/release_notes.qbk (from r69958, /sandbox/local/libs/local/doc/qbk/releases.qbk)
==============================================================================
--- /sandbox/local/libs/local/doc/qbk/releases.qbk (original)
+++ sandbox/local/libs/local/doc/qbk/release_notes.qbk 2011-03-18 17:38:31 EDT (Fri, 18 Mar 2011)
@@ -4,7 +4,7 @@
[/ License, Version 1.0 (see accompanying file LICENSE_1_0.txt or a ]
[/ copy at http://www.boost.org/LICENSE_1_0.txt). ]
-[section:Releases Releases]
+[section:Release Release Notes]
[section Version 0.1.1]
Deleted: sandbox/local/libs/local/doc/qbk/releases.qbk
==============================================================================
--- sandbox/local/libs/local/doc/qbk/releases.qbk 2011-03-18 17:38:31 EDT (Fri, 18 Mar 2011)
+++ (empty file)
@@ -1,37 +0,0 @@
-
-[/ Copyright (C) 2009-2011 Lorenzo Caminiti ]
-[/ Use, modification, and distribution is subject to the Boost Software ]
-[/ License, Version 1.0 (see accompanying file LICENSE_1_0.txt or a ]
-[/ copy at http://www.boost.org/LICENSE_1_0.txt). ]
-
-[section:Releases Releases]
-
-[section Version 0.1.1]
-
-# Uploaded library source into Boost SVN sandbox.
-# Fixed prev/next arrows and other minor layouts in documentation.
-# Added Release section to documentation.
-
-[endsect]
-
-[section Version 0.1.0]
-
-# Shared with Boost for first round of comments.
-
-[endsect]
-
-[section Version 0.0.1]
-
-# Completed development, examples, and documentation.
-
-[endsect]
-
-[section TODO]
-
-# Finish local function parenthesized syntax validation macros.
-# Add examples to Alternatives section for Local Classes, C++0x lambads, Boost.Lambda, and Boost.Phoenix (ask boosters).
-
-[endsect]
-
-[endsect]
-
Deleted: sandbox/local/libs/local/doc/qbk/starting.qbk
==============================================================================
--- sandbox/local/libs/local/doc/qbk/starting.qbk 2011-03-18 17:38:31 EDT (Fri, 18 Mar 2011)
+++ (empty file)
@@ -1,102 +0,0 @@
-
-[/ Copyright (C) 2009-2011 Lorenzo Caminiti ]
-[/ Use, modification, and distribution is subject to the Boost Software ]
-[/ License, Version 1.0 (see accompanying file LICENSE_1_0.txt or a ]
-[/ copy at http://www.boost.org/LICENSE_1_0.txt). ]
-
-[section:Starting Getting Started]
-
-This section explains how to setup your system to use this library.
-
-[section This Documentation]
-
-Programmers should be ready to use this library, at least at a basic level, after reading the following sections of this documentation:
-
-* The __Introduction__ section provides an overview on the library and its features.
-* The __Starting__ section explains how to read this documentation, how to install the library to work with the supported compilers and platforms.
-* The __Tutorial__ section provides a good explanation of basic usages of the library with extensive examples.
-
-The following sections could be consulted at a later point to gain a more in-depth knowledge of the library features:
-
-* The __Advanced__ section explains advanced usages of the library.
-* The __Reference__ section is the reference manual of the library public API.
-* The __Examples__ section lists the source code of a few additional examples that use this library.
-* The __Alternatives__ section describes alternatives to this library to implement local functions.
-
-The following sections are for reference only:
-
-* The __Releases__ section contains short release notes.
-* The __Bibliography__ section lists references that were consulted in the design and development of this library.
-* The __Acknowledgments__ section attempts to recognize all the people that contributes directly or indirectly to the design and development of this library.
-
-Furthermore, some footnotes are marked by the word "*Rationale*" because they explain reasons behind decisions made during the design and implementation of this library.
-
-[endsect]
-
-[section Compilers and Platforms]
-
-The implementation of this library uses preprocessor and template metaprogramming (as supported by __Boost_Preprocessor__ and __Boost_MPL__), templates with partial specializations and function pointers (to support an interface similar to the one of __Boost_Function__).
-As a consequence, this library is fairly demanding on compilers' compliance with the ISO C++ standard.
-At present, this library has been successfully compiled and tested on the following compilers and platforms:
-
-# GCC 4.2.4 on Ubuntu Linux.
-# GCC 3.4.4 on Cygwin.
-# Miscrosoft Visual Studio 8.0 on Windows XP.
-
-This library has not yet been tested on any other compiler or platform.
-
-[endsect]
-
-[section Installation]
-
-This library is composed of header files only.
-Therefore there is no pre-compiled object file which needs to be installed.
-Programmers can simply instruct the C++ compiler where to find the library header files (`-I` option for GCC, `/I` option for MSVC, etc) and they can start compiling the code from the __Examples__ section, the code cut-and-pasted from the examples in this documentation, and their own programs that use this library.
-
-This library implementation uses a number of __Boost__ libraries among which: __Boost_Preprocessor__, __Boost_ScopeExit__, __Boost_Typeof__, __Boost_TypeTraits__, and __Boost_MPL__.
-These __Boost__ libraries must be properly installed on your system in order for this library to work.
-
-[endsect]
-
-[section File Structure]
-
-The header files of this library are divided as follow:
-
- ``[headerref boost/local/function.hpp] /local functions/``
- ``[headerref boost/local/block.hpp] /local blocks/``
- ``[headerref boost/local/exit.hpp] /local exits/``
- ``[headerref boost/local/typeof.hpp] /bound variable type deduction/``
- ``[headerref boost/local/function.hpp] /local functors/``
- ``[headerref boost/local/config.hpp] /configuration macros/``
-
-[endsect]
-
-[section Symbols]
-
-The following symbols are part of the library private API, they are not documented, and they should not be directly used by programmers:
-[footnote
-*Rationale.*
-This library concatenates symbols specified by the programmers (e.g., the local function name) with other symbols (e.g., special prefixes or preprocessor line numbers) to make internal symbols with unique names to avoid name clashes.
-These symbols are separated by the letter "`X`" when they are concatenated so they can be read more easily while debugging the library.
-The underscore character "`_`" could not be used instead of the letter "`X`" because if the original symbols already contained a leading or trailing underscore, the concatenation would result in a symbol with double underscores "`__`" which is reserved by the C++ standard.
-]
-
-* Any symbol defined by files within the `"boost/local/aux_/"` directory (these header files should not be directly included by programmers).
-* Any symbol prefixed by `BOOST_LOCAL_AUX`.
-* Any symbol within the `boost::local::aux` namespace.
-* Any symbol prefixed by `boost_local_aux` (regardless of its namespace).
-
-[endsect]
-
-[section Compile-Time Configuration]
-
-Some of the library behaviour can be changed at compile-time by defining special /configuration macros/.
-If a configuration macro is left undefined, the library will use an appropriate default value for it.
-
-All configuration macros have names prefixed by `BOOST_LOCAL_CONFIG` (see __Reference__ section).
-It is strongly recommended not to change the library configuration macro definitions unless strictly necessary.
-
-[endsect]
-
-[endsect]
-
Modified: sandbox/local/libs/local/example/Jamfile.jam
==============================================================================
--- sandbox/local/libs/local/example/Jamfile.jam (original)
+++ sandbox/local/libs/local/example/Jamfile.jam 2011-03-18 17:38:31 EDT (Fri, 18 Mar 2011)
@@ -16,9 +16,6 @@
exe add_exit : add_exit.cpp ;
exe add_exit_va : add_exit_va.cpp ;
-exe add_num : add_num.cpp ;
-exe add_num_va : add_num_va.cpp ;
-
exe add_num_factor_sum : add_num_factor_sum.cpp ;
exe add_num_factor_sum_va : add_num_factor_sum_va.cpp ;
@@ -71,3 +68,9 @@
exe nesting : nesting.cpp ;
exe nesting_va : nesting_va.cpp ;
+exe typeof : typeof.cpp ;
+exe typeof_va : typeof_va.cpp ;
+
+exe typeof_tpl : typeof_tpl.cpp ;
+exe typeof_tpl_va : typeof_tpl_va.cpp ;
+
Modified: sandbox/local/libs/local/example/add_except_va.cpp
==============================================================================
--- sandbox/local/libs/local/example/add_except_va.cpp (original)
+++ sandbox/local/libs/local/example/add_except_va.cpp 2011-03-18 17:38:31 EDT (Fri, 18 Mar 2011)
@@ -4,7 +4,7 @@
// License, Version 1.0 (see accompanying file LICENSE_1_0.txt or a
// copy at http://www.boost.org/LICENSE_1_0.txt).
-//[add_except_cpp
+//[add_except_va_cpp
#include <boost/local/function.hpp>
#include <boost/local/block.hpp>
#include <boost/local/exit.hpp>
Modified: sandbox/local/libs/local/example/nesting.cpp
==============================================================================
--- sandbox/local/libs/local/example/nesting.cpp (original)
+++ sandbox/local/libs/local/example/nesting.cpp 2011-03-18 17:38:31 EDT (Fri, 18 Mar 2011)
@@ -1,6 +1,7 @@
// Local functions, blocks, and exits can be arbitrarily nested into each other.
+//[nesting_cpp
#include <boost/local/function.hpp>
#include <boost/local/block.hpp>
#include <boost/local/exit.hpp>
@@ -36,4 +37,5 @@
x--; n();
return 0;
}
+//]
Modified: sandbox/local/libs/local/example/nesting_va.cpp
==============================================================================
--- sandbox/local/libs/local/example/nesting_va.cpp (original)
+++ sandbox/local/libs/local/example/nesting_va.cpp 2011-03-18 17:38:31 EDT (Fri, 18 Mar 2011)
@@ -2,6 +2,7 @@
// Local functions, blocks, and exits can be arbitrarily nested into each other.
// Simplified syntax for variadic macros only.
+//[nesting_va_cpp
#include <boost/local/function.hpp>
#include <boost/local/block.hpp>
#include <boost/local/exit.hpp>
@@ -37,4 +38,5 @@
x--; n();
return 0;
}
+//]
Modified: sandbox/local/libs/local/example/print_map.cpp
==============================================================================
--- sandbox/local/libs/local/example/print_map.cpp (original)
+++ sandbox/local/libs/local/example/print_map.cpp 2011-03-18 17:38:31 EDT (Fri, 18 Mar 2011)
@@ -11,8 +11,11 @@
#include <string>
#include <iostream>
-template<typename K, typename T> struct key_size { static const size_t value; };
-template<typename K, typename T> const size_t key_size<K, T>::value = sizeof(K);
+template<typename K, typename T> struct key_sizeof {
+ static const size_t value;
+};
+template<typename K, typename T> const size_t key_sizeof<K, T>::value =
+ sizeof(K);
std::string cat(const std::string& a, const std::string& b) { return a + b; }
@@ -25,7 +28,7 @@
// Also, identity macros handle leading symbols.
(BOOST_IDENTITY_TYPE((::sign_t)) sign)(default -1)
(const size_t& factor)(default // Or use `BOOST_IDENTITY_VALUE`.
- (key_size<std::string, size_t>::value))
+ (key_sizeof<std::string, size_t>::value))
(const std::string& separator)(default cat(":", " ")) ) {
for (std::map<std::string, size_t>::const_iterator i = m.begin();
i != m.end(); ++i) {
Modified: sandbox/local/libs/local/example/typeof.cpp
==============================================================================
--- sandbox/local/libs/local/example/typeof.cpp (original)
+++ sandbox/local/libs/local/example/typeof.cpp 2011-03-18 17:38:31 EDT (Fri, 18 Mar 2011)
@@ -10,6 +10,7 @@
#include <boost/local/exit.hpp>
#include <boost/local/typeof.hpp> // Typeof header.
#include <boost/type_traits.hpp>
+#include <boost/concept_check.hpp>
#include <algorithm>
#include <cassert>
@@ -19,6 +20,7 @@
double BOOST_LOCAL_FUNCTION_PARAMS( (double num) (const bind factor)
(bind& sum) ) {
+ // Typeof for variable declaration.
BOOST_LOCAL_TYPEOF(factor) f = factor;
return sum += f * num;
} BOOST_LOCAL_FUNCTION_NAME(add)
@@ -27,7 +29,10 @@
size_t size = 2;
double* nums = new double[size];
BOOST_LOCAL_EXIT( (const bind& size) (bind nums) ) {
- BOOST_LOCAL_TYPEOF(size) s = size;
+ // Typeof is qualified with eventual bind's `const` and `&`.
+ boost::remove_const<boost::remove_reference<
+ BOOST_LOCAL_TYPEOF(size)>::type>::type s;
+ s = size;
if (s && nums) delete[] nums;
} BOOST_LOCAL_EXIT_END
@@ -36,11 +41,10 @@
BOOST_LOCAL_BLOCK( (const bind &sum) (const bind& factor)
(const bind& x) (const bind& y) (const bind& z) ) {
- // Typeof qualified with eventual bind's `const` and `&`.
- boost::remove_const<boost::remove_reference<
- BOOST_LOCAL_TYPEOF(sum)>::type>::type s;
- s = sum;
- assert(s == factor * (x + y + z));
+ // Typeof for concept checking.
+ BOOST_CONCEPT_ASSERT((boost::EqualityComparable<
+ BOOST_LOCAL_TYPEOF(sum)>));
+ assert(sum == factor * (x + y + z));
} BOOST_LOCAL_BLOCK_END
return sum;
Modified: sandbox/local/libs/local/example/typeof_tpl.cpp
==============================================================================
--- sandbox/local/libs/local/example/typeof_tpl.cpp (original)
+++ sandbox/local/libs/local/example/typeof_tpl.cpp 2011-03-18 17:38:31 EDT (Fri, 18 Mar 2011)
@@ -10,6 +10,7 @@
#include <boost/local/exit.hpp>
#include <boost/local/typeof.hpp> // Typeof header.
#include <boost/type_traits.hpp>
+#include <boost/concept_check.hpp>
#include <algorithm>
#include <cassert>
@@ -20,6 +21,7 @@
T BOOST_LOCAL_FUNCTION_PARAMS_TPL( (T num) (const bind factor)
(bind& sum) ) {
+ // Typeof for variable declaration.
BOOST_LOCAL_TYPEOF(factor) f = factor;
return sum += f * num;
} BOOST_LOCAL_FUNCTION_NAME(add)
@@ -28,7 +30,10 @@
size_t size = 2;
T* nums = new T[size];
BOOST_LOCAL_EXIT_TPL( (const bind& size) (bind nums) ) {
- BOOST_LOCAL_TYPEOF(size) s = size;
+ // Typeof is qualified with eventual bind's `const` and `&`.
+ boost::remove_const<boost::remove_reference<
+ BOOST_LOCAL_TYPEOF(size)>::type>::type s;
+ s = size;
if (s && nums) delete[] nums;
} BOOST_LOCAL_EXIT_END
@@ -37,11 +42,10 @@
BOOST_LOCAL_BLOCK_TPL( (const bind &sum) (const bind& factor)
(const bind& x) (const bind& y) (const bind& z) ) {
- // Typeof qualified with eventual bind's `const` and `&`.
- typename boost::remove_const<typename boost::remove_reference<
- BOOST_LOCAL_TYPEOF(sum)>::type>::type s;
- s = sum;
- assert(s == factor * (x + y + z));
+ // Typeof for concept checking.
+ BOOST_CONCEPT_ASSERT((boost::EqualityComparable<
+ BOOST_LOCAL_TYPEOF(sum)>));
+ assert(sum == factor * (x + y + z));
} BOOST_LOCAL_BLOCK_END
return sum;
Modified: sandbox/local/libs/local/example/typeof_tpl_va.cpp
==============================================================================
--- sandbox/local/libs/local/example/typeof_tpl_va.cpp (original)
+++ sandbox/local/libs/local/example/typeof_tpl_va.cpp 2011-03-18 17:38:31 EDT (Fri, 18 Mar 2011)
@@ -10,6 +10,7 @@
#include <boost/local/exit.hpp>
#include <boost/local/typeof.hpp> // Typeof header.
#include <boost/type_traits.hpp>
+#include <boost/concept_check.hpp>
#include <algorithm>
#include <cassert>
@@ -20,6 +21,7 @@
T BOOST_LOCAL_FUNCTION_PARAMS_TPL(T num, const bind factor,
bind& sum) {
+ // Typeof for variable declaratin.
BOOST_LOCAL_TYPEOF(factor) f = factor;
return sum += f * num;
} BOOST_LOCAL_FUNCTION_NAME(add)
@@ -28,7 +30,10 @@
size_t size = 2;
T* nums = new T[size];
BOOST_LOCAL_EXIT_TPL(const bind& size, bind nums) {
- BOOST_LOCAL_TYPEOF(size) s = size;
+ // Typeof is qualified with eventual bind's `const` and `&`.
+ boost::remove_const<boost::remove_reference<
+ BOOST_LOCAL_TYPEOF(size)>::type>::type s;
+ s = size;
if (s && nums) delete[] nums;
} BOOST_LOCAL_EXIT_END
@@ -37,11 +42,10 @@
BOOST_LOCAL_BLOCK_TPL(const bind &sum, const bind& factor,
const bind& x, const bind& y, const bind& z) {
- // Typeof qualified with eventual bind's `const` and `&`.
- typename boost::remove_const<typename boost::remove_reference<
- BOOST_LOCAL_TYPEOF(sum)>::type>::type s;
- s = sum;
- assert(s == factor * (x + y + z));
+ // Tyepof for concept checking.
+ BOOST_CONCEPT_ASSERT((boost::EqualityComparable<
+ BOOST_LOCAL_TYPEOF(sum)>));
+ assert(sum == factor * (x + y + z));
} BOOST_LOCAL_BLOCK_END
return sum;
Modified: sandbox/local/libs/local/example/typeof_va.cpp
==============================================================================
--- sandbox/local/libs/local/example/typeof_va.cpp (original)
+++ sandbox/local/libs/local/example/typeof_va.cpp 2011-03-18 17:38:31 EDT (Fri, 18 Mar 2011)
@@ -10,6 +10,7 @@
#include <boost/local/exit.hpp>
#include <boost/local/typeof.hpp> // Typeof header.
#include <boost/type_traits.hpp>
+#include <boost/concept_check.hpp>
#include <algorithm>
#include <cassert>
@@ -19,6 +20,7 @@
double BOOST_LOCAL_FUNCTION_PARAMS(double num, const bind factor,
bind& sum) {
+ // Typeof for variable declaration.
BOOST_LOCAL_TYPEOF(factor) f = factor;
return sum += f * num;
} BOOST_LOCAL_FUNCTION_NAME(add)
@@ -27,7 +29,10 @@
size_t size = 2;
double* nums = new double[size];
BOOST_LOCAL_EXIT(const bind& size, bind nums) {
- BOOST_LOCAL_TYPEOF(size) s = size;
+ // Typeof is qualified with eventual bind's `const` and `&`.
+ boost::remove_const<boost::remove_reference<
+ BOOST_LOCAL_TYPEOF(size)>::type>::type s;
+ s = size;
if (s && nums) delete[] nums;
} BOOST_LOCAL_EXIT_END
@@ -36,11 +41,10 @@
BOOST_LOCAL_BLOCK(const bind &sum, const bind& factor,
const bind& x, const bind& y, const bind& z) {
- // Typeof qualified with eventual bind's `const` and `&`.
- boost::remove_const<boost::remove_reference<
- BOOST_LOCAL_TYPEOF(sum)>::type>::type s;
- s = sum;
- assert(s == factor * (x + y + z));
+ // Typeof for concept checking.
+ BOOST_CONCEPT_ASSERT((boost::EqualityComparable<
+ BOOST_LOCAL_TYPEOF(sum)>));
+ assert(sum == factor * (x + y + z));
} BOOST_LOCAL_BLOCK_END
return sum;
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