|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r71743 - in sandbox/local/libs/local: doc/html doc/html/boost_local doc/qbk example
From: lorcaminiti_at_[hidden]
Date: 2011-05-05 14:09:19
Author: lcaminiti
Date: 2011-05-05 14:09:15 EDT (Thu, 05 May 2011)
New Revision: 71743
URL: http://svn.boost.org/trac/boost/changeset/71743
Log:
Proofread Advanced Topics section.
Text files modified:
sandbox/local/libs/local/doc/html/BOOST_IDENTITY_TYPE.html | 2
sandbox/local/libs/local/doc/html/BOOST_IDENTITY_VALUE.html | 2
sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK.html | 2
sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK_END.html | 2
sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK_TPL.html | 2
sandbox/local/libs/local/doc/html/BOOST_LOCAL_CONFIG_COMPLIANT.html | 2
sandbox/local/libs/local/doc/html/BOOST_LOCAL_CONFIG_FUNCTION_ARITY_MAX.html | 2
sandbox/local/libs/local/doc/html/BOOST_LOCAL_CONFIG_THIS_PARAM_NAME.html | 2
sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT.html | 2
sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT_END.html | 2
sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT_TPL.html | 2
sandbox/local/libs/local/doc/html/BOOST_LOCAL_FUNCTION_NAME.html | 2
sandbox/local/libs/local/doc/html/BOOST_LOCAL_FUNCTION_PARAMS.html | 2
sandbox/local/libs/local/doc/html/BOOST_LOCAL_FUNCTION_PARAMS_TPL.html | 2
sandbox/local/libs/local/doc/html/BOOST_LOCAL_TYPEOF.html | 2
sandbox/local/libs/local/doc/html/boost_local/Advanced_Topics.html | 646 +++++++++++++++++++++------------------
sandbox/local/libs/local/doc/html/boost_local/Alternatives.html | 38 ++
sandbox/local/libs/local/doc/html/boost_local/Release_Notes.html | 7
sandbox/local/libs/local/doc/html/boost_local/Tutorial.html | 2
sandbox/local/libs/local/doc/html/index.html | 2
sandbox/local/libs/local/doc/qbk/advanced_topics.qbk | 150 +++++---
sandbox/local/libs/local/doc/qbk/alternatives.qbk | 9
sandbox/local/libs/local/doc/qbk/release_notes.qbk | 5
sandbox/local/libs/local/doc/qbk/tutorial.qbk | 2
sandbox/local/libs/local/example/add_function_inline.cpp | 8
sandbox/local/libs/local/example/add_function_inline_va.cpp | 8
sandbox/local/libs/local/example/nesting.cpp | 7
sandbox/local/libs/local/example/nesting_va.cpp | 7
sandbox/local/libs/local/example/print_map.cpp | 9
29 files changed, 534 insertions(+), 396 deletions(-)
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-05-05 14:09:15 EDT (Thu, 05 May 2011)
@@ -33,7 +33,7 @@
</span>BOOST_IDENTITY_TYPE(parenthesized_type)</pre></div>
<div class="refsect1">
-<a name="id915089"></a><h2>Description</h2>
+<a name="id915526"></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_Topics.html" title="Advanced Topics"> Advanced Topics</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>
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-05-05 14:09:15 EDT (Thu, 05 May 2011)
@@ -33,7 +33,7 @@
</span>BOOST_IDENTITY_VALUE(parenthesized_value)</pre></div>
<div class="refsect1">
-<a name="id915230"></a><h2>Description</h2>
+<a name="id915667"></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_Topics.html" title="Advanced Topics"> Advanced Topics</a> section).</p>
<p>For example <code class="computeroutput">BOOST_IDENTITY_VALUE((key_sizeof<int, double>::value))</code> can be passed as a single macro parameter when instead <code class="computeroutput">key_sizeof<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-05-05 14:09:15 EDT (Thu, 05 May 2011)
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_BLOCK(bindings)</pre></div>
<div class="refsect1">
-<a name="id911189"></a><h2>Description</h2>
+<a name="id911626"></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>
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-05-05 14:09:15 EDT (Thu, 05 May 2011)
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_BLOCK_END</pre></div>
<div class="refsect1">
-<a name="id911927"></a><h2>Description</h2>
+<a name="id912364"></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>Note:</strong></span> This macro cannot be used multiple times on the same line because it internally uses the line number <code class="computeroutput">__LINE__</code> to generate unique identifiers.</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>
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-05-05 14:09:15 EDT (Thu, 05 May 2011)
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_BLOCK_TPL(bindings)</pre></div>
<div class="refsect1">
-<a name="id911853"></a><h2>Description</h2>
+<a name="id912290"></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>
Modified: sandbox/local/libs/local/doc/html/BOOST_LOCAL_CONFIG_COMPLIANT.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_LOCAL_CONFIG_COMPLIANT.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_LOCAL_CONFIG_COMPLIANT.html 2011-05-05 14:09:15 EDT (Thu, 05 May 2011)
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_CONFIG_COMPLIANT</pre></div>
<div class="refsect1">
-<a name="id912094"></a><h2>Description</h2>
+<a name="id912530"></a><h2>Description</h2>
<p>If programmers leave this configuration macro undefined, its default value is to be left not defined.</p>
<p>If this macro is defined, variadic macros and empty macro parameters are not used by this library. Using variadic macros and empty macro parameters allows this library to provide the <span class="emphasis"><em>variadic macro</em></span> and <span class="emphasis"><em>empty macro</em></span> syntaxes which some programmers might find more readable than the <span class="emphasis"><em>sequencing macro</em></span> syntax (see <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_BLOCK.html" title="Macro BOOST_LOCAL_BLOCK">BOOST_LOCAL_BLOCK</a></code>, and <code class="computeroutput"><a class="link" href="BOOST_LOCAL_EXIT.html" title="Macro BOOST_LOCAL_EXIT">BOOST_LOCAL_EXIT</a></code>). If this configuration macro is defined then only the sequencing macro syntax is allowed (regardless of whether the compiler supports variadic and e
mpty macros or not).</p>
<p><span class="bold"><strong>Warning:</strong></span> The variadic and empty macro syntaxes are not supported by all C++ compilers so they should be used with care to avoid portability issues (and this configuration macro can be defined to disable them).</p>
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-05-05 14:09:15 EDT (Thu, 05 May 2011)
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_CONFIG_FUNCTION_ARITY_MAX</pre></div>
<div class="refsect1">
-<a name="id912299"></a><h2>Description</h2>
+<a name="id912736"></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>
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-05-05 14:09:15 EDT (Thu, 05 May 2011)
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_CONFIG_THIS_PARAM_NAME</pre></div>
<div class="refsect1">
-<a name="id912394"></a><h2>Description</h2>
+<a name="id912831"></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_Started.html" title="Getting Started"> Getting Started</a> section. </p>
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-05-05 14:09:15 EDT (Thu, 05 May 2011)
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_EXIT(binding_list)</pre></div>
<div class="refsect1">
-<a name="id912535"></a><h2>Description</h2>
+<a name="id912971"></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>
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-05-05 14:09:15 EDT (Thu, 05 May 2011)
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_EXIT_END</pre></div>
<div class="refsect1">
-<a name="id913286"></a><h2>Description</h2>
+<a name="id913722"></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>Note:</strong></span> This macro cannot be used multiple times on the same line because it internally uses the line number <code class="computeroutput">__LINE__</code> to generate unique identifiers.</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>
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-05-05 14:09:15 EDT (Thu, 05 May 2011)
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_EXIT_TPL(binding_list)</pre></div>
<div class="refsect1">
-<a name="id913212"></a><h2>Description</h2>
+<a name="id913648"></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>
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-05-05 14:09:15 EDT (Thu, 05 May 2011)
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_FUNCTION_NAME(name)</pre></div>
<div class="refsect1">
-<a name="id914410"></a><h2>Description</h2>
+<a name="id914847"></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>The local function name can be prefixed by the "keyword" <code class="computeroutput">inline</code>: </p>
<pre class="programlisting"> <span class="special">...</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="keyword">inline</span> <span class="identifier">name</span><span class="special">)</span>
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-05-05 14:09:15 EDT (Thu, 05 May 2011)
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_FUNCTION_PARAMS(parameters)</pre></div>
<div class="refsect1">
-<a name="id913453"></a><h2>Description</h2>
+<a name="id913889"></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_Topics.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>
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-05-05 14:09:15 EDT (Thu, 05 May 2011)
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_FUNCTION_PARAMS_TPL(parameters)</pre></div>
<div class="refsect1">
-<a name="id914336"></a><h2>Description</h2>
+<a name="id914772"></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>
Modified: sandbox/local/libs/local/doc/html/BOOST_LOCAL_TYPEOF.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_LOCAL_TYPEOF.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_LOCAL_TYPEOF.html 2011-05-05 14:09:15 EDT (Thu, 05 May 2011)
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_TYPEOF(bound_variable_name)</pre></div>
<div class="refsect1">
-<a name="id914761"></a><h2>Description</h2>
+<a name="id915198"></a><h2>Description</h2>
<p>The type is fully qualified in that it contains the extra constant and reference qualifiers when they are specified for binding by constant and by reference. For example, if a variable named <code class="computeroutput">t</code> of type <code class="computeroutput">T</code> is: </p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>Bound by value using <code class="computeroutput">bind t</code> then <code class="computeroutput">BOOST_LOCAL_TYPEOF(t)</code> is <code class="computeroutput">T</code>. </p></li>
Modified: sandbox/local/libs/local/doc/html/boost_local/Advanced_Topics.html
==============================================================================
--- sandbox/local/libs/local/doc/html/boost_local/Advanced_Topics.html (original)
+++ sandbox/local/libs/local/doc/html/boost_local/Advanced_Topics.html 2011-05-05 14:09:15 EDT (Thu, 05 May 2011)
@@ -33,21 +33,21 @@
Local Functions</a></span></dt>
<dt><span class="section"><a href="Advanced_Topics.html#boost_local.Advanced_Topics.deducing_bound_types__concepts__etc_">Deducing
Bound Types (concepts, etc)</a></span></dt>
-<dt><span class="section"><a href="Advanced_Topics.html#boost_local.Advanced_Topics.exception_specifications">Exception
- Specifications</a></span></dt>
<dt><span class="section"><a href="Advanced_Topics.html#boost_local.Advanced_Topics.inlined_local_functions">Inlined
Local Functions</a></span></dt>
<dt><span class="section"><a href="Advanced_Topics.html#boost_local.Advanced_Topics.recursive_local_functions">Recursive
Local Functions</a></span></dt>
<dt><span class="section"><a href="Advanced_Topics.html#boost_local.Advanced_Topics.nested_declarations">Nested
Declarations</a></span></dt>
+<dt><span class="section"><a href="Advanced_Topics.html#boost_local.Advanced_Topics.exception_specifications">Exception
+ Specifications</a></span></dt>
<dt><span class="section"><a href="Advanced_Topics.html#boost_local.Advanced_Topics.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_Topics.html#boost_local.Advanced_Topics.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
+ This section illustrates advanced usages of this library. At the end of this
section there is also a list of knwon limitations of this library.
</p>
<div class="section">
@@ -57,11 +57,9 @@
</h3></div></div></div>
<p>
The C++ preprocessor does not allow commas <code class="computeroutput"><span class="special">,</span></code>
- within macro parameters unless they are wrapped by the round parenthesis
- <code class="computeroutput"><span class="special">()</span></code>. Therefore, using commas
- within the local function parameters and bindings will generate (cryptic)
- preprocessor errors unless they are wrapped within extra round parenthesis
- <code class="computeroutput"><span class="special">()</span></code> as explained here.
+ within macro parameters unless they are wrapped by round parenthesis <code class="computeroutput"><span class="special">()</span></code>. Therefore, using commas within the local
+ function parameters and bindings will generate (cryptic) preprocessor errors
+ unless they are wrapped with an extra set of round parenthesis <code class="computeroutput"><span class="special">()</span></code> as explained here.
</p>
<div class="note"><table border="0" summary="Note">
<tr>
@@ -197,7 +195,23 @@
</table></div>
<p>
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 <code class="computeroutput"><span class="special">()</span></code> are added:
+ to the specified type.
+ </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>
+ The <code class="computeroutput"><a class="link" href="../BOOST_IDENTITY_TYPE.html" title="Macro BOOST_IDENTITY_TYPE">BOOST_IDENTITY_TYPE</a></code>
+ macro must be prefixed by the <code class="computeroutput"><span class="keyword">typename</span></code>
+ keyword when used within templates as in <code class="computeroutput"><span class="keyword">typename</span>
+ <a class="link" href="../BOOST_IDENTITY_TYPE.html" title="Macro BOOST_IDENTITY_TYPE">BOOST_IDENTITY_TYPE</a><span class="special">(</span></code><span class="emphasis"><em>parenthesized-type</em></span><code class="computeroutput"><span class="special">)</span></code>.
+ </p></td></tr>
+</table></div>
+<p>
+ Note that a total of two set of parenthesis <code class="computeroutput"><span class="special">()</span></code>
+ are added:
</p>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
@@ -207,11 +221,72 @@
<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="id883003" href="#ftn.id883003" class="footnote">17</a>]</sup>
+ macro. <sup>[<a name="id883080" href="#ftn.id883080" class="footnote">17</a>]</sup>
</li>
</ol></div>
+<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>
+ Often, there might be better ways to overcome this limitation that lead
+ to code which is more readable than the one using the <code class="computeroutput"><a class="link" href="../BOOST_IDENTITY_TYPE.html" title="Macro BOOST_IDENTITY_TYPE">BOOST_IDENTITY_TYPE</a></code> macro.
+ For example, in this case a <code class="computeroutput"><span class="keyword">typedef</span></code>
+ could have been used to obtain the following valid and perhaps more readable
+ code:
+ </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="keyword">typedef</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">,</span> <span class="identifier">size_t</span><span class="special">></span> <span class="identifier">map_type</span><span class="special">;</span>
+<span class="special">...</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="keyword">const</span> <span class="identifier">map_type</span><span class="special">&</span> <span class="identifier">m</span><span class="special">,</span> <span class="comment">// OK.</span>
+ <span class="special">...</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="keyword">typedef</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">,</span> <span class="identifier">size_t</span><span class="special">></span> <span class="identifier">map_type</span><span class="special">;</span>
+<span class="special">...</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">map_type</span><span class="special">&</span> <span class="identifier">m</span><span class="special">)</span> <span class="comment">// OK.</span>
+ <span class="special">...</span>
+<span class="special">)</span> <span class="special">...</span>
+</pre>
+<p>
+ </p>
+ </td>
+</tr></tbody>
+</table></div>
+</td></tr>
+</table></div>
<p>
- <span class="bold"><strong>(2)</strong></span> The parameter type <code class="computeroutput"><span class="special">::</span><span class="identifier">sign_t</span></code> start with the non-alphanumeric
+ <span class="bold"><strong>(2)</strong></span> The parameter type <code class="computeroutput"><span class="special">::</span><span class="identifier">sign_t</span></code> starts with the non-alphanumeric
symbols <code class="computeroutput"><span class="special">::</span></code> thus it will generate
preprocessor errors if used as a local function parameter type. The macros
<code class="computeroutput"><a class="link" href="../BOOST_IDENTITY_TYPE.html" title="Macro BOOST_IDENTITY_TYPE">BOOST_IDENTITY_TYPE</a></code>
@@ -263,13 +338,19 @@
</td>
</tr></tbody>
</table></div>
+<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>
- Often, there might be better ways to overcome this limitation that lead to
- code which is more readable than the one using the <code class="computeroutput"><a class="link" href="../BOOST_IDENTITY_TYPE.html" title="Macro BOOST_IDENTITY_TYPE">BOOST_IDENTITY_TYPE</a></code>
- macro. For example, in this case the symbols <code class="computeroutput"><span class="special">::</span></code>
- could have been simply dropped to obtain the following valid and more readable
- code:
- </p>
+ Often, there might be better ways to overcome this limitation that lead
+ to code which is more readable than the one using the <code class="computeroutput"><a class="link" href="../BOOST_IDENTITY_TYPE.html" title="Macro BOOST_IDENTITY_TYPE">BOOST_IDENTITY_TYPE</a></code> macro.
+ For example, in this case the symbols <code class="computeroutput"><span class="special">::</span></code>
+ could have been simply dropped to obtain the following valid and perhaps
+ more readable code:
+ </p>
<div class="informaltable"><table class="table">
<colgroup>
<col>
@@ -277,20 +358,20 @@
</colgroup>
<thead><tr>
<th>
- <p>
- Variadic Macro Syntax (C99 and later compilers)
- </p>
- </th>
-<th>
- <p>
- Sequencing Macro Syntax (all C++ compilers)
- </p>
- </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>
+
</p>
<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="special">...</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>
@@ -299,11 +380,11 @@
<span class="special">)</span> <span class="special">...</span>
</pre>
<p>
- </p>
- </td>
+ </p>
+ </td>
<td>
- <p>
-
+ <p>
+
</p>
<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="special">...</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>
@@ -312,10 +393,12 @@
<span class="special">)</span> <span class="special">...</span>
</pre>
<p>
- </p>
- </td>
+ </p>
+ </td>
</tr></tbody>
</table></div>
+</td></tr>
+</table></div>
<p>
<span class="bold"><strong>(3)</strong></span> The default parameter value <code class="computeroutput"><span class="identifier">key_size</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">,</span> <span class="identifier">size_t</span><span class="special">>::</span><span class="identifier">value</span></code>
contains a comma <code class="computeroutput"><span class="special">,</span></code> after the
@@ -381,9 +464,9 @@
<tr><td align="left" valign="top"><p>
Alternatively, the macro <code class="computeroutput"><a class="link" href="../BOOST_IDENTITY_VALUE.html" title="Macro BOOST_IDENTITY_VALUE">BOOST_IDENTITY_VALUE</a><span class="special">(</span></code><span class="emphasis"><em>parenthesized-value</em></span><code class="computeroutput"><span class="special">)</span></code> 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
- <code class="computeroutput"><span class="special">()</span></code>. Note that, similarly to
- <code class="computeroutput"><a class="link" href="../BOOST_IDENTITY_TYPE.html" title="Macro BOOST_IDENTITY_TYPE">BOOST_IDENTITY_TYPE</a></code>,
+ value (but it adds run-time overhead compared with simply using the extra
+ parenthesis <code class="computeroutput"><span class="special">()</span></code>). Note that,
+ similarly to <code class="computeroutput"><a class="link" href="../BOOST_IDENTITY_TYPE.html" title="Macro BOOST_IDENTITY_TYPE">BOOST_IDENTITY_TYPE</a></code>,
the <code class="computeroutput"><a class="link" href="../BOOST_IDENTITY_VALUE.html" title="Macro BOOST_IDENTITY_VALUE">BOOST_IDENTITY_VALUE</a></code>
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
@@ -396,19 +479,8 @@
the parenthesis <code class="computeroutput"><span class="special">()</span></code> of the function
call <code class="computeroutput"><span class="identifier">cat</span><span class="special">(...)</span></code>.
</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>
- The <code class="computeroutput"><a class="link" href="../BOOST_IDENTITY_TYPE.html" title="Macro BOOST_IDENTITY_TYPE">BOOST_IDENTITY_TYPE</a></code>
- macro must be prefixed by the <code class="computeroutput"><span class="keyword">typename</span></code>
- keyword when used within templates.
- </p></td></tr>
-</table></div>
<p>
- Consider the following complete example: <sup>[<a name="id884308" href="#ftn.id884308" class="footnote">18</a>]</sup>
+ Consider the following complete example:
</p>
<div class="informaltable"><table class="table">
<colgroup>
@@ -481,11 +553,8 @@
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">string</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">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">K</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span> <span class="keyword">struct</span> <span class="identifier">key_sizeof</span> <span class="special">{</span>
- <span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">size_t</span> <span class="identifier">value</span><span class="special">;</span>
-<span class="special">};</span>
-<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">K</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span> <span class="keyword">const</span> <span class="identifier">size_t</span> <span class="identifier">key_sizeof</span><span class="special"><</span><span class="identifier">K</span><span class="special">,</span> <span class="identifier">T</span><span class="special">>::</span><span class="identifier">value</span> <span class="special">=</span>
- <span class="keyword">sizeof</span><span class="special">(</span><span class="identifier">K</span><span class="special">);</span>
+<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">K</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span> <span class="keyword">struct</span> <span class="identifier">key_size</span> <span class="special">{</span> <span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">size_t</span> <span class="identifier">value</span><span class="special">;</span> <span class="special">};</span>
+<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">K</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span> <span class="keyword">const</span> <span class="identifier">size_t</span> <span class="identifier">key_size</span><span class="special"><</span><span class="identifier">K</span><span class="special">,</span> <span class="identifier">T</span><span class="special">>::</span><span class="identifier">value</span> <span class="special">=</span> <span class="keyword">sizeof</span><span class="special">(</span><span class="identifier">K</span><span class="special">);</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">cat</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&</span> <span class="identifier">a</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&</span> <span class="identifier">b</span><span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">a</span> <span class="special">+</span> <span class="identifier">b</span><span class="special">;</span> <span class="special">}</span>
@@ -498,7 +567,7 @@
<span class="comment">// Also, identity macros handle leading symbols.</span>
<span class="special">(</span><span class="identifier">BOOST_IDENTITY_TYPE</span><span class="special">((::</span><span class="identifier">sign_t</span><span class="special">))</span> <span class="identifier">sign</span><span class="special">)(</span><span class="keyword">default</span> <span class="special">-</span><span class="number">1</span><span class="special">)</span>
<span class="special">(</span><span class="keyword">const</span> <span class="identifier">size_t</span><span class="special">&</span> <span class="identifier">factor</span><span class="special">)(</span><span class="keyword">default</span> <span class="comment">// Or use `BOOST_IDENTITY_VALUE`.</span>
- <span class="special">(</span><span class="identifier">key_sizeof</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">,</span> <span class="identifier">size_t</span><span class="special">>::</span><span class="identifier">value</span><span class="special">))</span>
+ <span class="special">(</span><span class="identifier">key_size</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">,</span> <span class="identifier">size_t</span><span class="special">>::</span><span class="identifier">value</span><span class="special">))</span>
<span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&</span> <span class="identifier">separator</span><span class="special">)(</span><span class="keyword">default</span> <span class="identifier">cat</span><span class="special">(</span><span class="string">":"</span><span class="special">,</span> <span class="string">" "</span><span class="special">))</span> <span class="special">)</span> <span class="special">{</span>
<span class="keyword">for</span> <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">,</span> <span class="identifier">size_t</span><span class="special">>::</span><span class="identifier">const_iterator</span> <span class="identifier">i</span> <span class="special">=</span> <span class="identifier">m</span><span class="special">.</span><span class="identifier">begin</span><span class="special">();</span>
<span class="identifier">i</span> <span class="special">!=</span> <span class="identifier">m</span><span class="special">.</span><span class="identifier">end</span><span class="special">();</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span> <span class="special">{</span>
@@ -771,18 +840,9 @@
Bound Types (concepts, etc)</a>
</h3></div></div></div>
<p>
- 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 polymorphic
- in the type of the bound variables (like a template is polymorphic in the
- type of its template parameters).
- </p>
-<p>
- 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:
+ This library never requires to explicitly specify the type of the bound variables.
+ From within local functions, local blocks, and local exits, programmers can
+ access the type of the bound variables using the following macro:
</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">typeof</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
@@ -792,7 +852,7 @@
</pre>
<p>
This macro expands to a type expression that evaluates (at compile-time)
- to the fully qualified type of the specified bound variable.
+ to the fully qualified type of the bound variable with the specified name.
</p>
<div class="note"><table border="0" summary="Note">
<tr>
@@ -805,7 +865,7 @@
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).
+ metafunctions, see Boost.TypeTraits).
</p></td></tr>
</table></div>
<p>
@@ -1095,182 +1155,47 @@
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
-<a name="boost_local.Advanced_Topics.exception_specifications"></a><a class="link" href="Advanced_Topics.html#boost_local.Advanced_Topics.exception_specifications" title="Exception Specifications">Exception
- Specifications</a>
-</h3></div></div></div>
-<p>
- 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++.
- </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>
- 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 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="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="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="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="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="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">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>
-</tr></tbody>
-</table></div>
-</div>
-<div class="section">
-<div class="titlepage"><div><div><h3 class="title">
<a name="boost_local.Advanced_Topics.inlined_local_functions"></a><a class="link" href="Advanced_Topics.html#boost_local.Advanced_Topics.inlined_local_functions" title="Inlined Local Functions">Inlined
Local Functions</a>
</h3></div></div></div>
<p>
- A local function can be declared inlined to increase the chances that the
+ Local functions can be declared inlined to increase the chances that the
compiler will be able to reduce the local function call run-time by inlining
- code. A local function is declared inlined by prefixing the local function
- name specified to <code class="computeroutput"><a class="link" href="../BOOST_LOCAL_FUNCTION_NAME.html" title="Macro BOOST_LOCAL_FUNCTION_NAME">BOOST_LOCAL_FUNCTION_NAME</a></code>
- with the "keyword" <code class="computeroutput"><span class="keyword">inline</span></code>:
+ the generated assembly code. A local function is declared inlined by prefixing
+ the local function name passed to 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 with the "keyword" <code class="computeroutput"><span class="keyword">inline</span></code>:
</p>
<pre class="programlisting"><span class="special">...</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="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="keyword">inline</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">inline</span> <span class="emphasis"><em>name</em></span><span class="special">)</span>
</pre>
+<p>
+ On ISO C++ compliant compilers (see <code class="computeroutput"><a class="link" href="../BOOST_LOCAL_CONFIG_COMPLIANT.html" title="Macro BOOST_LOCAL_CONFIG_COMPLIANT">BOOST_LOCAL_CONFIG_COMPLIANT</a></code>),
+ inlined local functions always have a run-time comparable to their equivalent
+ implementation that uses local functors (see the <a class="link" href="Alternatives.html" title="Appendix: Alternatives">Alternatives</a>
+ section). However, inlined local functions have the limitation that they
+ cannot be assigned to other functors (like <code class="computeroutput">boost::function</code>)
+ and they cannot be passed as template parameters. <sup>[<a name="id900110" href="#ftn.id900110" class="footnote">18</a>]</sup> On C++0x compilers, <code class="computeroutput"><span class="keyword">inline</span></code>
+ has no effect because this library will automatically generate code that
+ uses C++0x specific features to inline the local function calls whenever
+ possible even if the local function is not declared inlined. Furthermore,
+ non C++0x local functions can always be passes as template parameters even
+ when they are declared inlined.
+ </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>
- On ISO C++ compliant compilers (see <code class="computeroutput"><a class="link" href="../BOOST_LOCAL_CONFIG_COMPLIANT.html" title="Macro BOOST_LOCAL_CONFIG_COMPLIANT">BOOST_LOCAL_CONFIG_COMPLIANT</a></code>),
- inlined local functions always have a run-time comparable to their equivalent
- implementations that use local functor classes (see the <a class="link" href="Alternatives.html" title="Appendix: Alternatives">Alternatives</a>
- section). However, inlined local functions have the limitation that they
- cannot be assigned to other functors (like <code class="computeroutput">boost::function</code>)
- and they cannot be passed as template parameters <sup>[<a name="id902028" href="#ftn.id902028" class="footnote">19</a>]</sup>.
- </p>
-<p>
- On C++0x compilers, <code class="computeroutput"><span class="keyword">inline</span></code>
- has no effect because this library will automatically generate code that
- uses C++0x specific features to inline the local function calls whenever
- possible even if the local function is not declared inlined.
- </p>
-</td></tr>
+<tr><td align="left" valign="top"><p>
+ It is recommended to not declare a local function inlined unless it is
+ strictly necessary for optimizing pure ISO C++ compliant code (because
+ in all other cases this library will automatically take advantage of C++0x
+ features to optimize the local function calls while always allowing to
+ pass the local function as a template parameter).
+ </p></td></tr>
</table></div>
<p>
- It is recommended to not declare a local function inlined unless it is strictly
- necessary for optimizing pure ISO C++ compliant code (because in all other
- cases this library will automatically take advantage of C++0x features to
- optimize the local function calls while always allowing to pass the local
- function as a template parameter).
- </p>
-<p>
For example, the following local function is declared inlined (thus a for-loop
needs to be used for portability instead of passing the local function as
a template parameter to the <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">for_each</span></code>
@@ -1310,18 +1235,18 @@
<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="special">{</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="keyword">inline</span> <span class="identifier">add</span><span class="special">)</span> <span class="comment">// inlined local function</span>
+ <span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="keyword">inline</span> <span class="identifier">add</span><span class="special">)</span> <span class="comment">// Specified inlined.</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">double</span><span class="special">></span> <span class="identifier">v</span><span class="special">(</span><span class="number">1000000</span><span class="special">);</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">fill</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="number">1.0</span><span class="special">);</span>
- <span class="comment">// On some ISO C++ compilers (e.g., GCC 4.3) inlined local functions are</span>
+ <span class="comment">// On some ISO C++ compilers (e.g., GCC 4.3.4) inlined local functions are</span>
<span class="comment">// more likely to be optimized for faster run-times. However, inlined local</span>
<span class="comment">// functions cannot be passed at template parameters (i.e., `std::for_each`</span>
<span class="comment">// cannot be used here).</span>
- <span class="comment">// On C++0x compilers (e.g., MSVC 8.0 or GCC 4.5) linining has no effect</span>
+ <span class="comment">// On C++0x compilers (e.g., MSVC 8.0 or GCC 4.5.1) linining has no effect</span>
<span class="comment">// because the local function can always be optimized even if not</span>
- <span class="comment">// explicitly specified inline and inlined local functions can be always be</span>
+ <span class="comment">// explicitly specified inline and inlined local functions can always be</span>
<span class="comment">// passed as template parameters.</span>
<span class="keyword">for</span> <span class="special">(</span><span class="identifier">size_t</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">size</span><span class="special">();</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span> <span class="special">{</span> <span class="comment">// Can't use for_each (portably).</span>
<span class="identifier">add</span><span class="special">(</span><span class="identifier">v</span><span class="special">[</span><span class="identifier">i</span><span class="special">]);</span>
@@ -1350,18 +1275,18 @@
<span class="keyword">void</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">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="keyword">inline</span> <span class="identifier">add</span><span class="special">)</span> <span class="comment">// inlined local function</span>
+ <span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="keyword">inline</span> <span class="identifier">add</span><span class="special">)</span> <span class="comment">// Specified inlined.</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">double</span><span class="special">></span> <span class="identifier">v</span><span class="special">(</span><span class="number">1000000</span><span class="special">);</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">fill</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="number">1.0</span><span class="special">);</span>
- <span class="comment">// On some ISO C++ compilers (e.g., GCC 4.3) inlined local functions are</span>
+ <span class="comment">// On some ISO C++ compilers (e.g., GCC 4.3.4) inlined local functions are</span>
<span class="comment">// more likely to be optimized for faster run-times. However, inlined local</span>
<span class="comment">// functions cannot be passed at template parameters (i.e., `std::for_each`</span>
<span class="comment">// cannot be used here).</span>
- <span class="comment">// On C++0x compilers (e.g., MSVC 8.0 and GCC 4.5) linining has no effect</span>
+ <span class="comment">// On C++0x compilers (e.g., MSVC 8.0 and GCC 4.5.1) linining has no effect</span>
<span class="comment">// because the local function can always be optimized even if not</span>
- <span class="comment">// explicitly specified inline and inlined local functions can be always be</span>
+ <span class="comment">// explicitly specified inline and inlined local functions can always be</span>
<span class="comment">// passed as template parameters.</span>
<span class="keyword">for</span> <span class="special">(</span><span class="identifier">size_t</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">size</span><span class="special">();</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span> <span class="special">{</span> <span class="comment">// Can't use for_each (portably).</span>
<span class="identifier">add</span><span class="special">(</span><span class="identifier">v</span><span class="special">[</span><span class="identifier">i</span><span class="special">]);</span>
@@ -1383,18 +1308,19 @@
Local Functions</a>
</h3></div></div></div>
<p>
- A local function can be declared recursive so it can recursively call itself
- from its body (as usual with C++ functions). A local function is declared
- recursive by prefixing the local function name specified to <code class="computeroutput"><a class="link" href="../BOOST_LOCAL_FUNCTION_NAME.html" title="Macro BOOST_LOCAL_FUNCTION_NAME">BOOST_LOCAL_FUNCTION_NAME</a></code>
- with the "keyword" <code class="computeroutput"><span class="identifier">recursive</span></code>:
+ Local functions can be declared recursive
+ so a local function can recursively call itself from its body (as usual with
+ C++ functions). A local function is declared recursive by prefixing the local
+ function name passed to <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 with the "keyword" <code class="computeroutput"><span class="identifier">recursive</span></code>:
</p>
<pre class="programlisting"><span class="special">...</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="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">recursive</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">recursive</span> <span class="emphasis"><em>name</em></span><span class="special">)</span>
</pre>
<p>
For example, the following local function is used to recursively calculate
- and print the factorial of the specified numbers:
+ and print the factorials of all the numbers in the specified vector:
</p>
<div class="informaltable"><table class="table">
<colgroup>
@@ -1562,17 +1488,22 @@
<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="identifier">x</span><span class="special">--;</span>
+ <span class="identifier">m</span><span class="special">();</span> <span class="comment">// Nested local function call.</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>
@@ -1605,17 +1536,22 @@
<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="identifier">x</span><span class="special">--;</span>
+ <span class="identifier">m</span><span class="special">();</span> <span class="comment">// Nested local function call.</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>
@@ -1632,18 +1568,150 @@
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_local.Advanced_Topics.exception_specifications"></a><a class="link" href="Advanced_Topics.html#boost_local.Advanced_Topics.exception_specifications" title="Exception Specifications">Exception
+ Specifications</a>
+</h3></div></div></div>
+<p>
+ 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.
+ </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>
+ 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>
+ 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 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="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="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="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="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="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">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>
+</tr></tbody>
+</table></div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
<a name="boost_local.Advanced_Topics.storage_classifiers___auto__and__register__"></a><a class="link" href="Advanced_Topics.html#boost_local.Advanced_Topics.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>
- 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:
+ Local function parameters support the storage classifiers as usual in ISO
+ C++. The <code class="computeroutput"><span class="keyword">auto</span></code> storage classifier
+ is specified as: <sup>[<a name="id908921" href="#ftn.id908921" class="footnote">19</a>]</sup>
</p>
<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
+ 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>
@@ -1718,8 +1786,8 @@
(overloading, operators, etc)</a>
</h3></div></div></div>
<p>
- The following table summarizes all the usual C++ function features that are
- not supported for local functions.
+ The following table summarizes all C++ function features indicating those
+ features that are not supported by this library for local functions.
</p>
<div class="informaltable"><table class="table">
<colgroup>
@@ -1777,8 +1845,7 @@
<td>
<p>
This is not supported because local functions are implemented using
- local classes and ISO C++ local classes cannot be templates (see
- [2657]).
+ local classes and ISO C++ local classes cannot be templates.
</p>
</td>
</tr>
@@ -1814,7 +1881,7 @@
<p>
Local functions can be specified <code class="computeroutput"><span class="keyword">inline</span></code>
to improve the chances that ISO C++ standard compilers can optimize
- their run-time (but <code class="computeroutput"><span class="keyword">inline</span></code>
+ the local function call run-time (but <code class="computeroutput"><span class="keyword">inline</span></code>
local functions cannot be passes as template parameters on ISO
C++ standard compilers).
</p>
@@ -1869,7 +1936,7 @@
<td>
<p>
This is not supported because local functions are not member functions.
- <sup>[<a name="id909687" href="#ftn.id909687" class="footnote">a</a>]</sup>
+ <sup>[<a name="id910174" href="#ftn.id910174" class="footnote">a</a>]</sup>
</p>
</td>
</tr>
@@ -1968,14 +2035,11 @@
</td>
</tr>
</tbody>
-<tbody class="footnotes"><tr><td colspan="3"><div class="footnote"><p><sup>[<a id="ftn.id909687" href="#id909687" class="para">a</a>] </sup>
+<tbody class="footnotes"><tr><td colspan="3"><div class="footnote"><p><sup>[<a id="ftn.id910174" href="#id910174" class="para">a</a>] </sup>
<span class="bold"><strong>Rationale.</strong></span> 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 <code class="computeroutput"><span class="special">...</span>
- <span class="special">(</span><span class="identifier">extends</span><span class="special">)(</span></code><span class="emphasis"><em>base</em></span><code class="computeroutput"><span class="special">)</span></code>). However, this "inheritance"
- feature is not implemented because it seems of <a href="http://lists.boost.org/Archives/boost/2010/09/170895.php" target="_top">no
+ local functor class. However, this "inheritance" feature
+ is not implemented because it seems of <a href="http://lists.boost.org/Archives/boost/2010/09/170895.php" target="_top">no
use</a> 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.
@@ -1989,7 +2053,7 @@
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="id910067" href="#ftn.id910067" class="footnote">20</a>]</sup>
+ parameters). <sup>[<a name="id910511" href="#ftn.id910511" class="footnote">20</a>]</sup>
</p>
<p>
For example, the following code will <span class="bold"><strong>not</strong></span>
@@ -2013,7 +2077,7 @@
</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="id910417" href="#ftn.id910417" class="footnote">21</a>]</sup>
+ will generate a compile-time error. <sup>[<a name="id910853" href="#ftn.id910853" class="footnote">21</a>]</sup>
</p>
<p>
For example, the following code will <span class="bold"><strong>not</strong></span>
@@ -2067,43 +2131,43 @@
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.id883003" href="#id883003" class="para">17</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id883080" href="#id883080" class="para">17</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.id884308" href="#id884308" class="para">18</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
- do not contain unwrapped commas <code class="computeroutput"><span class="special">,</span></code>
- (unless template metaprogramming is being used) so this is usually not
- a problem.
+<div class="footnote"><p><sup>[<a id="ftn.id900110" href="#id900110" class="para">18</a>] </sup>
+ <span class="bold"><strong>Rationale.</strong></span> This library uses an indirect
+ function call via a function pointer in order to pass the local function
+ as a template parameter (see the <a class="link" href="Implementation.html" title="Appendix: Implementation">Implementation</a>
+ section). No compiler has yet been observed to be able to inline function
+ calls when they use such indirect function pointer calls. Therefore, inlined
+ local functions do not use such indirect function pointer call (so they
+ are more likely to be optimized) but because of that they cannot be passed
+ as template parameters. The indirect function pointer call is needed on
+ ISO C++ but it is not needed on C++0x (see [2657])
+ thus this library automatically generates local function calls that can
+ be inlined on C++0x compilers (even when the local function is not declared
+ inlined).
+ </p></div>
+<div class="footnote"><p><sup>[<a id="ftn.id908921" href="#id908921" class="para">19</a>] </sup>
+ The <code class="computeroutput"><span class="keyword">auto</span></code> storage classifier
+ is part of the ISO C++ standard and therefore supported by this library.
+ However, the meaning and usage of the <code class="computeroutput"><span class="keyword">auto</span></code>
+ keyword changed in C++0x. Therefore, use the <code class="computeroutput"><span class="keyword">auto</span></code>
+ storage classifier with the usual care in order to avoid writing ISO C++
+ code that might not work on C++0x.
</p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id902028" href="#id902028" class="para">19</a>] </sup>
- <span class="bold"><strong>Rationale.</strong></span> This library uses an indirect
- function call via a function pointer in order to pass the local function
- as a template parameter (see the <a class="link" href="Implementation.html" title="Appendix: Implementation">Implementation</a>
- section). No compiler has been observed to be able to inline function
- calls when they use such indirect function pointer calls. Therefore,
- inlined local functions do not use such indirect function pointer call
- (so they can be optimized) but because of that they cannot be passes
- as template parameters. The indirect function pointer call is needed
- for ISO C++ but it is not needed for C++0x (see [2657])
- thus this library automatically generates local function calls that can
- be inlined on C++0x compilers (even when the local function is not declared
- inlined).
- </p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id910067" href="#id910067" class="para">20</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id910511" href="#id910511" class="para">20</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++.
+ is a functor 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.id910417" href="#id910417" class="para">21</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id910853" href="#id910853" class="para">21</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/Alternatives.html
==============================================================================
--- sandbox/local/libs/local/doc/html/boost_local/Alternatives.html (original)
+++ sandbox/local/libs/local/doc/html/boost_local/Alternatives.html 2011-05-05 14:09:15 EDT (Thu, 05 May 2011)
@@ -298,6 +298,44 @@
</p>
</td>
</tr>
+<tr>
+<td>
+ <p>
+ <span class="emphasis"><em>Polymorphic
+ in the unbound parameter types</em></span>
+ </p>
+ </td>
+<td>
+ <p>
+ No (local functions cannot be function templates).
+ </p>
+ </td>
+<td>
+ <p>
+ No (local classes cannot have member function templates).
+ </p>
+ </td>
+<td>
+ <p>
+ Yes.
+ </p>
+ </td>
+<td>
+ <p>
+ No (C++0x lambdas cannot be function templates).
+ </p>
+ </td>
+<td>
+ <p>
+ Yes.
+ </p>
+ </td>
+<td>
+ <p>
+ Yes.
+ </p>
+ </td>
+</tr>
</tbody>
</table></div>
<a name="boost_local.Alternatives.local_functions.examples"></a><h6>
Modified: sandbox/local/libs/local/doc/html/boost_local/Release_Notes.html
==============================================================================
--- sandbox/local/libs/local/doc/html/boost_local/Release_Notes.html (original)
+++ sandbox/local/libs/local/doc/html/boost_local/Release_Notes.html 2011-05-05 14:09:15 EDT (Thu, 05 May 2011)
@@ -70,10 +70,6 @@
</h3></div></div></div>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
- Remove all references (docs, doxy, examples, etc) to local::function.
- Make local::function local::aux::function and use boost::function instead.
- </li>
-<li class="listitem">
Verify compilation and run-times on all compilers one last time.
</li>
<li class="listitem">
@@ -82,6 +78,9 @@
<li class="listitem">
Finalize Acknowledge section.
</li>
+<li class="listitem">
+ Apply copyright to all files.
+ </li>
</ol></div>
</div>
</div>
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-05-05 14:09:15 EDT (Thu, 05 May 2011)
@@ -36,7 +36,7 @@
<dt><span class="section">Templates</span></dt>
</dl></div>
<p>
- This section illustrates basic usage of local functions, local blocks, and
+ This section illustrates basic usages of local functions, local blocks, and
local exits.
</p>
<div class="section">
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-05-05 14:09:15 EDT (Thu, 05 May 2011)
@@ -426,7 +426,7 @@
</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: May 05, 2011 at 03:09:14 GMT</small></p></td>
+<td align="left"><p><small>Last revised: May 05, 2011 at 18:06:40 GMT</small></p></td>
<td align="right"><div class="copyright-footer"></div></td>
</tr></table>
<hr>
Modified: sandbox/local/libs/local/doc/qbk/advanced_topics.qbk
==============================================================================
--- sandbox/local/libs/local/doc/qbk/advanced_topics.qbk (original)
+++ sandbox/local/libs/local/doc/qbk/advanced_topics.qbk 2011-05-05 14:09:15 EDT (Thu, 05 May 2011)
@@ -6,13 +6,13 @@
[section:Advanced_Topics Advanced Topics]
-This section illustrates advanced usage of this library.
+This section illustrates advanced usages 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.
+The C++ preprocessor does not allow commas `,` within macro parameters unless they are wrapped by round parenthesis `()`.
+Therefore, using commas within the local function parameters and bindings will generate (cryptic) preprocessor errors unless they are wrapped with an extra set of round parenthesis `()` as explained here.
[note
Macro parameters with commas which are already wrapped by round parenthesis `()` are fine (function calls, etc).
@@ -71,6 +71,11 @@
]
This macro expands to an expression that evaluates (at compile-time) exactly to the specified type.
+
+[important
+The `__BOOST_IDENTITY_TYPE__` macro must be prefixed by the `typename` keyword when used within templates as in `typename __BOOST_IDENTITY_TYPE__(`/parenthesized-type/`)`.
+]
+
Note that a total of two set of parenthesis `()` are added:
# Parenthesis to invoke the `__BOOST_IDENTITY_TYPE__` macro.
@@ -81,7 +86,29 @@
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.
+[note
+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 a `typedef` could have been used to obtain the following valid and perhaps more readable code:
+
+[table
+[ [__Variadic_Macro_Syntax__] [__Sequencing_Macro_Syntax__] ]
+[ [``
+ typedef std::map<std::string, size_t> map_type;
+ ... __BOOST_LOCAL_FUNCTION_PARAMS__(
+ const map_type& m, // OK.
+ ...
+ ) ...
+``] [``
+ typedef std::map<std::string, size_t> map_type;
+ ... __BOOST_LOCAL_FUNCTION_PARAMS__(
+ (const map_type& m) // OK.
+ ...
+ ) ...
+``] ]
+]
+]
+
+[*(2)] The parameter type `::sign_t` starts 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
@@ -101,8 +128,9 @@
``] ]
]
+[note
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:
+For example, in this case the symbols `::` could have been simply dropped to obtain the following valid and perhaps more readable code:
[table
[ [__Variadic_Macro_Syntax__] [__Sequencing_Macro_Syntax__] ]
@@ -120,6 +148,7 @@
) ...
``] ]
]
+]
[*(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.
@@ -147,21 +176,13 @@
[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 `()`.
+This macro expands to an expression that evaluates (at run-time) exactly to the specified value (but it adds run-time 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__] [__Sequencing_Macro_Syntax__] ]
@@ -197,10 +218,8 @@
[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).
-
-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:
+This library never requires to explicitly specify the type of the bound variables.
+From within local functions, local blocks, and local exits, programmers can access the type of the bound variables using the following macro:
#include <boost/local/typeof.hpp>
@@ -208,10 +227,10 @@
__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 macro expands to a type expression that evaluates (at compile-time) to the fully qualified type of the bound variable with the specified name.
[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).
+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, see __Boost_TypeTraits__).
]
The deduced bound type can be used within the body to declare a local variable, to check concepts, etc.
@@ -231,50 +250,30 @@
[endsect]
-
-[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++.
-
-[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).
-]
-
-For example:
-
-[table
-[ [__Variadic_Macro_Syntax__] [__Sequencing_Macro_Syntax__] ]
-[ [ [add_except_va_cpp] ] [ [add_except_cpp] ] ]
-]
-
-[endsect]
-
[section Inlined Local Functions]
-A local function can be declared inlined to increase the chances that the compiler will be able to reduce the local function call run-time by inlining code.
-A local function is declared inlined by prefixing the local function name specified to `__BOOST_LOCAL_FUNCTION_NAME__` with the "keyword" `inline`:
+Local functions can be declared inlined to increase the chances that the compiler will be able to reduce the local function call run-time by inlining the generated assembly code.
+A local function is declared inlined by prefixing the local function name passed to the `__BOOST_LOCAL_FUNCTION_NAME__` macro with the "keyword" `inline`:
... __BOOST_LOCAL_FUNCTION_PARAMS__( ... ) {
...
- } __BOOST_LOCAL_FUNCTION_NAME__(inline ...)
+ } __BOOST_LOCAL_FUNCTION_NAME__(inline ``/name/``)
-[important
-On ISO C++ compliant compilers (see __BOOST_LOCAL_CONFIG_COMPLIANT__), inlined local functions always have a run-time comparable to their equivalent implementations that use local functor classes (see the __Alternatives__ section).
-However, inlined local functions have the limitation that they cannot be assigned to other functors (like `__boost__function__`) and they cannot be passed as template parameters
+On ISO C++ compliant compilers (see __BOOST_LOCAL_CONFIG_COMPLIANT__), inlined local functions always have a run-time comparable to their equivalent implementation that uses local functors (see the __Alternatives__ section).
+However, inlined local functions have the limitation that they cannot be assigned to other functors (like `__boost__function__`) and they cannot be passed as template parameters.
[footnote
*Rationale.*
This library uses an indirect function call via a function pointer in order to pass the local function as a template parameter (see the __Implementation__ section).
-No compiler has been observed to be able to inline function calls when they use such indirect function pointer calls.
-Therefore, inlined local functions do not use such indirect function pointer call (so they can be optimized) but because of that they cannot be passes as template parameters.
-The indirect function pointer call is needed for ISO C++ but it is not needed for C++0x (see __N2657__) thus this library automatically generates local function calls that can be inlined on C++0x compilers (even when the local function is not declared inlined).
-].
-
-On C++0x compilers, `inline` has no effect because this library will automatically generate code that uses C++0x specific features to inline the local function calls whenever possible even if the local function is not declared inlined.
+No compiler has yet been observed to be able to inline function calls when they use such indirect function pointer calls.
+Therefore, inlined local functions do not use such indirect function pointer call (so they are more likely to be optimized) but because of that they cannot be passed as template parameters.
+The indirect function pointer call is needed on ISO C++ but it is not needed on C++0x (see __N2657__) thus this library automatically generates local function calls that can be inlined on C++0x compilers (even when the local function is not declared inlined).
]
+On C++0x compilers, `inline` has no effect because this library will automatically generate code that uses C++0x specific features to inline the local function calls whenever possible even if the local function is not declared inlined.
+Furthermore, non C++0x local functions can always be passes as template parameters even when they are declared inlined.
+[important
It is recommended to not declare a local function inlined unless it is strictly necessary for optimizing pure ISO C++ compliant code (because in all other cases this library will automatically take advantage of C++0x features to optimize the local function calls while always allowing to pass the local function as a template parameter).
+]
For example, the following local function is declared inlined (thus a for-loop needs to be used for portability instead of passing the local function as a template parameter to the `std::for_each` algorithm):
@@ -287,14 +286,14 @@
[section Recursive Local Functions]
-A local function can be declared recursive so it can recursively call itself from its body (as usual with C++ functions).
-A local function is declared recursive by prefixing the local function name specified to `__BOOST_LOCAL_FUNCTION_NAME__` with the "keyword" `recursive`:
+Local functions can be declared [@http://en.wikipedia.org/wiki/Recursion_(computer_science)#Recursive_procedures recursive] so a local function can recursively call itself from its body (as usual with C++ functions).
+A local function is declared recursive by prefixing the local function name passed to `__BOOST_LOCAL_FUNCTION_NAME__` macro with the "keyword" `recursive`:
... __BOOST_LOCAL_FUNCTION_PARAMS__( ... ) {
...
- } __BOOST_LOCAL_FUNCTION_NAME__(recursive ...)
+ } __BOOST_LOCAL_FUNCTION_NAME__(recursive ``/name/``)
-For example, the following local function is used to recursively calculate and print the factorial of the specified numbers:
+For example, the following local function is used to recursively calculate and print the factorials of all the numbers in the specified vector:
[table
[ [__Variadic_Macro_Syntax__] [__Sequencing_Macro_Syntax__] ]
@@ -318,14 +317,38 @@
[endsect]
+[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.
+
+[important
+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).
+]
+
+For example:
+
+[table
+[ [__Variadic_Macro_Syntax__] [__Sequencing_Macro_Syntax__] ]
+[ [ [add_except_va_cpp] ] [ [add_except_cpp] ] ]
+]
+
+[endsect]
+
[section Storage Classifiers (`auto` and `register`)]
-Local function parameters support the storage classifiers as usual in C++.
+Local function parameters support the storage classifiers as usual in ISO C++.
The `auto` storage classifier is specified as:
+[footnote
+The `auto` storage classifier is part of the ISO C++ standard and therefore supported by this library.
+However, the meaning and usage of the `auto` keyword changed in C++0x.
+Therefore, use the `auto` storage classifier with the usual care in order to avoid writing ISO C++ code that might not work on C++0x.
+]
auto ``/parameter-type parameter-name/``
-and the `register` storage classifier is specified as:
+The `register` storage classifier is specified as:
register ``/parameter-type parameter-name/``
@@ -340,7 +363,7 @@
[section Limitations (overloading, operators, etc)]
-The following table summarizes all the usual C++ function features that are not supported for local functions.
+The following table summarizes all C++ function features indicating those features that are not supported by this library for local functions.
[table
[
@@ -356,7 +379,7 @@
[
[ `template<`/template-parameter-list/`>` ]
[ No ]
- [ This is not supported because local functions are implemented using local classes and ISO C++ local classes cannot be templates (see __N2657__). ]
+ [ This is not supported because local functions are implemented using local classes and ISO C++ local classes cannot be templates. ]
]
[
[ `explicit` ]
@@ -366,7 +389,7 @@
[
[ `inline` ]
[ Yes ]
- [ Local functions can be specified `inline` to improve the chances that ISO C++ standard compilers can optimize their run-time (but `inline` local functions cannot be passes as template parameters on ISO C++ standard compilers). ]
+ [ Local functions can be specified `inline` to improve the chances that ISO C++ standard compilers can optimize the local function call run-time (but `inline` local functions cannot be passes as template parameters on ISO C++ standard compilers). ]
]
[
[ `extern` ]
@@ -385,7 +408,6 @@
[footnote
*Rationale.*
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.
]
]
@@ -423,7 +445,7 @@
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.
+This is because a local function is a functor 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++.
]
@@ -447,7 +469,7 @@
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.
+This is the because a local function name must be a valid local variable name (the local variable to hold the local functor) and operators cannot be used as local variable names.
]
For example, the following code will *not* compile:
Modified: sandbox/local/libs/local/doc/qbk/alternatives.qbk
==============================================================================
--- sandbox/local/libs/local/doc/qbk/alternatives.qbk (original)
+++ sandbox/local/libs/local/doc/qbk/alternatives.qbk 2011-05-05 14:09:15 EDT (Thu, 05 May 2011)
@@ -79,6 +79,15 @@
[ Yes (variables in scope are accessible as usual within expressions).
Plus `boost::phoenix::let` can be used to bind variables by constant reference. ]
]
+[
+ [ ['[@http://en.wikipedia.org/wiki/Type_polymorphism#Parametric_polymorphism Polymorphic] in the unbound parameter types] ]
+ [ No (local functions cannot be function templates). ]
+ [ No (local classes cannot have member function templates). ]
+ [ Yes. ]
+ [ No (C++0x lambdas cannot be function templates). ]
+ [ Yes. ]
+ [ Yes. ]
+]
]
[h5 Examples]
Modified: sandbox/local/libs/local/doc/qbk/release_notes.qbk
==============================================================================
--- sandbox/local/libs/local/doc/qbk/release_notes.qbk (original)
+++ sandbox/local/libs/local/doc/qbk/release_notes.qbk 2011-05-05 14:09:15 EDT (Thu, 05 May 2011)
@@ -28,15 +28,14 @@
[section TODO]
-# Remove all references (docs, doxy, examples, etc) to local::function.
-Make local::function local::aux::function and use boost::function instead.
-
# Verify compilation and run-times on all compilers one last time.
# Rework factorial_impl and Implementation section.
# Finalize Acknowledge section.
+# Apply copyright to all files.
+
[endsect]
[endsect]
Modified: sandbox/local/libs/local/doc/qbk/tutorial.qbk
==============================================================================
--- sandbox/local/libs/local/doc/qbk/tutorial.qbk (original)
+++ sandbox/local/libs/local/doc/qbk/tutorial.qbk 2011-05-05 14:09:15 EDT (Thu, 05 May 2011)
@@ -6,7 +6,7 @@
[section:Tutorial Tutorial]
-This section illustrates basic usage of local functions, local blocks, and local exits.
+This section illustrates basic usages of local functions, local blocks, and local exits.
[section Local Functions]
Modified: sandbox/local/libs/local/example/add_function_inline.cpp
==============================================================================
--- sandbox/local/libs/local/example/add_function_inline.cpp (original)
+++ sandbox/local/libs/local/example/add_function_inline.cpp 2011-05-05 14:09:15 EDT (Thu, 05 May 2011)
@@ -17,18 +17,18 @@
void BOOST_LOCAL_FUNCTION_PARAMS( (double num) (const bind factor)
(bind& sum) ) {
sum += factor * num;
- } BOOST_LOCAL_FUNCTION_NAME(inline add) // inlined local function
+ } BOOST_LOCAL_FUNCTION_NAME(inline add) // Specified inlined.
std::vector<double> v(1000000);
std::fill(v.begin(), v.end(), 1.0);
- // On some ISO C++ compilers (e.g., GCC 4.3) inlined local functions are
+ // On some ISO C++ compilers (e.g., GCC 4.3.4) inlined local functions are
// more likely to be optimized for faster run-times. However, inlined local
// functions cannot be passed at template parameters (i.e., `std::for_each`
// cannot be used here).
- // On C++0x compilers (e.g., MSVC 8.0 and GCC 4.5) linining has no effect
+ // On C++0x compilers (e.g., MSVC 8.0 and GCC 4.5.1) linining has no effect
// because the local function can always be optimized even if not
- // explicitly specified inline and inlined local functions can be always be
+ // explicitly specified inline and inlined local functions can always be
// passed as template parameters.
for (size_t i = 0; i < v.size(); ++i) { // Can't use for_each (portably).
add(v[i]);
Modified: sandbox/local/libs/local/example/add_function_inline_va.cpp
==============================================================================
--- sandbox/local/libs/local/example/add_function_inline_va.cpp (original)
+++ sandbox/local/libs/local/example/add_function_inline_va.cpp 2011-05-05 14:09:15 EDT (Thu, 05 May 2011)
@@ -26,18 +26,18 @@
void BOOST_LOCAL_FUNCTION_PARAMS(double num, const bind factor,
bind& sum) {
sum += factor * num;
- } BOOST_LOCAL_FUNCTION_NAME(inline add) // inlined local function
+ } BOOST_LOCAL_FUNCTION_NAME(inline add) // Specified inlined.
std::vector<double> v(1000000);
std::fill(v.begin(), v.end(), 1.0);
- // On some ISO C++ compilers (e.g., GCC 4.3) inlined local functions are
+ // On some ISO C++ compilers (e.g., GCC 4.3.4) inlined local functions are
// more likely to be optimized for faster run-times. However, inlined local
// functions cannot be passed at template parameters (i.e., `std::for_each`
// cannot be used here).
- // On C++0x compilers (e.g., MSVC 8.0 or GCC 4.5) linining has no effect
+ // On C++0x compilers (e.g., MSVC 8.0 or GCC 4.5.1) linining has no effect
// because the local function can always be optimized even if not
- // explicitly specified inline and inlined local functions can be always be
+ // explicitly specified inline and inlined local functions can always be
// passed as template parameters.
for (size_t i = 0; i < v.size(); ++i) { // Can't use for_each (portably).
add(v[i]);
Modified: sandbox/local/libs/local/example/nesting.cpp
==============================================================================
--- sandbox/local/libs/local/example/nesting.cpp (original)
+++ sandbox/local/libs/local/example/nesting.cpp 2011-05-05 14:09:15 EDT (Thu, 05 May 2011)
@@ -24,17 +24,22 @@
std::cout << "m: " << x << std::endl;
} BOOST_LOCAL_FUNCTION_NAME(m)
- x--; m();
+ x--;
+ m(); // Nested local function call.
} BOOST_LOCAL_FUNCTION_NAME(l)
// Local functions, blocks and exits nested into each other.
void BOOST_LOCAL_FUNCTION_PARAMS( (bind& x) ) {
+
BOOST_LOCAL_EXIT( (bind& x) ) {
x = 0;
+
BOOST_LOCAL_BLOCK( (const bind& x) ) {
assert(x == 0);
} BOOST_LOCAL_BLOCK_END
+
} BOOST_LOCAL_EXIT_END
+
std::cout << "n: " << x << std::endl;
} BOOST_LOCAL_FUNCTION_NAME(n)
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-05-05 14:09:15 EDT (Thu, 05 May 2011)
@@ -31,17 +31,22 @@
std::cout << "m: " << x << std::endl;
} BOOST_LOCAL_FUNCTION_NAME(m)
- x--; m();
+ x--;
+ m(); // Nested local function call.
} BOOST_LOCAL_FUNCTION_NAME(l)
// Local functions, blocks and exits nested into each other.
void BOOST_LOCAL_FUNCTION_PARAMS(bind& x) {
+
BOOST_LOCAL_EXIT(bind& x) {
x = 0;
+
BOOST_LOCAL_BLOCK(const bind& x) {
assert(x == 0);
} BOOST_LOCAL_BLOCK_END
+
} BOOST_LOCAL_EXIT_END
+
std::cout << "n: " << x << std::endl;
} BOOST_LOCAL_FUNCTION_NAME(n)
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-05-05 14:09:15 EDT (Thu, 05 May 2011)
@@ -11,11 +11,8 @@
#include <string>
#include <iostream>
-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);
+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);
std::string cat(const std::string& a, const std::string& b) { return a + b; }
@@ -28,7 +25,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_sizeof<std::string, size_t>::value))
+ (key_size<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) {
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