Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r70485 - in sandbox/local: . boost/local boost/local/aux_/function_macros/code_ boost/utility libs/local/doc/html libs/local/doc/html/boost/local libs/local/doc/html/boost_local libs/local/doc/qbk libs/local/example
From: lorcaminiti_at_[hidden]
Date: 2011-03-23 20:03:44


Author: lcaminiti
Date: 2011-03-23 20:03:37 EDT (Wed, 23 Mar 2011)
New Revision: 70485
URL: http://svn.boost.org/trac/boost/changeset/70485

Log:
Fixed all examples and impl section in docs.
Removed:
   sandbox/local/libs/local/example/gcc-goto.cpp
Text files modified:
   sandbox/local/TODO.txt | 31 +++
   sandbox/local/boost/local/aux_/function_macros/code_/functor.hpp | 16 +
   sandbox/local/boost/local/config.hpp | 2
   sandbox/local/boost/utility/identity.hpp | 2
   sandbox/local/libs/local/doc/html/BOOST_IDENTITY_TYPE.html | 2
   sandbox/local/libs/local/doc/html/BOOST_IDENTITY_VALUE.html | 4
   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 | 4
   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/function.html | 2
   sandbox/local/libs/local/doc/html/boost_local/Advanced_Topics.html | 88 ++++++---
   sandbox/local/libs/local/doc/html/boost_local/Getting_Started.html | 4
   sandbox/local/libs/local/doc/html/boost_local/Implementation.html | 343 +++++++++++++++++++++++++++++----------
   sandbox/local/libs/local/doc/html/boost_local/Tutorial.html | 71 ++++---
   sandbox/local/libs/local/doc/html/index.html | 12
   sandbox/local/libs/local/doc/qbk/implementation.qbk | 48 +++++
   sandbox/local/libs/local/doc/qbk/local.qbk | 2
   sandbox/local/libs/local/example/Jamfile.jam | 56 ++++--
   sandbox/local/libs/local/example/add_this.cpp | 8
   sandbox/local/libs/local/example/add_this_va.cpp | 13 +
   sandbox/local/libs/local/example/factorial.cpp | 36 ++-
   sandbox/local/libs/local/example/factorial_impl.cpp | 214 +++++++++++++++---------
   sandbox/local/libs/local/example/factorial_va.cpp | 36 ++-
   sandbox/local/libs/local/example/gcc-access_va.cpp | 13 +
   sandbox/local/libs/local/example/gcc-square.cpp | 14 +
   sandbox/local/libs/local/example/gcc-square_va.cpp | 14 +
   sandbox/local/libs/local/example/gcc-store.cpp | 12 +
   37 files changed, 736 insertions(+), 335 deletions(-)

Modified: sandbox/local/TODO.txt
==============================================================================
--- sandbox/local/TODO.txt (original)
+++ sandbox/local/TODO.txt 2011-03-23 20:03:37 EDT (Wed, 23 Mar 2011)
@@ -4,6 +4,37 @@
 
 * Docs: Document that const must appear before bind.
 
+* Docs: Limitation that enclosing scope gotos cannot be jumped to from within a local functions:
+#include <boost/local/function.hpp>
+#include <iostream>
+
+int print(int* array, int offset, int size) {
+ int BOOST_LOCAL_FUNCTION_PARAMS( (int* array) (int index)
+ (const bind offset) (const bind size) ) {
+ if (index > size) goto failure;
+ return array[index + offset];
+ } BOOST_LOCAL_FUNCTION_NAME(access)
+
+ for (int i = 0; i < size; ++i) {
+ std::cout << access(array, i) << std::endl;
+ }
+ return 0;
+
+failure:
+ return -1;
+}
+
+int main() {
+ int a[] = {1, 2, 3, 4, 5};
+ print(a, 1, 2);
+ return 0;
+}
+
+* Docs: Add the GCC "nested function" examples to the docs.
+
+* Examples: Use std::cout instead of std::clog in all examples.
+
+
 * Docs: The simplified syntax removes the function name repetition. However, to supoprt recursion (and nesting) the body cannot be static (to access the member functor variable with the local function name defined by the NAME macro). Therefore the limitation that no compiler error if `this` is used instead of `this_` as a pointer within the body (if not used as pointer, compiler will most likely error because `this` is the functor which has a rather different structure than the user's object `this_`).
 
 * Docs: `inline` does not apply to local function which are already inlined (because they are defined where they are declared).

Modified: sandbox/local/boost/local/aux_/function_macros/code_/functor.hpp
==============================================================================
--- sandbox/local/boost/local/aux_/function_macros/code_/functor.hpp (original)
+++ sandbox/local/boost/local/aux_/function_macros/code_/functor.hpp 2011-03-23 20:03:37 EDT (Wed, 23 Mar 2011)
@@ -175,12 +175,6 @@
                 (sign_params, unbinds, const_binds, has_const_bind_this, \
                  binds, has_bind_this, id, typename_keyword) ) \
     private: \
- /* this allows for nesting (local functions, blocks, and exits) as */ \
- /* it makes the args variable visible within the body code (which */ \
- /* cannot be static); this is for compilation only as the args */ \
- /* variable is actually declared by the 1st enclosing local func */ \
- boost::scope_exit::aux::undeclared \
- BOOST_LOCAL_AUX_SYMBOL_ARGS_VARIABLE_NAME; \
         /* this type symbol cannot have ID postfix because it is used */ \
         /* the `NAME` macro (because this symbol is within functor class */ \
         /* it doesn't have to have ID postfix). */ \
@@ -228,7 +222,15 @@
             BOOST_SCOPE_EXIT_AUX_PARAMS_T(id)* \
                     BOOST_LOCAL_AUX_SYMBOL_BINDS_VARIABLE_NAME; \
         ) \
- /* body function */ \
+ /* this allows for nesting (local functions, blocks, and exits) as */ \
+ /* it makes the args variable visible within the body code (which */ \
+ /* cannot be static); this is for compilation only as the args */ \
+ /* variable is actually declared by the 1st enclosing local func */ \
+ boost::scope_exit::aux::undeclared \
+ BOOST_LOCAL_AUX_SYMBOL_ARGS_VARIABLE_NAME; \
+ /* body function (unfortunately, cannot be static to allow access */ \
+ /* to member var with local function name for recursion but doing */ \
+ /* so also allows the body to misuse `this` instead of `this_`) */ \
         BOOST_LOCAL_AUX_SYMBOL_RESULT_TYPE(id) \
         BOOST_LOCAL_AUX_SYMBOL_BODY_FUNCTION_NAME( \
                 /* const binds */ \

Modified: sandbox/local/boost/local/config.hpp
==============================================================================
--- sandbox/local/boost/local/config.hpp (original)
+++ sandbox/local/boost/local/config.hpp 2011-03-23 20:03:37 EDT (Wed, 23 Mar 2011)
@@ -80,7 +80,7 @@
  * If programmers leave this configuration macro undefined, the default
  * symbol used is <c>this_</c>.
  *
- * @Warning Programmers should not #define this macro unless it is absolutely
+ * @Warning 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 <c>this_</c> effectively changes the public
  * API of this library.

Modified: sandbox/local/boost/utility/identity.hpp
==============================================================================
--- sandbox/local/boost/utility/identity.hpp (original)
+++ sandbox/local/boost/utility/identity.hpp 2011-03-23 20:03:37 EDT (Wed, 23 Mar 2011)
@@ -59,7 +59,7 @@
  *
  * 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 @RefSect{Advanced_Topics, Advanced Topics}
+ * value at run-time (see the @RefSect2{Advanced_Topics, Advanced Topics}
  * section).
  *
  * For example <c>BOOST_IDENTITY_VALUE((key_sizeof<int, double>::value))</c>

Modified: sandbox/local/libs/local/doc/html/BOOST_IDENTITY_TYPE.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_IDENTITY_TYPE.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_IDENTITY_TYPE.html 2011-03-23 20:03:37 EDT (Wed, 23 Mar 2011)
@@ -33,7 +33,7 @@
 
 </span>BOOST_IDENTITY_TYPE(parenthesized_type)</pre></div>
 <div class="refsect1">
-<a name="id913202"></a><h2>Description</h2>
+<a name="id914290"></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&lt;int, double&gt;))</code> can be passed as a single macro parameter when instead <code class="computeroutput">std::map&lt;int, double&gt;</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-03-23 20:03:37 EDT (Wed, 23 Mar 2011)
@@ -33,8 +33,8 @@
 
 </span>BOOST_IDENTITY_VALUE(parenthesized_value)</pre></div>
 <div class="refsect1">
-<a name="id913343"></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 {Advanced_Topics, Advanced Topics} section).</p>
+<a name="id914431"></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&lt;int, double&gt;::value))</code> can be passed as a single macro parameter when instead <code class="computeroutput">key_sizeof&lt;int, double&gt;::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>
 <div class="informaltable"><table class="table">

Modified: sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK.html 2011-03-23 20:03:37 EDT (Wed, 23 Mar 2011)
@@ -33,7 +33,7 @@
 
 </span>BOOST_LOCAL_BLOCK(bindings)</pre></div>
 <div class="refsect1">
-<a name="id908227"></a><h2>Description</h2>
+<a name="id909323"></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-03-23 20:03:37 EDT (Wed, 23 Mar 2011)
@@ -33,7 +33,7 @@
 
 </span>BOOST_LOCAL_BLOCK_END</pre></div>
 <div class="refsect1">
-<a name="id908949"></a><h2>Description</h2>
+<a name="id910044"></a><h2>Description</h2>
 <p>This macro must follow the local block body code <code class="computeroutput">{ ... }</code> as shown in the <code class="computeroutput"><a class="link" href="BOOST_LOCAL_BLOCK.html" title="Macro BOOST_LOCAL_BLOCK">BOOST_LOCAL_BLOCK</a></code> documentation.</p>
 <p><span class="bold"><strong>See:</strong></span> <code class="computeroutput"><a class="link" href="BOOST_LOCAL_BLOCK.html" title="Macro BOOST_LOCAL_BLOCK">BOOST_LOCAL_BLOCK</a></code>, <a class="link" href="boost_local/Tutorial.html" title="Tutorial">Tutorial</a> section. </p>
 </div>

Modified: sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK_TPL.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK_TPL.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK_TPL.html 2011-03-23 20:03:37 EDT (Wed, 23 Mar 2011)
@@ -33,7 +33,7 @@
 
 </span>BOOST_LOCAL_BLOCK_TPL(bindings)</pre></div>
 <div class="refsect1">
-<a name="id908875"></a><h2>Description</h2>
+<a name="id909970"></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-03-23 20:03:37 EDT (Wed, 23 Mar 2011)
@@ -33,7 +33,7 @@
 
 </span>BOOST_LOCAL_CONFIG_COMPLIANT</pre></div>
 <div class="refsect1">
-<a name="id909100"></a><h2>Description</h2>
+<a name="id910196"></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-03-23 20:03:37 EDT (Wed, 23 Mar 2011)
@@ -33,7 +33,7 @@
 
 </span>BOOST_LOCAL_CONFIG_FUNCTION_ARITY_MAX</pre></div>
 <div class="refsect1">
-<a name="id909276"></a><h2>Description</h2>
+<a name="id910371"></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-03-23 20:03:37 EDT (Wed, 23 Mar 2011)
@@ -33,9 +33,9 @@
 
 </span>BOOST_LOCAL_CONFIG_THIS_PARAM_NAME</pre></div>
 <div class="refsect1">
-<a name="id909371"></a><h2>Description</h2>
+<a name="id910467"></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>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>
 </div>
 </div>

Modified: sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT.html 2011-03-23 20:03:37 EDT (Wed, 23 Mar 2011)
@@ -33,7 +33,7 @@
 
 </span>BOOST_LOCAL_EXIT(binding_list)</pre></div>
 <div class="refsect1">
-<a name="id909512"></a><h2>Description</h2>
+<a name="id910607"></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-03-23 20:03:37 EDT (Wed, 23 Mar 2011)
@@ -33,7 +33,7 @@
 
 </span>BOOST_LOCAL_EXIT_END</pre></div>
 <div class="refsect1">
-<a name="id910250"></a><h2>Description</h2>
+<a name="id911339"></a><h2>Description</h2>
 <p>This macro must follow the local exit body code <code class="computeroutput">{ ... }</code> as shown in the <code class="computeroutput"><a class="link" href="BOOST_LOCAL_EXIT.html" title="Macro BOOST_LOCAL_EXIT">BOOST_LOCAL_EXIT</a></code> documentation.</p>
 <p><span class="bold"><strong>See:</strong></span> <code class="computeroutput"><a class="link" href="BOOST_LOCAL_EXIT.html" title="Macro BOOST_LOCAL_EXIT">BOOST_LOCAL_EXIT</a></code>, <a class="link" href="boost_local/Tutorial.html" title="Tutorial">Tutorial</a> section. </p>
 </div>

Modified: sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT_TPL.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT_TPL.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT_TPL.html 2011-03-23 20:03:37 EDT (Wed, 23 Mar 2011)
@@ -33,7 +33,7 @@
 
 </span>BOOST_LOCAL_EXIT_TPL(binding_list)</pre></div>
 <div class="refsect1">
-<a name="id910176"></a><h2>Description</h2>
+<a name="id911265"></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-03-23 20:03:37 EDT (Wed, 23 Mar 2011)
@@ -33,7 +33,7 @@
 
 </span>BOOST_LOCAL_FUNCTION_NAME(name)</pre></div>
 <div class="refsect1">
-<a name="id912681"></a><h2>Description</h2>
+<a name="id913769"></a><h2>Description</h2>
 <p>This macro must follow the local function body code block <code class="computeroutput">{ ... }</code> as shown in the <code class="computeroutput"><a class="link" href="BOOST_LOCAL_FUNCTION_PARAMS.html" title="Macro BOOST_LOCAL_FUNCTION_PARAMS">BOOST_LOCAL_FUNCTION_PARAMS</a></code> documentation.</p>
 <p><span class="bold"><strong>Parameters:</strong></span> </p>
 <div class="informaltable"><table class="table">

Modified: sandbox/local/libs/local/doc/html/BOOST_LOCAL_FUNCTION_PARAMS.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_LOCAL_FUNCTION_PARAMS.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_LOCAL_FUNCTION_PARAMS.html 2011-03-23 20:03:37 EDT (Wed, 23 Mar 2011)
@@ -33,7 +33,7 @@
 
 </span>BOOST_LOCAL_FUNCTION_PARAMS(parameters)</pre></div>
 <div class="refsect1">
-<a name="id911723"></a><h2>Description</h2>
+<a name="id912811"></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-03-23 20:03:37 EDT (Wed, 23 Mar 2011)
@@ -33,7 +33,7 @@
 
 </span>BOOST_LOCAL_FUNCTION_PARAMS_TPL(parameters)</pre></div>
 <div class="refsect1">
-<a name="id912606"></a><h2>Description</h2>
+<a name="id913695"></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-03-23 20:03:37 EDT (Wed, 23 Mar 2011)
@@ -33,7 +33,7 @@
 
 </span>BOOST_LOCAL_TYPEOF(bound_variable_name)</pre></div>
 <div class="refsect1">
-<a name="id912874"></a><h2>Description</h2>
+<a name="id913963"></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">x</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 x</code> then <code class="computeroutput">BOOST_LOCAL_TYPEOF(x)</code> is <code class="computeroutput">T</code>. </p></li>

Modified: sandbox/local/libs/local/doc/html/boost/local/function.html
==============================================================================
--- sandbox/local/libs/local/doc/html/boost/local/function.html (original)
+++ sandbox/local/libs/local/doc/html/boost/local/function.html 2011-03-23 20:03:37 EDT (Wed, 23 Mar 2011)
@@ -35,7 +35,7 @@
 <span class="keyword">struct</span> <a class="link" href="function.html" title="Struct template function">function</a> <span class="special">{</span>
 <span class="special">}</span><span class="special">;</span></pre></div>
 <div class="refsect1">
-<a name="id910595"></a><h2>Description</h2>
+<a name="id911683"></a><h2>Description</h2>
 <p>This template defines several specializations to handle a generic number of function parameters some of which can have default values. The number of supported function parameters <code class="computeroutput">N</code> goes from <code class="computeroutput">0</code> (for a function with no parameter) to a maximum of <code class="computeroutput"><a class="link" href="../../BOOST_LOCAL_CONFIG_FUNCTION_ARITY_MAX.html" title="Macro BOOST_LOCAL_CONFIG_FUNCTION_ARITY_MAX">BOOST_LOCAL_CONFIG_FUNCTION_ARITY_MAX</a></code>.</p>
 <p>Each template specialization defines call operators <code class="computeroutput">operator()(...)</code> with a different set of parameters to handle the number of default parameters specified by <code class="computeroutput">defaults</code> (see <a class="link" href="../../boost_local/Advanced_Topics.html" title="Advanced Topics">
  Advanced Topics</a> section): </p>

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-03-23 20:03:37 EDT (Wed, 23 Mar 2011)
@@ -83,7 +83,7 @@
 <p>
         In addition, local function parameter types cannot start with non-alphanumeric
         symbols (alphanumeric symbols are <code class="computeroutput"><span class="identifier">A</span><span class="special">-</span><span class="identifier">Z</span></code>, <code class="computeroutput"><span class="identifier">a</span><span class="special">-</span><span class="identifier">z</span></code>,
- and <code class="computeroutput"><span class="number">0</span><span class="special">-</span><span class="number">9</span></code>). <sup>[<a name="id879676" href="#ftn.id879676" class="footnote">15</a>]</sup> The library will generate (cryptic) preprocessor errors if a
+ and <code class="computeroutput"><span class="number">0</span><span class="special">-</span><span class="number">9</span></code>). <sup>[<a name="id880229" href="#ftn.id880229" class="footnote">15</a>]</sup> The library will generate (cryptic) preprocessor errors if a
         parameter type starts with a non-alphanumeric symbol.
       </p>
 <p>
@@ -206,7 +206,7 @@
 <li class="listitem">
             Parenthesis to wrap the type expression (and therefore any commas <code class="computeroutput"><span class="special">,</span></code> that it contains) passed as parameter
             to the <code class="computeroutput"><a class="link" href="../BOOST_IDENTITY_TYPE.html" title="Macro BOOST_IDENTITY_TYPE">BOOST_IDENTITY_TYPE</a></code>
- macro. <sup>[<a name="id881034" href="#ftn.id881034" class="footnote">16</a>]</sup>
+ macro. <sup>[<a name="id881587" href="#ftn.id881587" class="footnote">16</a>]</sup>
           </li>
 </ol></div>
 <p>
@@ -407,7 +407,7 @@
         </p></td></tr>
 </table></div>
 <p>
- Consider the following complete example: <sup>[<a name="id882338" href="#ftn.id882338" class="footnote">17</a>]</sup>
+ Consider the following complete example: <sup>[<a name="id882892" href="#ftn.id882892" class="footnote">17</a>]</sup>
       </p>
 <div class="informaltable"><table class="table">
 <colgroup>
@@ -1419,26 +1419,36 @@
 <span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">sstream</span><span class="special">&gt;</span>
 <span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">algorithm</span><span class="special">&gt;</span>
 <span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">vector</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">string</span><span class="special">&gt;</span>
 
-<span class="keyword">int</span> <span class="identifier">main</span> <span class="special">()</span> <span class="special">{</span>
+<span class="keyword">struct</span> <span class="identifier">calculator</span> <span class="special">{</span>
     <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostringstream</span> <span class="identifier">output</span><span class="special">;</span>
 
- <span class="keyword">int</span> <span class="identifier">BOOST_LOCAL_FUNCTION_PARAMS</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">n</span><span class="special">,</span> <span class="keyword">bool</span> <span class="identifier">recursion</span><span class="special">,</span> <span class="keyword">default</span> <span class="keyword">false</span><span class="special">,</span>
- <span class="identifier">bind</span><span class="special">&amp;</span> <span class="identifier">output</span><span class="special">)</span> <span class="special">{</span>
- <span class="keyword">int</span> <span class="identifier">result</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
+ <span class="keyword">void</span> <span class="identifier">factorials</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">&gt;&amp;</span> <span class="identifier">nums</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">&amp;</span> <span class="identifier">separator</span> <span class="special">=</span> <span class="string">" "</span><span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">int</span> <span class="identifier">BOOST_LOCAL_FUNCTION_PARAMS</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">n</span><span class="special">,</span> <span class="keyword">bool</span> <span class="identifier">recursion</span><span class="special">,</span> <span class="keyword">default</span> <span class="keyword">false</span><span class="special">,</span>
+ <span class="keyword">const</span> <span class="identifier">bind</span><span class="special">&amp;</span> <span class="identifier">separator</span><span class="special">,</span> <span class="identifier">bind</span> <span class="keyword">this</span><span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">int</span> <span class="identifier">result</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
 
- <span class="keyword">if</span> <span class="special">(</span><span class="identifier">n</span> <span class="special">&lt;</span> <span class="number">2</span> <span class="special">)</span> <span class="identifier">result</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span>
- <span class="keyword">else</span> <span class="identifier">result</span> <span class="special">=</span> <span class="identifier">n</span> <span class="special">*</span> <span class="identifier">factorial</span><span class="special">(</span><span class="identifier">n</span> <span class="special">-</span> <span class="number">1</span><span class="special">,</span> <span class="keyword">true</span><span class="special">);</span> <span class="comment">// Recursive call.
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">n</span> <span class="special">&lt;</span> <span class="number">2</span> <span class="special">)</span> <span class="identifier">result</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span>
+ <span class="keyword">else</span> <span class="identifier">result</span> <span class="special">=</span> <span class="identifier">n</span> <span class="special">*</span> <span class="identifier">factorial</span><span class="special">(</span><span class="identifier">n</span> <span class="special">-</span> <span class="number">1</span><span class="special">,</span> <span class="keyword">true</span><span class="special">);</span> <span class="comment">// Recursive call.
 </span>
- <span class="keyword">if</span> <span class="special">(!</span><span class="identifier">recursion</span><span class="special">)</span> <span class="identifier">output</span> <span class="special">&lt;&lt;</span> <span class="identifier">result</span> <span class="special">&lt;&lt;</span> <span class="string">" "</span><span class="special">;</span>
- <span class="keyword">return</span> <span class="identifier">result</span><span class="special">;</span>
- <span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">factorial</span><span class="special">)</span>
+ <span class="keyword">if</span> <span class="special">(!</span><span class="identifier">recursion</span><span class="special">)</span> <span class="identifier">this_</span><span class="special">-&gt;</span><span class="identifier">output</span> <span class="special">&lt;&lt;</span> <span class="identifier">result</span> <span class="special">&lt;&lt;</span> <span class="identifier">separator</span><span class="special">;</span>
+ <span class="keyword">return</span> <span class="identifier">result</span><span class="special">;</span>
+ <span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">factorial</span><span class="special">)</span>
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">for_each</span><span class="special">(</span><span class="identifier">nums</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">nums</span><span class="special">.</span><span class="identifier">end</span><span class="special">(),</span> <span class="identifier">factorial</span><span class="special">);</span>
+ <span class="special">}</span>
+<span class="special">};</span>
 
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span> <span class="special">{</span>
     <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">&gt;</span> <span class="identifier">v</span><span class="special">(</span><span class="number">3</span><span class="special">);</span>
     <span class="identifier">v</span><span class="special">[</span><span class="number">0</span><span class="special">]</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> <span class="identifier">v</span><span class="special">[</span><span class="number">1</span><span class="special">]</span> <span class="special">=</span> <span class="number">4</span><span class="special">;</span> <span class="identifier">v</span><span class="special">[</span><span class="number">2</span><span class="special">]</span> <span class="special">=</span> <span class="number">7</span><span class="special">;</span>
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">for_each</span><span class="special">(</span><span class="identifier">v</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">end</span><span class="special">(),</span> <span class="identifier">factorial</span><span class="special">);</span>
 
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">output</span><span class="special">.</span><span class="identifier">str</span><span class="special">()</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="identifier">calculator</span> <span class="identifier">calc</span><span class="special">;</span>
+ <span class="identifier">calc</span><span class="special">.</span><span class="identifier">factorials</span><span class="special">(</span><span class="identifier">v</span><span class="special">);</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">calc</span><span class="special">.</span><span class="identifier">output</span><span class="special">.</span><span class="identifier">str</span><span class="special">()</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+
     <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
 <span class="special">}</span>
 </pre>
@@ -1454,26 +1464,36 @@
 <span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">sstream</span><span class="special">&gt;</span>
 <span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">algorithm</span><span class="special">&gt;</span>
 <span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">vector</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">string</span><span class="special">&gt;</span>
 
-<span class="keyword">int</span> <span class="identifier">main</span> <span class="special">()</span> <span class="special">{</span>
+<span class="keyword">struct</span> <span class="identifier">calculator</span> <span class="special">{</span>
     <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostringstream</span> <span class="identifier">output</span><span class="special">;</span>
 
- <span class="keyword">int</span> <span class="identifier">BOOST_LOCAL_FUNCTION_PARAMS</span><span class="special">(</span> <span class="special">(</span><span class="keyword">int</span> <span class="identifier">n</span><span class="special">)</span> <span class="special">(</span><span class="keyword">bool</span> <span class="identifier">recursion</span><span class="special">)(</span><span class="keyword">default</span> <span class="keyword">false</span><span class="special">)</span>
- <span class="special">(</span><span class="identifier">bind</span><span class="special">&amp;</span> <span class="identifier">output</span><span class="special">)</span> <span class="special">)</span> <span class="special">{</span>
- <span class="keyword">int</span> <span class="identifier">result</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
+ <span class="keyword">void</span> <span class="identifier">factorials</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">&gt;&amp;</span> <span class="identifier">nums</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">&amp;</span> <span class="identifier">separator</span> <span class="special">=</span> <span class="string">" "</span><span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">int</span> <span class="identifier">BOOST_LOCAL_FUNCTION_PARAMS</span><span class="special">(</span> <span class="special">(</span><span class="keyword">int</span> <span class="identifier">n</span><span class="special">)</span> <span class="special">(</span><span class="keyword">bool</span> <span class="identifier">recursion</span><span class="special">)(</span><span class="keyword">default</span> <span class="keyword">false</span><span class="special">)</span>
+ <span class="special">(</span><span class="keyword">const</span> <span class="identifier">bind</span><span class="special">&amp;</span> <span class="identifier">separator</span><span class="special">)</span> <span class="special">(</span><span class="identifier">bind</span> <span class="keyword">this</span><span class="special">)</span> <span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">int</span> <span class="identifier">result</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
 
- <span class="keyword">if</span> <span class="special">(</span><span class="identifier">n</span> <span class="special">&lt;</span> <span class="number">2</span> <span class="special">)</span> <span class="identifier">result</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span>
- <span class="keyword">else</span> <span class="identifier">result</span> <span class="special">=</span> <span class="identifier">n</span> <span class="special">*</span> <span class="identifier">factorial</span><span class="special">(</span><span class="identifier">n</span> <span class="special">-</span> <span class="number">1</span><span class="special">,</span> <span class="keyword">true</span><span class="special">);</span> <span class="comment">// Recursive call.
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">n</span> <span class="special">&lt;</span> <span class="number">2</span> <span class="special">)</span> <span class="identifier">result</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span>
+ <span class="keyword">else</span> <span class="identifier">result</span> <span class="special">=</span> <span class="identifier">n</span> <span class="special">*</span> <span class="identifier">factorial</span><span class="special">(</span><span class="identifier">n</span> <span class="special">-</span> <span class="number">1</span><span class="special">,</span> <span class="keyword">true</span><span class="special">);</span> <span class="comment">// Recursive call.
 </span>
- <span class="keyword">if</span> <span class="special">(!</span><span class="identifier">recursion</span><span class="special">)</span> <span class="identifier">output</span> <span class="special">&lt;&lt;</span> <span class="identifier">result</span> <span class="special">&lt;&lt;</span> <span class="string">" "</span><span class="special">;</span>
- <span class="keyword">return</span> <span class="identifier">result</span><span class="special">;</span>
- <span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">factorial</span><span class="special">)</span>
+ <span class="keyword">if</span> <span class="special">(!</span><span class="identifier">recursion</span><span class="special">)</span> <span class="identifier">this_</span><span class="special">-&gt;</span><span class="identifier">output</span> <span class="special">&lt;&lt;</span> <span class="identifier">result</span> <span class="special">&lt;&lt;</span> <span class="identifier">separator</span><span class="special">;</span>
+ <span class="keyword">return</span> <span class="identifier">result</span><span class="special">;</span>
+ <span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">factorial</span><span class="special">)</span>
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">for_each</span><span class="special">(</span><span class="identifier">nums</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">nums</span><span class="special">.</span><span class="identifier">end</span><span class="special">(),</span> <span class="identifier">factorial</span><span class="special">);</span>
+ <span class="special">}</span>
+<span class="special">};</span>
 
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span> <span class="special">{</span>
     <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">&gt;</span> <span class="identifier">v</span><span class="special">(</span><span class="number">3</span><span class="special">);</span>
     <span class="identifier">v</span><span class="special">[</span><span class="number">0</span><span class="special">]</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> <span class="identifier">v</span><span class="special">[</span><span class="number">1</span><span class="special">]</span> <span class="special">=</span> <span class="number">4</span><span class="special">;</span> <span class="identifier">v</span><span class="special">[</span><span class="number">2</span><span class="special">]</span> <span class="special">=</span> <span class="number">7</span><span class="special">;</span>
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">for_each</span><span class="special">(</span><span class="identifier">v</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">end</span><span class="special">(),</span> <span class="identifier">factorial</span><span class="special">);</span>
 
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">output</span><span class="special">.</span><span class="identifier">str</span><span class="special">()</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="identifier">calculator</span> <span class="identifier">calc</span><span class="special">;</span>
+ <span class="identifier">calc</span><span class="special">.</span><span class="identifier">factorials</span><span class="special">(</span><span class="identifier">v</span><span class="special">);</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">calc</span><span class="special">.</span><span class="identifier">output</span><span class="special">.</span><span class="identifier">str</span><span class="special">()</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+
     <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
 <span class="special">}</span>
 </pre>
@@ -1868,14 +1888,14 @@
 </tbody>
 </table></div>
 <a name="boost_local.Advanced_Topics.limitations__overloading__operators__etc_.overloading"></a><h6>
-<a name="id907394"></a>
+<a name="id908490"></a>
         <a class="link" href="Advanced_Topics.html#boost_local.Advanced_Topics.limitations__overloading__operators__etc_.overloading">Overloading</a>
       </h6>
 <p>
         It is not possible to overload local functions. Declaring multiple local
         functions with the same name within the same enclosing scope generates a
         compile-time error (even if the different declarations specify different
- parameters). <sup>[<a name="id907418" href="#ftn.id907418" class="footnote">18</a>]</sup>
+ parameters). <sup>[<a name="id908514" href="#ftn.id908514" class="footnote">18</a>]</sup>
       </p>
 <p>
         For example, the following code will <span class="bold"><strong>not</strong></span>
@@ -1894,12 +1914,12 @@
 <span class="special">}</span>
 </pre>
 <a name="boost_local.Advanced_Topics.limitations__overloading__operators__etc_.operators"></a><h6>
-<a name="id907725"></a>
+<a name="id908820"></a>
         <a class="link" href="Advanced_Topics.html#boost_local.Advanced_Topics.limitations__overloading__operators__etc_.operators">Operators</a>
       </h6>
 <p>
         Local functions cannot be operators. Naming a local function <code class="computeroutput"><span class="keyword">operator</span><span class="special">...</span></code>
- will generate a compile-time error. <sup>[<a name="id907762" href="#ftn.id907762" class="footnote">19</a>]</sup>
+ will generate a compile-time error. <sup>[<a name="id908857" href="#ftn.id908857" class="footnote">19</a>]</sup>
       </p>
 <p>
         For example, the following code will <span class="bold"><strong>not</strong></span>
@@ -1922,21 +1942,21 @@
 </div>
 <div class="footnotes">
 <br><hr width="100" align="left">
-<div class="footnote"><p><sup>[<a id="ftn.id879676" href="#id879676" class="para">15</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id880229" href="#id880229" class="para">15</a>] </sup>
           <span class="bold"><strong>Rationale.</strong></span> This limitation derives from
           the fact that <code class="computeroutput"><a class="link" href="../BOOST_LOCAL_FUNCTION_PARAMS.html" title="Macro BOOST_LOCAL_FUNCTION_PARAMS">BOOST_LOCAL_FUNCTION_PARAMS</a></code>
           uses preprocessor token concatenation to inspect the parameter type token
           to see if the token is a parameter or a bound variable. The C++ preprocessor
           does not allow to concatenate non-alphanumeric tokens.
         </p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id881034" href="#id881034" class="para">16</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id881587" href="#id881587" class="para">16</a>] </sup>
               <span class="bold"><strong>Rationale.</strong></span> Using variadic macros,
               this extra set of parenthesis could be eliminated requiring only the
               parenthesis to invoke the <code class="computeroutput"><a class="link" href="../BOOST_IDENTITY_TYPE.html" title="Macro BOOST_IDENTITY_TYPE">BOOST_IDENTITY_TYPE</a></code>
               macro. However, this feature is currently not implemented and the double
               parenthesis are always needed when invoking this macro.
             </p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id882338" href="#id882338" class="para">17</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id882892" href="#id882892" class="para">17</a>] </sup>
           The authors recognize that the use of the <span class="emphasis"><em>identity macros</em></span>
           adds extra parenthesis to the already significant number of parenthesis
           required by the sequencing macro syntax. However, macro parameters usually
@@ -1944,14 +1964,14 @@
           (unless template metaprogramming is being used) so this is usually not
           a problem.
         </p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id907418" href="#id907418" class="para">18</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id908514" href="#id908514" class="para">18</a>] </sup>
           <span class="bold"><strong>Rationale.</strong></span> This is because a local function
           is a functor object declared as a local variable within the enclosing scope.
           Therefore, declaring two local functions with the same name within the
           same enclosing scope declares two local variables with the same name within
           the same scope and that is not allowed in C++.
         </p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id907762" href="#id907762" class="para">19</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id908857" href="#id908857" class="para">19</a>] </sup>
           <span class="bold"><strong>Rationale.</strong></span> This is the because a local
           function name must be a valid local variable name (the local variable to
           hold the local functor object) and operators cannot be used as local variable

Modified: sandbox/local/libs/local/doc/html/boost_local/Getting_Started.html
==============================================================================
--- sandbox/local/libs/local/doc/html/boost_local/Getting_Started.html (original)
+++ sandbox/local/libs/local/doc/html/boost_local/Getting_Started.html 2011-03-23 20:03:37 EDT (Wed, 23 Mar 2011)
@@ -120,7 +120,7 @@
 </pre>
 <p>
         The following symbols are part of the library private API, they are not documented,
- and they should not be directly used by programmers: <sup>[<a name="id866278" href="#ftn.id866278" class="footnote">2</a>]</sup>
+ and they should not be directly used by programmers: <sup>[<a name="id866311" href="#ftn.id866311" class="footnote">2</a>]</sup>
       </p>
 <div class="itemizedlist"><ul class="itemizedlist" type="disc">
 <li class="listitem">
@@ -160,7 +160,7 @@
 </div>
 <div class="footnotes">
 <br><hr width="100" align="left">
-<div class="footnote"><p><sup>[<a id="ftn.id866278" href="#id866278" class="para">2</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id866311" href="#id866311" class="para">2</a>] </sup>
           <span class="bold"><strong>Rationale.</strong></span> This library concatenates symbols
           specified by the programmers (e.g., the local function name) with other
           symbols (e.g., special prefixes or preprocessor line numbers) to make internal

Modified: sandbox/local/libs/local/doc/html/boost_local/Implementation.html
==============================================================================
--- sandbox/local/libs/local/doc/html/boost_local/Implementation.html (original)
+++ sandbox/local/libs/local/doc/html/boost_local/Implementation.html 2011-03-23 20:03:37 EDT (Wed, 23 Mar 2011)
@@ -28,12 +28,13 @@
 </h2></div></div></div>
 <div class="toc"><dl>
 <dt><span class="section">Local Functions</span></dt>
-<dt><span class="section"><a href="Implementation.html#boost_local.Implementation.local_blocks_and_exits">Local
- Blocks and Exits</a></span></dt>
+<dt><span class="section">Local Blocks</span></dt>
+<dt><span class="section">Local Exits</span></dt>
+<dt><span class="section">Parsing Macros</span></dt>
 </dl></div>
 <p>
       This section lists source code that should provide a general idea on how this
- library implements local functions.
+ library is implemented.
     </p>
 <p>
       The code listed here should only be used as a reference in trying to understand
@@ -47,7 +48,7 @@
 <a name="boost_local.Implementation.local_functions"></a><a class="link" href="Implementation.html#boost_local.Implementation.local_functions" title="Local Functions">Local Functions</a>
 </h3></div></div></div>
 <p>
- The expansion of the local function macros in the <code class="computeroutput"><span class="identifier">factorial</span></code>
+ The expansion of the local function macros of the <code class="computeroutput"><span class="identifier">factorial</span></code>
         example presented in the <a class="link" href="Advanced_Topics.html" title="Advanced Topics">Advanced
         Topics</a> section generates code equivalent to the following:
       </p>
@@ -59,101 +60,195 @@
 <span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">sstream</span><span class="special">&gt;</span>
 <span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">algorithm</span><span class="special">&gt;</span>
 <span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">vector</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">string</span><span class="special">&gt;</span>
 
-<span class="keyword">int</span> <span class="identifier">main</span> <span class="special">()</span> <span class="special">{</span>
+<span class="keyword">struct</span> <span class="identifier">calculator</span> <span class="special">{</span>
     <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostringstream</span> <span class="identifier">output</span><span class="special">;</span>
 
- <span class="keyword">int</span> <span class="comment">// The local function result type (just before the `BOOST_LOCAL_FUNCTION_PARAMS` macro).
-</span>
- <span class="comment">// *BEGIN* The macro
-</span> <span class="comment">// BOOST_LOCAL_FUNCTION_PARAMS( (int n) (bool recursion)(default false)
-</span> <span class="comment">// (bind&amp; output) )
-</span> <span class="comment">// expands (at line 18) to:
-</span>
- <span class="special">(*</span><span class="identifier">ERROR_missing_result_type_before_the_local_function_parameter_macro_id18</span><span class="special">)();</span>
- <span class="keyword">typedef</span> <span class="keyword">void</span> <span class="special">(*</span><span class="identifier">boost_local_auxXdeduce_result_tag18</span><span class="special">)(</span><span class="keyword">int</span> <span class="identifier">ERROR_missing_result_type_before_the_local_function_parameter_macro_id18</span><span class="special">);</span>
- <span class="keyword">typedef</span> <span class="identifier">BOOST_TYPEOF</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">scope_exit</span><span class="special">::</span><span class="identifier">aux</span><span class="special">::</span><span class="identifier">wrap</span><span class="special">(</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">scope_exit</span><span class="special">::</span><span class="identifier">aux</span><span class="special">::</span><span class="identifier">deref</span><span class="special">(</span> <span class="identifier">ERROR_missing_result_type_before_the_local_function_parameter_macro_id18</span><span class="special">,</span> <span class="special">(</span><span class="identifier">boost_local_auxXdeduce_result_tag18</span><span class="special">)</span><span class="number">0</span><span class="special">)))</span> <span class="identifier">boost_loc
al_auxXdeduce_result_wrap18</span><span class="special">;</span>
- <span class="keyword">typedef</span> <span class="identifier">boost_local_auxXdeduce_result_wrap18</span><span class="special">::</span><span class="identifier">type</span> <span class="identifier">boost_local_auxXdeduce_result_capture18</span><span class="special">;</span>
- <span class="keyword">struct</span> <span class="identifier">boost_local_auxXdeduce_result_params18</span> <span class="special">{</span>
- <span class="keyword">typedef</span> <span class="identifier">boost_local_auxXdeduce_result_capture18</span> <span class="identifier">function_ptr_type</span><span class="special">;</span>
- <span class="special">};</span>
-
- <span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">remove_pointer</span><span class="special">&lt;</span> <span class="identifier">boost_local_auxXdeduce_result_params18</span><span class="special">::</span><span class="identifier">function_ptr_type</span> <span class="special">&gt;::</span><span class="identifier">type</span> <span class="identifier">boost_local_auxXdeduce_result_function_type18</span><span class="special">;</span>
- <span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_traits</span><span class="special">&lt;</span> <span class="identifier">boost_local_auxXdeduce_result_function_type18</span><span class="special">&gt;::</span><span class="identifier">result_type</span> <span class="identifier">boost_local_auxXresult_type18</span><span class="special">;</span>
- <span class="keyword">typedef</span> <span class="keyword">void</span> <span class="special">(*</span><span class="identifier">boost_se_tag_0_18</span><span class="special">)(</span><span class="keyword">int</span> <span class="special">&amp;</span> <span class="identifier">output</span> <span class="special">);</span>
- <span class="keyword">typedef</span> <span class="identifier">BOOST_TYPEOF</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">scope_exit</span><span class="special">::</span><span class="identifier">aux</span><span class="special">::</span><span class="identifier">wrap</span><span class="special">(</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">scope_exit</span><span class="special">::</span><span class="identifier">aux</span><span class="special">::</span><span class="identifier">deref</span><span class="special">(&amp;</span> <span class="identifier">output</span><span class="special">,</span> <span class="special">(</span><span class="identifier">boost_se_tag_0_18</span><span class="special">)</span><span class="number">0</span><span class="special">)))</span> <span class="identifier">boost_se_wrapped_t_0_18</span><span class="special">;</span>
- <span class="keyword">typedef</span> <span class="identifier">boost_se_wrapped_t_0_18</span><span class="special">::</span><span class="identifier">type</span> <span class="identifier">boost_se_capture_t_0_18</span><span class="special">;</span>
- <span class="keyword">struct</span> <span class="identifier">boost_se_params_t_18</span> <span class="special">{</span>
- <span class="keyword">typedef</span> <span class="identifier">boost_se_capture_t_0_18</span> <span class="identifier">boost_se_param_t_0_18</span><span class="special">;</span>
- <span class="identifier">boost</span><span class="special">::</span><span class="identifier">scope_exit</span><span class="special">::</span><span class="identifier">aux</span><span class="special">::</span><span class="identifier">member</span><span class="special">&lt;</span> <span class="identifier">boost_se_param_t_0_18</span><span class="special">,</span> <span class="identifier">boost_se_tag_0_18</span> <span class="special">&gt;</span> <span class="identifier">boost_se_param_0_18</span><span class="special">;</span>
- <span class="special">}</span> <span class="identifier">boost_local_auxXparams18</span> <span class="special">=</span> <span class="special">{</span>
- <span class="special">{</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">scope_exit</span><span class="special">::</span><span class="identifier">aux</span><span class="special">::</span><span class="identifier">deref</span><span class="special">(&amp;</span> <span class="identifier">output</span><span class="special">,</span> <span class="special">(</span><span class="identifier">boost_se_tag_0_18</span><span class="special">)</span><span class="number">0</span><span class="special">)</span> <span class="special">}</span> <span class="comment">// This is for GCC but no extra curly parenthesis on MSVC.
-</span> <span class="special">};</span>
-
- <span class="identifier">boost</span><span class="special">::</span><span class="identifier">scope_exit</span><span class="special">::</span><span class="identifier">aux</span><span class="special">::</span><span class="identifier">declared</span><span class="special">&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">scope_exit</span><span class="special">::</span><span class="identifier">aux</span><span class="special">::</span><span class="identifier">resolve</span><span class="special">&lt;</span> <span class="keyword">sizeof</span><span class="special">(</span><span class="identifier">boost_local_auxXargs</span><span class="special">)</span> <span class="special">&gt;::</span><span class="identifier">cmp1</span><span class="special">&lt;</span><span class="number">0</span><span class="special">&gt;::</span><span class="identifier">cmp2</span> <span class="special">&gt;</span> <span class="identifier">boost_local_auxXargs</span><span class="speci
al">;</span>
- <span class="identifier">boost_local_auxXargs</span><span class="special">.</span><span class="identifier">value</span> <span class="special">=</span> <span class="special">&amp;</span><span class="identifier">boost_local_auxXparams18</span><span class="special">;</span>
-
- <span class="keyword">class</span> <span class="identifier">boost_local_auxXfunctor18</span> <span class="special">:</span> <span class="keyword">public</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">aux</span><span class="special">::</span><span class="identifier">abstract_function</span><span class="special">&lt;</span> <span class="identifier">boost_local_auxXresult_type18</span> <span class="special">(</span> <span class="keyword">int</span> <span class="identifier">n</span> <span class="special">,</span> <span class="keyword">bool</span> <span class="identifier">recursion</span> <span class="special">),</span> <span class="number">1</span> <span class="special">&gt;</span> <span class="special">{</span>
- <span class="keyword">typedef</span> <span class="identifier">boost_local_auxXresult_type18</span> <span class="special">(</span><span class="identifier">boost_local_auxXfunction_type</span><span class="special">)</span> <span class="special">(</span> <span class="keyword">int</span> <span class="identifier">n</span> <span class="special">,</span> <span class="keyword">bool</span> <span class="identifier">recursion</span> <span class="special">);</span>
- <span class="keyword">public</span><span class="special">:</span>
- <span class="keyword">explicit</span> <span class="identifier">boost_local_auxXfunctor18</span><span class="special">(</span> <span class="keyword">void</span><span class="special">*</span> <span class="identifier">binding_data</span><span class="special">)</span> <span class="special">:</span>
- <span class="identifier">boost_local_auxXbinds</span><span class="special">(</span><span class="keyword">static_cast</span><span class="special">&lt;</span> <span class="identifier">boost_se_params_t_18</span><span class="special">*&gt;(</span><span class="identifier">binding_data</span><span class="special">))</span> <span class="special">{</span>
- <span class="identifier">boost_local_auxXinit_recursion</span><span class="special">();</span>
- <span class="special">}</span>
-
- <span class="identifier">boost_local_auxXresult_type18</span> <span class="keyword">operator</span><span class="special">()(</span>
- <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_traits</span><span class="special">&lt;</span> <span class="identifier">boost_local_auxXfunction_type</span><span class="special">&gt;::</span><span class="identifier">arg1_type</span> <span class="identifier">arg1</span> <span class="special">,</span>
- <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_traits</span><span class="special">&lt;</span> <span class="identifier">boost_local_auxXfunction_type</span><span class="special">&gt;::</span><span class="identifier">arg2_type</span> <span class="identifier">arg2</span> <span class="special">)</span> <span class="special">{</span>
- <span class="keyword">return</span> <span class="identifier">boost_local_auxXbody</span><span class="special">(</span> <span class="identifier">boost_local_auxXbinds</span><span class="special">-&gt;</span> <span class="identifier">boost_se_param_0_18</span><span class="special">.</span><span class="identifier">value</span> <span class="special">,</span> <span class="identifier">arg1</span> <span class="special">,</span> <span class="identifier">arg2</span> <span class="special">);</span>
- <span class="special">}</span>
- <span class="identifier">boost_local_auxXresult_type18</span> <span class="keyword">operator</span><span class="special">()(</span>
- <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_traits</span><span class="special">&lt;</span> <span class="identifier">boost_local_auxXfunction_type</span><span class="special">&gt;::</span><span class="identifier">arg1_type</span> <span class="identifier">arg1</span> <span class="special">)</span> <span class="special">{</span>
- <span class="keyword">return</span> <span class="identifier">boost_local_auxXbody</span><span class="special">(</span> <span class="identifier">boost_local_auxXbinds</span><span class="special">-&gt;</span> <span class="identifier">boost_se_param_0_18</span><span class="special">.</span><span class="identifier">value</span> <span class="special">,</span> <span class="identifier">arg1</span> <span class="special">);</span>
- <span class="special">}</span>
-
- <span class="keyword">private</span><span class="special">:</span>
- <span class="identifier">boost</span><span class="special">::</span><span class="identifier">scope_exit</span><span class="special">::</span><span class="identifier">aux</span><span class="special">::</span><span class="identifier">undeclared</span> <span class="identifier">boost_local_auxXargs</span><span class="special">;</span>
- <span class="keyword">typedef</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">&lt;</span><span class="identifier">boost_local_auxXfunction_type</span><span class="special">,</span> <span class="number">1</span> <span class="special">&gt;</span> <span class="identifier">boost_local_auxXfunctor_type</span><span class="special">;</span>
- <span class="keyword">typedef</span> <span class="identifier">boost_se_params_t_18</span><span class="special">::</span> <span class="identifier">boost_se_param_t_0_18</span> <span class="special">&amp;</span> <span class="identifier">outputXboost_local_auxXtypeof_type</span> <span class="special">;</span>
- <span class="identifier">boost_se_params_t_18</span><span class="special">*</span> <span class="identifier">boost_local_auxXbinds</span><span class="special">;</span>
+ <span class="keyword">void</span> <span class="identifier">factorials</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">&gt;&amp;</span> <span class="identifier">nums</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">&amp;</span> <span class="identifier">separator</span> <span class="special">=</span> <span class="string">" "</span><span class="special">)</span> <span class="special">{</span>
 
- <span class="identifier">boost_local_auxXresult_type18</span> <span class="identifier">boost_local_auxXbody</span><span class="special">(</span> <span class="identifier">boost_se_params_t_18</span><span class="special">::</span> <span class="identifier">boost_se_param_t_0_18</span> <span class="special">&amp;</span> <span class="identifier">output</span> <span class="special">,</span> <span class="keyword">int</span> <span class="identifier">n</span> <span class="special">,</span> <span class="keyword">bool</span> <span class="identifier">recursion</span> <span class="special">=</span> <span class="keyword">false</span> <span class="special">)</span> <span class="keyword">const</span>
-
- <span class="comment">// *END* The expansion of `BOOST_LOCAL_FUNCTION_PARAMS` ends here.
+ <span class="keyword">int</span> <span class="comment">// The local function result type (just before the `BOOST_LOCAL_FUNCTION_PARAMS` macro).
 </span>
- <span class="comment">// *BEGIN* The local function body code `{ ... }` as specified by the programmers:
+ <span class="comment">// *BEGIN* The macro
+</span> <span class="comment">// BOOST_LOCAL_FUNCTION_PARAMS( (int n) (bool recursion)(default false)
+</span> <span class="comment">// (const bind&amp; separator) (bind this) )
+</span> <span class="comment">// expands (at line 21) to:
 </span>
- <span class="special">{</span>
- <span class="keyword">int</span> <span class="identifier">result</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
-
- <span class="keyword">if</span> <span class="special">(</span><span class="identifier">n</span> <span class="special">&lt;</span> <span class="number">2</span> <span class="special">)</span> <span class="identifier">result</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span>
- <span class="keyword">else</span> <span class="identifier">result</span> <span class="special">=</span> <span class="identifier">n</span> <span class="special">*</span> <span class="identifier">factorial</span><span class="special">(</span><span class="identifier">n</span> <span class="special">-</span> <span class="number">1</span><span class="special">,</span> <span class="keyword">true</span><span class="special">);</span> <span class="comment">// Recursive call.
+ <span class="comment">// DEDUCE RESULT TYPE
+</span> <span class="comment">// Long name `ERROR_...` gives meaningful compiler-error message if programmers forget result type before the macro.
+</span> <span class="special">(*</span><span class="identifier">ERROR_missing_result_type_before_the_local_function_parameter_macro_id21</span><span class="special">)();</span>
+ <span class="comment">// Use Boost.ScopeExit type deduction technique (tagging, wrapping, struct, etc) so to work on all compilers (specifically, some GCC version give internal errors otherwise).
+</span> <span class="keyword">typedef</span> <span class="keyword">void</span> <span class="special">(*</span><span class="identifier">boost_local_auxXdeduce_result_tag21</span><span class="special">)(</span><span class="keyword">int</span> <span class="identifier">ERROR_missing_result_type_before_the_local_function_parameter_macro_id21</span><span class="special">);</span>
+ <span class="keyword">typedef</span> <span class="identifier">BOOST_TYPEOF</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">scope_exit</span><span class="special">::</span><span class="identifier">aux</span><span class="special">::</span><span class="identifier">wrap</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">scope_exit</span><span class="special">::</span><span class="identifier">aux</span><span class="special">::</span><span class="identifier">deref</span><span class="special">(</span><span class="identifier">ERROR_missing_result_type_before_the_local_function_parameter_macro_id21</span><span class="special">,</span> <span class="special">(</span><span class="identifier">boost_local_auxXdeduce_result_tag21</span><span class="special">)</span><span class="number">0</span><span class="special">)))</span> <span class="identifier">boost_l
ocal_auxXdeduce_result_wrap21</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">boost_local_auxXdeduce_result_wrap21</span><span class="special">::</span><span class="identifier">type</span> <span class="identifier">boost_local_auxXdeduce_result_capture21</span><span class="special">;</span>
+ <span class="keyword">struct</span> <span class="identifier">boost_local_auxXdeduce_result_params21</span> <span class="special">{</span>
+ <span class="keyword">typedef</span> <span class="identifier">boost_local_auxXdeduce_result_capture21</span> <span class="identifier">function_ptr_type</span><span class="special">;</span>
+ <span class="special">};</span>
+ <span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">remove_pointer</span><span class="special">&lt;</span> <span class="identifier">boost_local_auxXdeduce_result_params21</span><span class="special">::</span><span class="identifier">function_ptr_type</span> <span class="special">&gt;::</span><span class="identifier">type</span> <span class="identifier">boost_local_auxXdeduce_result_function_type21</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_traits</span><span class="special">&lt;</span> <span class="identifier">boost_local_auxXdeduce_result_function_type21</span><span class="special">&gt;::</span><span class="identifier">result_type</span> <span class="identifier">boost_local_auxXresult_type21</span><span class="special">;</span>
+
+ <span class="comment">// HANDLE BOUND PARAMETERS
+</span> <span class="comment">// Deduce object `this` type (using technique from Boost.ScopeExit patch to support `this`).
+</span><span class="preprocessor">#if</span> <span class="identifier">BOOST_WORKAROUND</span><span class="special">(</span><span class="identifier">BOOST_MSVC</span><span class="special">,&gt;=</span><span class="number">1300</span><span class="special">)</span>
+ <span class="keyword">enum</span> <span class="special">{</span> <span class="identifier">boost_se_thistype_index_21</span> <span class="special">=</span> <span class="keyword">sizeof</span><span class="special">(*</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">scope_exit</span><span class="special">::</span><span class="identifier">msvc_typeof_this</span><span class="special">::</span><span class="identifier">encode_start</span><span class="special">(</span><span class="keyword">this</span><span class="special">))</span> <span class="special">};</span>
+ <span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">scope_exit</span><span class="special">::</span><span class="identifier">msvc_typeof_this</span><span class="special">::</span><span class="identifier">msvc_typeid_wrapper</span><span class="special">&lt;</span><span class="identifier">boost_se_thistype_index_21</span><span class="special">&gt;::</span><span class="identifier">type</span> <span class="identifier">se_this_type21</span><span class="special">;</span>
+<span class="preprocessor">#else</span>
+ <span class="keyword">typedef</span> <span class="identifier">BOOST_TYPEOF</span><span class="special">(</span><span class="keyword">this</span><span class="special">)</span> <span class="identifier">se_this_type21</span><span class="special">;</span>
+<span class="preprocessor">#endif</span>
+ <span class="comment">// Deduce other `&amp; separator` type (using Boost.ScopeExit technique).
+</span> <span class="keyword">typedef</span> <span class="keyword">void</span> <span class="special">(*</span><span class="identifier">boost_se_tag_0_21</span><span class="special">)(</span><span class="keyword">int</span> <span class="special">&amp;</span> <span class="identifier">separator</span><span class="special">);</span>
+ <span class="keyword">typedef</span> <span class="identifier">BOOST_TYPEOF</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">scope_exit</span><span class="special">::</span><span class="identifier">aux</span><span class="special">::</span><span class="identifier">wrap</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">scope_exit</span><span class="special">::</span><span class="identifier">aux</span><span class="special">::</span><span class="identifier">deref</span><span class="special">(&amp;</span> <span class="identifier">separator</span><span class="special">,</span> <span class="special">(</span><span class="identifier">boost_se_tag_0_21</span><span class="special">)</span><span class="number">0</span><span class="special">)))</span> <span class="identifier">boost_se_wrapped_t_0_21</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">boost_se_wrapped_t_0_21</span><span class="special">::</span><span class="identifier">type</span> <span class="identifier">boost_se_capture_t_0_21</span><span class="special">;</span>
+ <span class="comment">// Store bound parameter values and references.
+</span> <span class="keyword">struct</span> <span class="identifier">boost_se_params_t_21</span> <span class="special">{</span>
+ <span class="identifier">se_this_type21</span> <span class="identifier">se_this</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">boost_se_capture_t_0_21</span> <span class="identifier">boost_se_param_t_0_21</span><span class="special">;</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">scope_exit</span><span class="special">::</span><span class="identifier">aux</span><span class="special">::</span><span class="identifier">member</span><span class="special">&lt;</span><span class="identifier">boost_se_param_t_0_21</span><span class="special">,</span> <span class="identifier">boost_se_tag_0_21</span><span class="special">&gt;</span> <span class="identifier">boost_se_param_0_21</span><span class="special">;</span>
+ <span class="special">}</span> <span class="identifier">boost_local_auxXparams21</span> <span class="special">=</span> <span class="special">{</span>
+ <span class="keyword">this</span><span class="special">,</span>
+<span class="preprocessor">#ifdef</span> <span class="identifier">BOOST_SCOPE_EXIT_AUX_TPL_WORKAROUND</span>
+ <span class="special">{</span>
+<span class="preprocessor">#endif</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">scope_exit</span><span class="special">::</span><span class="identifier">aux</span><span class="special">::</span><span class="identifier">deref</span><span class="special">(&amp;</span> <span class="identifier">separator</span><span class="special">,</span> <span class="special">(</span><span class="identifier">boost_se_tag_0_21</span><span class="special">)</span><span class="number">0</span><span class="special">)</span>
+<span class="preprocessor">#ifdef</span> <span class="identifier">BOOST_SCOPE_EXIT_AUX_TPL_WORKAROUND</span>
+ <span class="special">}</span>
+<span class="preprocessor">#endif</span>
+ <span class="special">};</span>
+ <span class="comment">// Use variable name `...args` without line number to hold bound parameter values (so the same variable name can be used by the `NAME` macro even if it expands on a different line number).
+</span> <span class="comment">// The `declared&lt;&gt;` template makes sure that the variable `...args` is not declared multiple times in the same context (if the variable is already declared, this template expand to a no-operation).
+</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">scope_exit</span><span class="special">::</span><span class="identifier">aux</span><span class="special">::</span><span class="identifier">declared</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">scope_exit</span><span class="special">::</span><span class="identifier">aux</span><span class="special">::</span><span class="identifier">resolve</span><span class="special">&lt;</span><span class="keyword">sizeof</span><span class="special">(</span><span class="identifier">boost_local_auxXargs</span><span class="special">)&gt;::</span><span class="identifier">cmp1</span><span class="special">&lt;</span><span class="number">0</span><span class="special">&gt;::</span><span class="identifier">cmp2</span><span class="special">&gt;</span> <span class="identifier">boost_local_auxXargs</span><span class="special">;</span>
+ <span class="identifier">boost_local_auxXargs</span><span class="special">.</span><span class="identifier">value</span> <span class="special">=</span> <span class="special">&amp;</span><span class="identifier">boost_local_auxXparams21</span><span class="special">;</span>
+
+ <span class="comment">// LOCAL FUNCTOR
+</span> <span class="keyword">class</span> <span class="identifier">boost_local_auxXfunctor21</span><span class="special">:</span>
+ <span class="comment">// Base abstract class is used to later assign this local functor to `boost::local::function` so the local function can be passed as a template parameter (polymorphism ensures that the correct `operator()` as implemented by this class is called when this object is used as an `abstract_function` by `boost::local::function`).
+</span> <span class="keyword">public</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">aux</span><span class="special">::</span><span class="identifier">abstract_function</span><span class="special">&lt;</span><span class="identifier">boost_local_auxXresult_type21</span> <span class="special">(</span><span class="keyword">int</span> <span class="identifier">n</span><span class="special">,</span> <span class="keyword">bool</span> <span class="identifier">recursion</span><span class="special">),</span> <span class="number">1</span><span class="special">&gt;</span> <span class="special">{</span>
+ <span class="keyword">typedef</span> <span class="identifier">boost_local_auxXresult_type21</span> <span class="special">(</span><span class="identifier">boost_local_auxXfunction_type</span><span class="special">)(</span><span class="keyword">int</span> <span class="identifier">n</span> <span class="special">,</span> <span class="keyword">bool</span> <span class="identifier">recursion</span><span class="special">);</span>
+ <span class="keyword">public</span><span class="special">:</span>
+ <span class="comment">// Take a generic pointer so it can be invoked by the `NAME` macro even if it expands on a different line number.
+</span> <span class="keyword">explicit</span> <span class="identifier">boost_local_auxXfunctor21</span><span class="special">(</span><span class="keyword">void</span><span class="special">*</span> <span class="identifier">binding_data</span><span class="special">):</span>
+ <span class="identifier">boost_local_auxXbinds</span><span class="special">(</span><span class="keyword">static_cast</span><span class="special">&lt;</span><span class="identifier">boost_se_params_t_21</span><span class="special">*&gt;(</span><span class="identifier">binding_data</span><span class="special">))</span> <span class="special">{</span>
+ <span class="identifier">boost_local_auxXinit_recursion</span><span class="special">();</span>
+ <span class="special">}</span>
+
+ <span class="comment">// Implement `operator()` for all parameters and any combination of default parameter.
+</span> <span class="identifier">boost_local_auxXresult_type21</span> <span class="keyword">operator</span><span class="special">()(</span>
+ <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_traits</span><span class="special">&lt;</span><span class="identifier">boost_local_auxXfunction_type</span><span class="special">&gt;::</span><span class="identifier">arg1_type</span> <span class="identifier">arg1</span><span class="special">,</span>
+ <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_traits</span><span class="special">&lt;</span><span class="identifier">boost_local_auxXfunction_type</span><span class="special">&gt;::</span><span class="identifier">arg2_type</span> <span class="identifier">arg2</span><span class="special">)</span> <span class="special">{</span>
+ <span class="comment">// Actual parameter names are not known to the macro syntax separately from their types so generic names `arg...` must be used (and therefore the parameter types are extracted from the function type).
+</span> <span class="keyword">return</span> <span class="identifier">boost_local_auxXbody</span><span class="special">(</span><span class="identifier">boost_local_auxXbinds</span><span class="special">-&gt;</span><span class="identifier">boost_se_param_0_21</span><span class="special">.</span><span class="identifier">value</span><span class="special">,</span> <span class="identifier">boost_local_auxXbinds</span><span class="special">-&gt;</span><span class="identifier">se_this</span><span class="special">,</span> <span class="identifier">arg1</span><span class="special">,</span> <span class="identifier">arg2</span><span class="special">);</span>
+ <span class="special">}</span>
+ <span class="identifier">boost_local_auxXresult_type21</span> <span class="keyword">operator</span><span class="special">()(</span>
+ <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_traits</span><span class="special">&lt;</span><span class="identifier">boost_local_auxXfunction_type</span><span class="special">&gt;::</span><span class="identifier">arg1_type</span> <span class="identifier">arg1</span><span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">boost_local_auxXbody</span><span class="special">(</span><span class="identifier">boost_local_auxXbinds</span><span class="special">-&gt;</span><span class="identifier">boost_se_param_0_21</span><span class="special">.</span><span class="identifier">value</span><span class="special">,</span> <span class="identifier">boost_local_auxXbinds</span><span class="special">-&gt;</span><span class="identifier">se_this</span><span class="special">,</span> <span class="identifier">arg1</span><span class="special">);</span>
+ <span class="special">}</span>
+
+ <span class="keyword">private</span><span class="special">:</span>
+ <span class="comment">// Local function functor type (for a later declaration).
+</span> <span class="keyword">typedef</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">&lt;</span><span class="identifier">boost_local_auxXfunction_type</span><span class="special">,</span> <span class="number">1</span><span class="special">&gt;</span> <span class="identifier">boost_local_auxXfunctor_type</span><span class="special">;</span>
+ <span class="comment">// Define the deduced types for using `BOOST_LOCAL_TYPEOF` from within the local function body (the `&amp;` is kept because the bound parameter name is not known to the macro syntax separately from the reference qualifier).
+</span> <span class="keyword">typedef</span> <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">add_const</span><span class="special">&lt;</span> <span class="identifier">boost_se_params_t_21</span><span class="special">::</span> <span class="identifier">boost_se_param_t_0_21</span> <span class="special">&gt;::</span><span class="identifier">type</span> <span class="special">&amp;</span> <span class="identifier">separatorXboost_local_auxXtypeof_type</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">se_this_type21</span> <span class="identifier">thisXboost_local_auxXtypeof_type</span><span class="special">;</span>
+ <span class="comment">// Hold bound parameters values and references.
+</span> <span class="identifier">boost_se_params_t_21</span><span class="special">*</span> <span class="identifier">boost_local_auxXbinds</span><span class="special">;</span>
+ <span class="comment">// This same declaration is first made at global scope in one of the library header files. This declaration needs to be repeated here so it is also visible from within the local function body to allow for nesting local function into one another.
+</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">scope_exit</span><span class="special">::</span><span class="identifier">aux</span><span class="special">::</span><span class="identifier">undeclared</span> <span class="identifier">boost_local_auxXargs</span><span class="special">;</span>
+
+ <span class="comment">// The local function body. The body function cannot be static because is needs to access the member variable with the local function name to support recursion (and local classes cannot have static member variable) but unfortunately this implies that `this` can be misused within the body instead of `this_` without necessarily generating a compile-time error.
+</span> <span class="identifier">boost_local_auxXresult_type21</span> <span class="identifier">boost_local_auxXbody</span><span class="special">(</span>
+ <span class="comment">// Use special name `this_` instead of `this` here.
+</span> <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">add_const</span><span class="special">&lt;</span><span class="identifier">boost_se_params_t_21</span><span class="special">::</span><span class="identifier">boost_se_param_t_0_21</span><span class="special">&gt;::</span><span class="identifier">type</span> <span class="special">&amp;</span> <span class="identifier">separator</span><span class="special">,</span> <span class="identifier">se_this_type21</span> <span class="identifier">this_</span><span class="special">,</span>
+ <span class="comment">// Specify default parameter values here.
+</span> <span class="keyword">int</span> <span class="identifier">n</span><span class="special">,</span> <span class="keyword">bool</span> <span class="identifier">recursion</span> <span class="special">=</span> <span class="keyword">false</span><span class="special">)</span> <span class="keyword">const</span>
+
+ <span class="comment">// *END* The expansion of `BOOST_LOCAL_FUNCTION_PARAMS` ends here.
 </span>
- <span class="keyword">if</span> <span class="special">(!</span><span class="identifier">recursion</span><span class="special">)</span> <span class="identifier">output</span> <span class="special">&lt;&lt;</span> <span class="identifier">result</span> <span class="special">&lt;&lt;</span> <span class="string">" "</span><span class="special">;</span>
- <span class="keyword">return</span> <span class="identifier">result</span><span class="special">;</span>
- <span class="special">}</span>
+ <span class="comment">// *BEGIN* The local function body code `{ ... }` as specified by the programmers:
+</span>
+ <span class="special">{</span>
+ <span class="keyword">int</span> <span class="identifier">result</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
 
- <span class="comment">// *END* The local function body `{ ... }` ends here.
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">n</span> <span class="special">&lt;</span> <span class="number">2</span> <span class="special">)</span> <span class="identifier">result</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span>
+ <span class="keyword">else</span> <span class="identifier">result</span> <span class="special">=</span> <span class="identifier">n</span> <span class="special">*</span> <span class="identifier">factorial</span><span class="special">(</span><span class="identifier">n</span> <span class="special">-</span> <span class="number">1</span><span class="special">,</span> <span class="keyword">true</span><span class="special">);</span> <span class="comment">// Recursive call.
+</span>
+ <span class="keyword">if</span> <span class="special">(!</span><span class="identifier">recursion</span><span class="special">)</span> <span class="identifier">this_</span><span class="special">-&gt;</span><span class="identifier">output</span> <span class="special">&lt;&lt;</span> <span class="identifier">result</span> <span class="special">&lt;&lt;</span> <span class="identifier">separator</span><span class="special">;</span>
+ <span class="keyword">return</span> <span class="identifier">result</span><span class="special">;</span>
+ <span class="special">}</span>
+
+ <span class="comment">// *END* The local function body `{ ... }` ends here.
 </span>
- <span class="comment">// *BEGIN* The macro `BOOST_LOCAL_FUNCTION_NAME(factorial)` expands to:
+ <span class="comment">// *BEGIN* The macro `BOOST_LOCAL_FUNCTION_NAME(factorial)` expands to:
 </span>
- <span class="keyword">public</span><span class="special">:</span>
- <span class="identifier">boost_local_auxXfunctor_type</span> <span class="identifier">factorial</span><span class="special">;</span>
+ <span class="keyword">public</span><span class="special">:</span>
+ <span class="comment">// Member variable named after the local function so the body can recursively call the local function (this must be defined here because the local function name was not known before). This must be public because it is also used to deduce the local function functor type later when when declaring the actual local function object.
+</span> <span class="identifier">boost_local_auxXfunctor_type</span> <span class="identifier">factorial</span><span class="special">;</span>
+ <span class="keyword">private</span><span class="special">:</span>
+ <span class="comment">// Initializes the local functor member variable (this cannot be done directly within the constructor because the local function name is not known when the constructor code is expanded by the `PARAMS` macro).
+</span> <span class="keyword">void</span> <span class="identifier">boost_local_auxXinit_recursion</span><span class="special">()</span> <span class="special">{</span>
+ <span class="identifier">factorial</span> <span class="special">=</span> <span class="special">*</span><span class="keyword">this</span><span class="special">;</span>
+ <span class="special">}</span>
+ <span class="comment">// Declare the local class object -- which cannot be passed as template parameter (because it is a local class). It uses the variable with the generic `...args` name to pass the bound parameter values and references (so this variable name must not contain the line number because it is used by different macros expanding on different lines).
+</span> <span class="special">}</span> <span class="identifier">boost_local_auxXfunctorXfactorial</span><span class="special">(</span><span class="identifier">boost_local_auxXargs</span><span class="special">.</span><span class="identifier">value</span><span class="special">);</span>
+ <span class="comment">// Declare the actual local function object with the local function name -- which can be passed as template parameter (because it is a `boost::local::function` functor and not a local class).
+</span> <span class="identifier">BOOST_TYPEOF</span><span class="special">(</span><span class="identifier">boost_local_auxXfunctorXfactorial</span><span class="special">.</span><span class="identifier">factorial</span><span class="special">)</span> <span class="keyword">const</span> <span class="identifier">factorial</span><span class="special">(</span><span class="identifier">boost_local_auxXfunctorXfactorial</span><span class="special">);</span>
 
- <span class="keyword">private</span><span class="special">:</span>
- <span class="keyword">void</span> <span class="identifier">boost_local_auxXinit_recursion</span><span class="special">()</span> <span class="special">{</span>
- <span class="identifier">factorial</span> <span class="special">=</span> <span class="special">*</span><span class="keyword">this</span><span class="special">;</span>
- <span class="special">}</span>
- <span class="special">}</span> <span class="identifier">boost_local_auxXfunctorXfactorial</span><span class="special">(</span><span class="identifier">boost_local_auxXargs</span><span class="special">.</span><span class="identifier">value</span><span class="special">);</span>
- <span class="identifier">BOOST_TYPEOF</span><span class="special">(</span><span class="identifier">boost_local_auxXfunctorXfactorial</span><span class="special">.</span><span class="identifier">factorial</span><span class="special">)</span> <span class="keyword">const</span> <span class="identifier">factorial</span><span class="special">(</span><span class="identifier">boost_local_auxXfunctorXfactorial</span><span class="special">);</span>
+ <span class="comment">// *END* The expansion of `BOOST_LOCAL_FUNCTION_NAME` ends here.
+</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">begin</span><span class="special">(),</span> <span class="identifier">nums</span><span class="special">.</span><span class="identifier">end</span><span class="special">(),</span> <span class="identifier">factorial</span><span class="special">);</span>
+ <span class="special">}</span>
+<span class="special">};</span>
 
- <span class="comment">// *END* The expansion of `BOOST_LOCAL_FUNCTION_NAME` ends here.
-</span>
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span> <span class="special">{</span>
     <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">&gt;</span> <span class="identifier">v</span><span class="special">(</span><span class="number">3</span><span class="special">);</span>
     <span class="identifier">v</span><span class="special">[</span><span class="number">0</span><span class="special">]</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> <span class="identifier">v</span><span class="special">[</span><span class="number">1</span><span class="special">]</span> <span class="special">=</span> <span class="number">4</span><span class="special">;</span> <span class="identifier">v</span><span class="special">[</span><span class="number">2</span><span class="special">]</span> <span class="special">=</span> <span class="number">7</span><span class="special">;</span>
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">for_each</span><span class="special">(</span><span class="identifier">v</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">end</span><span class="special">(),</span> <span class="identifier">factorial</span><span class="special">);</span>
 
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">output</span><span class="special">.</span><span class="identifier">str</span><span class="special">()</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="identifier">calculator</span> <span class="identifier">calc</span><span class="special">;</span>
+ <span class="identifier">calc</span><span class="special">.</span><span class="identifier">factorials</span><span class="special">(</span><span class="identifier">v</span><span class="special">);</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">calc</span><span class="special">.</span><span class="identifier">output</span><span class="special">.</span><span class="identifier">str</span><span class="special">()</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+
+ <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_local.Implementation.local_blocks"></a><a class="link" href="Implementation.html#boost_local.Implementation.local_blocks" title="Local Blocks">Local Blocks</a>
+</h3></div></div></div>
+<p>
+ The expansion of the local block macros for the main local block example
+ presented in the <a class="link" href="Tutorial.html" title="Tutorial">Tutorial</a> section
+ generates code equivalent to the following:
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</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">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">iostream</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">cassert</span><span class="special">&gt;</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">1975.0</span><span class="special">;</span>
+
+ <span class="comment">// The macro `BOOST_LOCAL_BLOCK( (const bind&amp; sum) )` expands to:
+</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">const</span> <span class="identifier">bind</span><span class="special">&amp;</span> <span class="identifier">sum</span><span class="special">)</span> <span class="special">)</span>
+
+ <span class="comment">// Local block body.
+</span> <span class="special">{</span>
+ <span class="identifier">assert</span><span class="special">(</span><span class="identifier">sum</span> <span class="special">==</span> <span class="number">1975.0</span><span class="special">);</span> <span class="comment">// OK: Complier error if `==` confused with `=`.
+</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">clog</span> <span class="special">&lt;&lt;</span> <span class="string">"Asserted summation: "</span> <span class="special">&lt;&lt;</span> <span class="identifier">sum</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+
+ <span class="keyword">return</span><span class="special">;</span> <span class="comment">// Return this local block (and not the enclosing scope).
+</span> <span class="identifier">assert</span><span class="special">(</span><span class="keyword">false</span><span class="special">);</span> <span class="comment">// OK: Never executed.
+</span> <span class="special">}</span>
+
+ <span class="comment">// The macro `BOOST_LOCAL_BLOCK_END` expands to (at line 21):
+</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">boost_local_auxXblock_function21</span><span class="special">)</span>
+ <span class="comment">// This local function call executes the local block body code.
+</span> <span class="identifier">boost_local_auxXblock_function21</span><span class="special">();</span>
+
     <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
 <span class="special">}</span>
 </pre>
@@ -162,14 +257,84 @@
 </div>
 <div class="section">
 <div class="titlepage"><div><div><h3 class="title">
-<a name="boost_local.Implementation.local_blocks_and_exits"></a><a class="link" href="Implementation.html#boost_local.Implementation.local_blocks_and_exits" title="Local Blocks and Exits">Local
- Blocks and Exits</a>
+<a name="boost_local.Implementation.local_exits"></a><a class="link" href="Implementation.html#boost_local.Implementation.local_exits" title="Local Exits">Local Exits</a>
 </h3></div></div></div>
 <p>
- Local blocks and local exits are trivially implemented by this library reusing
- local functions. Local block and local exit implementation code should be
- obvious from the library source files so it is not listed here.
+ The expansion of the local exit macros for the main local exit example presented
+ in the <a class="link" href="Tutorial.html" title="Tutorial">Tutorial</a> section generates
+ code equivalent to the following:
       </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</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">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">iostream</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">cassert</span><span class="special">&gt;</span>
+
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</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="comment">// The macro `BOOST_LOCAL_EXIT( (const bind&amp; size) (bind nums) )` expands to:
+</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">const</span> <span class="identifier">bind</span><span class="special">&amp;</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="comment">// Local exit body.
+</span> <span class="special">{</span>
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">size</span> <span class="special">&amp;&amp;</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="identifier">std</span><span class="special">::</span><span class="identifier">clog</span> <span class="special">&lt;&lt;</span> <span class="string">"Freed array: "</span> <span class="special">&lt;&lt;</span> <span class="identifier">nums</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+
+ <span class="keyword">return</span><span class="special">;</span> <span class="comment">// Return this local exit (and not the enclosing scope).
+</span> <span class="identifier">assert</span><span class="special">(</span><span class="keyword">false</span><span class="special">);</span> <span class="comment">// OK: Never executed.
+</span> <span class="special">}</span>
+
+ <span class="comment">// The macro `BOOST_LOCAL_EXIT_END` expands to (at line 22):
+</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">boost_local_auxXexitXfunction22</span><span class="special">)</span>
+ <span class="comment">// When this object goes out of scope, its destructor calls the specified
+</span> <span class="comment">// local function which in turn executes the local exit body code.
+</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">aux</span><span class="special">::</span><span class="identifier">exit_guard</span> <span class="identifier">boost_local_auxXexitXguard22</span><span class="special">(</span>
+ <span class="identifier">boost_local_auxXexitXfunction22</span><span class="special">);</span>
+
+ <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_local.Implementation.parsing_macros"></a><a class="link" href="Implementation.html#boost_local.Implementation.parsing_macros" title="Parsing Macros">Parsing Macros</a>
+</h3></div></div></div>
+<p>
+ This library macros can parse the list of specified parameters and detect
+ if any of the bound parameter name matches the token <code class="computeroutput"><span class="keyword">this</span></code>
+ (to generate special code to bind the object in scope), or if the parameter
+ is bound by <code class="computeroutput"><span class="keyword">const</span></code> (to generate
+ special code to bind by constant), etc. The parameter tokens are inspected
+ by preprocessor metaprogramming using both Boost.Preprocessor
+ and the <code class="computeroutput"><span class="identifier">BOOST_DETAIL_PP_KEYWORD_</span><span class="special">...</span></code> macros that in brief work as follow:
+ </p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">detail</span><span class="special">/</span><span class="identifier">preprocessor</span><span class="special">/</span><span class="identifier">keyword</span><span class="special">/</span><span class="keyword">this</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">detail</span><span class="special">/</span><span class="identifier">preprocessor</span><span class="special">/</span><span class="identifier">keyword</span><span class="special">/</span><span class="keyword">const</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">locla</span><span class="special">/</span><span class="identifier">aux_</span><span class="special">/</span><span class="identifier">preprocessor</span><span class="special">/</span><span class="identifier">keyword</span><span class="special">/</span><span class="identifier">bind</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+
+<span class="comment">// Detect `this`.
+</span><span class="identifier">BOOST_DETAIL_PP_KEYWORD_IS_THIS_BACK</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">bind</span> <span class="keyword">this</span><span class="special">)</span> <span class="comment">// Expand to 1.
+</span><span class="identifier">BOOST_DETAIL_PP_KEYWORD_IS_THIS_BACK</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">bind</span><span class="special">&amp;</span> <span class="identifier">x</span><span class="special">)</span> <span class="comment">// Expand to 0.
+</span>
+<span class="comment">// Detect constant.
+</span><span class="identifier">BOOST_DETAIL_PP_KEYWORD_IS_CONST_FRONT</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">bind</span> <span class="keyword">this</span><span class="special">)</span> <span class="comment">// Expand to 1.
+</span><span class="identifier">BOOST_DETAIL_PP_KEYWORD_IS_CONST_FRONT</span><span class="special">(</span><span class="identifier">bind</span> <span class="keyword">this</span><span class="special">)</span> <span class="comment">// Expand to 0.
+</span>
+<span class="comment">// Detect binding (constant and not).
+</span><span class="identifier">BOOST_LOCAL_AUX_PP_KEYWORD_IS_BIND_FRONT</span><span class="special">(</span> <span class="comment">// Expand to 1.
+</span> <span class="identifier">BOOST_DETAIL_PP_KEYWORD_CONST_REMOVE_FRONT</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">bind</span> <span class="keyword">this</span><span class="special">))</span>
+<span class="identifier">BOOST_LOCAL_AUX_PP_KEYWORD_IS_BIND_FRONT</span><span class="special">(</span> <span class="comment">// Also expand to 1.
+</span> <span class="identifier">BOOST_DETAIL_PP_KEYWORD_CONST_REMOVE_FRONT</span><span class="special">(</span><span class="identifier">bind</span> <span class="keyword">this</span><span class="special">))</span>
+<span class="identifier">BOOST_LOCAL_AUX_PP_KEYWORD_IS_BIND_FRONT</span><span class="special">(</span> <span class="comment">// Expand to 0.
+</span> <span class="identifier">BOOST_DETAIL_PP_KEYWORD_CONST_REMOVE_FRONT</span><span class="special">(</span><span class="keyword">const</span> <span class="keyword">int</span> <span class="identifier">x</span><span class="special">))</span>
+<span class="identifier">BOOST_LOCAL_AUX_PP_KEYWORD_IS_BIND_FRONT</span><span class="special">(</span> <span class="comment">// Also expand to 0.
+</span> <span class="identifier">BOOST_DETAIL_PP_KEYWORD_CONST_REMOVE_FRONT</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">x</span><span class="special">))</span>
+</pre>
 </div>
 </div>
 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>

Modified: sandbox/local/libs/local/doc/html/boost_local/Tutorial.html
==============================================================================
--- sandbox/local/libs/local/doc/html/boost_local/Tutorial.html (original)
+++ sandbox/local/libs/local/doc/html/boost_local/Tutorial.html 2011-03-23 20:03:37 EDT (Wed, 23 Mar 2011)
@@ -115,12 +115,12 @@
         <span class="special">...</span> <span class="special">}</span></code>
         using the usual C++ syntax. The body is specified outside any of the macros
         so eventual compiler error messages and line numbers retain their usual meaning.
- <sup>[<a name="id866968" href="#ftn.id866968" class="footnote">3</a>]</sup>
+ <sup>[<a name="id867002" href="#ftn.id867002" class="footnote">3</a>]</sup>
       </p>
 <p>
         The macro <code class="computeroutput"><a class="link" href="../BOOST_LOCAL_FUNCTION_NAME.html" title="Macro BOOST_LOCAL_FUNCTION_NAME">BOOST_LOCAL_FUNCTION_NAME</a></code>
         is used to end the local function definition and to specify the local function
- name. <sup>[<a name="id867004" href="#ftn.id867004" class="footnote">4</a>]</sup>
+ name. <sup>[<a name="id867038" href="#ftn.id867038" class="footnote">4</a>]</sup>
       </p>
 <p>
         For example, let's program a local function named <code class="computeroutput"><span class="identifier">add</span></code>
@@ -366,7 +366,7 @@
         This library also allows to specify default values for the local function
         parameters. However, the usual C++ syntax for default parameters that uses
         the assignment symbol <code class="computeroutput"><span class="special">=</span></code> cannot
- be used. <sup>[<a name="id868926" href="#ftn.id868926" class="footnote">5</a>]</sup> The keyword <code class="computeroutput"><span class="keyword">default</span></code>
+ be used. <sup>[<a name="id868960" href="#ftn.id868960" class="footnote">5</a>]</sup> The keyword <code class="computeroutput"><span class="keyword">default</span></code>
         is used instead:
       </p>
 <div class="informaltable"><table class="table">
@@ -508,7 +508,7 @@
         variables, the object <code class="computeroutput"><span class="keyword">this</span></code>,
         etc) can be bound to a local function declaration. The types of bound variables
         are automatically deduced by this library using Boost.Typeof.
- <sup>[<a name="id870150" href="#ftn.id870150" class="footnote">6</a>]</sup>
+ <sup>[<a name="id870184" href="#ftn.id870184" class="footnote">6</a>]</sup>
       </p>
 <div class="important"><table border="0" summary="Important">
 <tr>
@@ -525,7 +525,7 @@
 </table></div>
 <p>
         This library introduces the new "keyword" <code class="computeroutput"><span class="identifier">bind</span></code>
- <sup>[<a name="id870238" href="#ftn.id870238" class="footnote">7</a>]</sup> which is used in place of the parameter type to specify the name
+ <sup>[<a name="id870272" href="#ftn.id870272" class="footnote">7</a>]</sup> which is used in place of the parameter type to specify the name
         of a variable in scope to bind. The variable can be bound by value:
       </p>
 <pre class="programlisting"><span class="identifier">bind</span> <span class="emphasis"><em>variable-name</em></span> <span class="comment">// Bind by value.
@@ -566,7 +566,7 @@
         unless constant binding is forced using <code class="computeroutput"><span class="keyword">const</span>
         <span class="identifier">bind</span> <span class="special">...</span></code>
         (note that binding by constant reference is not supported by <a href="http://en.wikipedia.org/wiki/C%2B%2B0x#Lambda_functions_and_expressions" target="_top">C++0x
- lambda</a> functions). <sup>[<a name="id870493" href="#ftn.id870493" class="footnote">8</a>]</sup> Programmers might want to bind variables of complex types by
+ lambda</a> functions). <sup>[<a name="id870527" href="#ftn.id870527" class="footnote">8</a>]</sup> Programmers might want to bind variables of complex types by
         (constant) reference instead than by value to avoid expensive copy operations
         when these variables are automatically passed to the local function (as usual
         with C++ function parameter passing).
@@ -609,7 +609,7 @@
         ]
       </p>
 <a name="boost_local.Tutorial.Binding.binding_the_object__code__phrase_role__keyword__this__phrase___code_"></a><h6>
-<a name="id870685"></a>
+<a name="id870718"></a>
         <a class="link" href="Tutorial.html#boost_local.Tutorial.Binding.binding_the_object__code__phrase_role__keyword__this__phrase___code_">Binding
         the Object <code class="computeroutput"><span class="keyword">this</span></code></a>
       </h6>
@@ -663,12 +663,12 @@
           to a local function, the local function <span class="bold"><strong>body must
           use the special symbol</strong></span> <code class="computeroutput"><span class="identifier">this_</span></code>
           (instead of <code class="computeroutput"><span class="keyword">this</span></code>) to access
- the bound object. <sup>[<a name="id871003" href="#ftn.id871003" class="footnote">9</a>]</sup>
+ the bound object. <sup>[<a name="id871037" href="#ftn.id871037" class="footnote">9</a>]</sup>
         </p>
 <p>
           Unfortunately, mistakenly using <code class="computeroutput"><span class="keyword">this</span></code>
           within the local function body instead of <code class="computeroutput"><span class="identifier">this_</span></code>
- will not necessarily generate a compile-time error. <sup>[<a name="id871097" href="#ftn.id871097" class="footnote">10</a>]</sup> Programmers are responsible to make sure that <code class="computeroutput"><span class="keyword">this</span></code> is never used within a local function
+ will not necessarily generate a compile-time error. <sup>[<a name="id871131" href="#ftn.id871131" class="footnote">10</a>]</sup> Programmers are responsible to make sure that <code class="computeroutput"><span class="keyword">this</span></code> is never used within a local function
           body which should only use the special symbol <code class="computeroutput"><span class="identifier">this_</span></code>.
         </p>
 </td></tr>
@@ -702,6 +702,8 @@
                   
 </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">&lt;</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">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</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">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</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">&gt;</span>
 <span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">vector</span><span class="special">&gt;</span>
 <span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">algorithm</span><span class="special">&gt;</span>
 <span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">iostream</span><span class="special">&gt;</span>
@@ -715,9 +717,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="keyword">this</span><span class="special">)</span> <span class="special">{</span>
             <span class="identifier">this_</span><span class="special">-&gt;</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="comment">// Use `this_` instead of `this`.
-</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">clog</span> <span class="special">&lt;&lt;</span> <span class="string">"Summed: "</span> <span class="special">&lt;&lt;</span> <span class="identifier">this_</span><span class="special">-&gt;</span><span class="identifier">sum_</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"Summed: "</span> <span class="special">&lt;&lt;</span> <span class="identifier">this_</span><span class="special">-&gt;</span><span class="identifier">sum_</span> <span class="special">&lt;&lt;</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">add</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="keyword">this</span><span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"Exiting: "</span> <span class="special">&lt;&lt;</span> <span class="identifier">this_</span><span class="special">-&gt;</span><span class="identifier">sum_</span> <span class="special">&lt;&lt;</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_EXIT_END</span>
+
+ <span class="identifier">BOOST_LOCAL_BLOCK</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">bind</span> <span class="keyword">this</span><span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"Asserted: "</span> <span class="special">&lt;&lt;</span> <span class="identifier">this_</span><span class="special">-&gt;</span><span class="identifier">sum_</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="identifier">assert</span><span class="special">(</span><span class="identifier">this_</span><span class="special">-&gt;</span><span class="identifier">sum_</span> <span class="special">&gt;</span> <span class="number">0.0</span><span class="special">);</span>
+ <span class="special">}</span> <span class="identifier">BOOST_LOCAL_BLOCK_END</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">begin</span><span class="special">(),</span> <span class="identifier">nums</span><span class="special">.</span><span class="identifier">end</span><span class="special">(),</span> <span class="identifier">add</span><span class="special">);</span>
         <span class="keyword">return</span> <span class="identifier">sum_</span><span class="special">;</span>
     <span class="special">}</span>
@@ -745,6 +756,8 @@
                   
 </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">&lt;</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">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</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">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</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">&gt;</span>
 <span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">vector</span><span class="special">&gt;</span>
 <span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">algorithm</span><span class="special">&gt;</span>
 <span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">iostream</span><span class="special">&gt;</span>
@@ -758,15 +771,15 @@
         <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="keyword">this</span><span class="special">)</span> <span class="special">)</span> <span class="special">{</span>
             <span class="identifier">this_</span><span class="special">-&gt;</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="comment">// Use `this_` instead of `this`.
-</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">clog</span> <span class="special">&lt;&lt;</span> <span class="string">"Summed: "</span> <span class="special">&lt;&lt;</span> <span class="identifier">this_</span><span class="special">-&gt;</span><span class="identifier">sum_</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"Summed: "</span> <span class="special">&lt;&lt;</span> <span class="identifier">this_</span><span class="special">-&gt;</span><span class="identifier">sum_</span> <span class="special">&lt;&lt;</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">add</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="keyword">this</span><span class="special">)</span> <span class="special">)</span> <span class="special">{</span>
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">clog</span> <span class="special">&lt;&lt;</span> <span class="string">"Exiting: "</span> <span class="special">&lt;&lt;</span> <span class="identifier">this_</span><span class="special">-&gt;</span><span class="identifier">sum_</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"Exiting: "</span> <span class="special">&lt;&lt;</span> <span class="identifier">this_</span><span class="special">-&gt;</span><span class="identifier">sum_</span> <span class="special">&lt;&lt;</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_EXIT_END</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="keyword">this</span><span class="special">)</span> <span class="special">)</span> <span class="special">{</span>
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">clong</span> <span class="special">&lt;&lt;</span> <span class="string">"Asserted: "</span> <span class="special">&lt;&lt;</span> <span class="identifier">this_</span><span class="special">-&gt;</span><span class="identifier">sum_</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"Asserted: "</span> <span class="special">&lt;&lt;</span> <span class="identifier">this_</span><span class="special">-&gt;</span><span class="identifier">sum_</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
             <span class="identifier">assert</span><span class="special">(</span><span class="identifier">this_</span><span class="special">-&gt;</span><span class="identifier">sum_</span> <span class="special">&gt;</span> <span class="number">0.0</span><span class="special">);</span>
         <span class="special">}</span> <span class="identifier">BOOST_LOCAL_BLOCK_END</span>
 
@@ -838,7 +851,7 @@
           A <code class="computeroutput"><span class="keyword">return</span><span class="special">;</span></code>
           instruction from within a local block jumps to the end of the local block
           body and <span class="bold"><strong>it does not return the enclosing function</strong></span>.
- <sup>[<a name="id873804" href="#ftn.id873804" class="footnote">11</a>]</sup>
+ <sup>[<a name="id874354" href="#ftn.id874354" class="footnote">11</a>]</sup>
         </p></td></tr>
 </table></div>
 <p>
@@ -941,7 +954,7 @@
         If multiple local exits are declared within the same scope, their bodies
         will be executed in the reverse order in which they have been declared. The
         execution of the local exit code can be guaranteed only if the program does
- not terminate because of an uncaught exception. <sup>[<a name="id875009" href="#ftn.id875009" class="footnote">12</a>]</sup>
+ not terminate because of an uncaught exception. <sup>[<a name="id875559" href="#ftn.id875559" class="footnote">12</a>]</sup>
       </p>
 <p>
         Only bound variables specified by <code class="literal"><span class="emphasis"><em>bindings</em></span></code>
@@ -1045,7 +1058,7 @@
         Local exits are very similar to the <span class="emphasis"><em>scope exits</em></span> provided
         by Boost.ScopeExit
         with the addition that they also support constant binding and binding of
- the object <code class="computeroutput"><span class="keyword">this</span></code>. <sup>[<a name="id876261" href="#ftn.id876261" class="footnote">13</a>]</sup> Local exits can be used to emulate the <a href="http://d.digitalmars.com" target="_top">D
+ the object <code class="computeroutput"><span class="keyword">this</span></code>. <sup>[<a name="id876810" href="#ftn.id876810" class="footnote">13</a>]</sup> Local exits can be used to emulate the <a href="http://d.digitalmars.com" target="_top">D
         Programming Language</a> <span class="emphasis"><em>scope guards</em></span> (see the
         <a class="link" href="Examples.html#boost_local.Examples.Emulating_Ds_Scope_Guards" title="Emulating D's Scope Guards">Emulating
         D's Scope Guards</a> example).
@@ -1059,7 +1072,7 @@
         When local functions, local blocks, and local exits are programmed within
         templates, they need to be declared using the following special macros ending
         with the <code class="computeroutput"><span class="identifier">TPL</span></code> postfix (see
- the Reference section): <sup>[<a name="id876540" href="#ftn.id876540" class="footnote">14</a>]</sup>
+ the Reference section): <sup>[<a name="id877090" href="#ftn.id877090" class="footnote">14</a>]</sup>
       </p>
 <pre class="programlisting"><code class="computeroutput"><a class="link" href="../BOOST_LOCAL_FUNCTION_PARAMS_TPL.html" title="Macro BOOST_LOCAL_FUNCTION_PARAMS_TPL">BOOST_LOCAL_FUNCTION_PARAMS_TPL</a></code><span class="special">(</span><span class="emphasis"><em>parameters</em></span><span class="special">)</span>
 <code class="computeroutput"><a class="link" href="../BOOST_LOCAL_BLOCK_TPL.html" title="Macro BOOST_LOCAL_BLOCK_TPL">BOOST_LOCAL_BLOCK_TPL</a></code><span class="special">(</span><span class="emphasis"><em>bindings</em></span><span class="special">)</span>
@@ -1192,20 +1205,20 @@
 </div>
 <div class="footnotes">
 <br><hr width="100" align="left">
-<div class="footnote"><p><sup>[<a id="ftn.id866968" href="#id866968" class="para">3</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id867002" href="#id867002" class="para">3</a>] </sup>
           <span class="bold"><strong>Rationale.</strong></span> If the local function body
           were instead passed as a macro parameter, it would be expanded on a single
           line of code (because macros always expand as a single line of code). Therefore,
           eventual compiler error line numbers would all have the same value and
           would no longer be useful to pinpoint the error.
         </p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id867004" href="#id867004" class="para">4</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id867038" href="#id867038" class="para">4</a>] </sup>
           <span class="bold"><strong>Rationale.</strong></span> The local function name must
           be passed to the macro <code class="computeroutput"><a class="link" href="../BOOST_LOCAL_FUNCTION_NAME.html" title="Macro BOOST_LOCAL_FUNCTION_NAME">BOOST_LOCAL_FUNCTION_NAME</a></code>
           ending the function definition so this macro can declare a local variable
           with the local function name to hold the local functor object.
         </p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id868926" href="#id868926" class="para">5</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id868960" href="#id868960" class="para">5</a>] </sup>
           <span class="bold"><strong>Rationale.</strong></span> The assignment symbol <code class="computeroutput"><span class="special">=</span></code> cannot be used to specify default parameter
           values because default values are not part of the parameter type so they
           cannot be handled using template metaprogamming. Default parameter values
@@ -1215,7 +1228,7 @@
           it counts the number of default values to provide the correct set of call
           operators for the local functor object.
         </p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id870150" href="#id870150" class="para">6</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id870184" href="#id870184" class="para">6</a>] </sup>
           <span class="bold"><strong>Rationale.</strong></span> By binding a variable in scope,
           the local function declaration is specifying that such a variable should
           be accessible within the local function body regardless of its type. Semantically,
@@ -1228,7 +1241,7 @@
           This is especially useful for maintenance so if a bound variable type is
           changed, the local function declaration does not have to change.
         </p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id870238" href="#id870238" class="para">7</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id870272" href="#id870272" class="para">7</a>] </sup>
           The token <code class="computeroutput"><span class="identifier">bind</span></code> is not a
           real keyword of the C++ language. This library parses <code class="computeroutput"><span class="identifier">bind</span></code>
           during macro expansion using preprocessor metaprogramming. Therefore,
@@ -1237,7 +1250,7 @@
           within the syntax defined by the macros of this library -- thus it is referred
           to as a "keyword" only within quotes.
         </p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id870493" href="#id870493" class="para">8</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id870527" href="#id870527" class="para">8</a>] </sup>
           An historical note: Constant binding of variables in scope was the main
           use case that originally motivated the authors in developing this library.
           The authors needed to locally create a chuck of code to assert some correctness
@@ -1252,7 +1265,7 @@
           generates an error because the bound variable is of <code class="computeroutput"><span class="keyword">const</span></code>
           type within the local function body.
         </p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id871003" href="#id871003" class="para">9</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id871037" href="#id871037" class="para">9</a>] </sup>
             <span class="bold"><strong>Rationale.</strong></span> This limitation comes from
             the fact that <code class="computeroutput"><span class="keyword">this</span></code> is a
             reserved C++ keyword so it cannot be used as the name of the internal
@@ -1266,7 +1279,7 @@
             behaviour of <code class="computeroutput"><span class="keyword">static_cast</span></code></a>
             (which might not work on all platforms at the cost of portability).
           </p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id871097" href="#id871097" class="para">10</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id871131" href="#id871131" class="para">10</a>] </sup>
             <span class="bold"><strong>Rationale.</strong></span> The local function body cannot
             be a static member function of the local functor object in order to support
             recursion (because the local function name is specified by the <code class="computeroutput"><a class="link" href="../BOOST_LOCAL_FUNCTION_NAME.html" title="Macro BOOST_LOCAL_FUNCTION_NAME">BOOST_LOCAL_FUNCTION_NAME</a></code>
@@ -1279,7 +1292,7 @@
             is visible but it refers to the local functor object and not to the bound
             object.
           </p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id873804" href="#id873804" class="para">11</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id874354" href="#id874354" class="para">11</a>] </sup>
             <span class="bold"><strong>Rationale.</strong></span> Programmers might expect
             <code class="computeroutput"><span class="keyword">return</span><span class="special">;</span></code>
             to exit the enclosing function instead of the local block (or local exit),
@@ -1297,7 +1310,7 @@
             <code class="computeroutput"><span class="identifier">BOOST_LOCAL_RETURN</span><span class="special">;</span></code>)
             to exit local blocks (and local exits).
           </p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id875009" href="#id875009" class="para">12</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id875559" href="#id875559" class="para">12</a>] </sup>
           <span class="bold"><strong>Rationale.</strong></span> This library (as well as Boost.ScopeExit)
           uses the destructor of a local variable to automatically execute the local
           exit code upon exit of the enclosing scope. However, in C++ it is no possible
@@ -1306,7 +1319,7 @@
           different from the D programming language which executes the scope exit
           code even if the main program terminates because of an uncaught exception.)
         </p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id876261" href="#id876261" class="para">13</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id876810" href="#id876810" class="para">13</a>] </sup>
           <span class="bold"><strong>Rationale.</strong></span> This library could be merged
           together with Boost.ScopeExit
           into a new library named Boost.Scope (from the meaning of the word "scope"
@@ -1333,7 +1346,7 @@
           name of "<a href="http://gcc.gnu.org/onlinedocs/gcc/Nested-Functions.html" target="_top">nested
           functions</a>".
         </p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id876540" href="#id876540" class="para">14</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id877090" href="#id877090" class="para">14</a>] </sup>
           <span class="bold"><strong>Rationale.</strong></span> Within templates, this library
           needs to use <code class="computeroutput"><span class="keyword">typename</span></code> to explicitly
           indicate that some expressions evaluate to a type. Because C++ does not

Modified: sandbox/local/libs/local/doc/html/index.html
==============================================================================
--- sandbox/local/libs/local/doc/html/index.html (original)
+++ sandbox/local/libs/local/doc/html/index.html 2011-03-23 20:03:37 EDT (Wed, 23 Mar 2011)
@@ -27,7 +27,7 @@
 </h3></div></div></div>
 <div><p class="copyright">Copyright &#169; 2009 -2011 Lorenzo Caminiti</p></div>
 <div><div class="legalnotice">
-<a name="id810406"></a><p>
+<a name="id863763"></a><p>
         Use, modification, and distribution is subject to the Boost Software License,
         Version 1.0 (see accompanying file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt).
       </p>
@@ -109,7 +109,7 @@
         </li>
 </ul></div>
 <a name="boost_local.Introduction.two_syntaxes"></a><h6>
-<a name="id810200"></a>
+<a name="id808272"></a>
       <a class="link" href="index.html#boost_local.Introduction.two_syntaxes">Two Syntaxes</a>
     </h6>
 <p>
@@ -126,7 +126,7 @@
 <li class="listitem">
           The <span class="emphasis"><em>variadic macro synstax</em></span> is available only on C++
           compilers that support <a href="http://en.wikipedia.org/wiki/Variadic_macro" target="_top">variadic
- macros</a>. <sup>[<a name="id852604" href="#ftn.id852604" class="footnote">1</a>]</sup> This syntax allow to use commas <code class="computeroutput"><span class="special">,</span></code>
+ macros</a>. <sup>[<a name="id808335" href="#ftn.id808335" class="footnote">1</a>]</sup> This syntax allow to use commas <code class="computeroutput"><span class="special">,</span></code>
           to separate macro parameters therefore resembling the usual C++ syntax
           for function parameter declaration.
         </li>
@@ -141,7 +141,7 @@
       of both syntaxes.
     </p>
 <a name="boost_local.Introduction.an_example"></a><h6>
-<a name="id852666"></a>
+<a name="id810396"></a>
       <a class="link" href="index.html#boost_local.Introduction.an_example">An Example</a>
     </h6>
 <p>
@@ -414,7 +414,7 @@
 </div>
 <div class="footnotes">
 <br><hr width="100" align="left">
-<div class="footnote"><p><sup>[<a id="ftn.id852604" href="#id852604" class="para">1</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id808335" href="#id808335" class="para">1</a>] </sup>
             Variadic macros were first introduced by the C99 preprocessor (via the
             use of the special macro symbols ellipses <code class="computeroutput"><span class="special">...</span></code>
             and <code class="computeroutput"><span class="identifier">__VA_ARGS__</span></code>). They
@@ -424,7 +424,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: March 21, 2011 at 02:28:55 GMT</small></p></td>
+<td align="left"><p><small>Last revised: March 24, 2011 at 00:01:35 GMT</small></p></td>
 <td align="right"><div class="copyright-footer"></div></td>
 </tr></table>
 <hr>

Modified: sandbox/local/libs/local/doc/qbk/implementation.qbk
==============================================================================
--- sandbox/local/libs/local/doc/qbk/implementation.qbk (original)
+++ sandbox/local/libs/local/doc/qbk/implementation.qbk 2011-03-23 20:03:37 EDT (Wed, 23 Mar 2011)
@@ -1,7 +1,7 @@
 
 [section:Implementation Appendix: Implementation]
 
-This section lists source code that should provide a general idea on how this library implements local functions.
+This section lists source code that should provide a general idea on how this library is implemented.
 
 The code listed here should only be used as a reference in trying to understand the library implementation and source code.
 There is no guarantee that the library implementation will use exactly the code listed here.
@@ -9,16 +9,54 @@
 
 [section Local Functions]
 
-The expansion of the local function macros in the `factorial` example presented in the __Advanced_Topics__ section generates code equivalent to the following:
+The expansion of the local function macros of the `factorial` example presented in the __Advanced_Topics__ section generates code equivalent to the following:
 
 [factorial_impl_cpp]
 
 [endsect]
 
-[section Local Blocks and Exits]
+[section Local Blocks]
 
-Local blocks and local exits are trivially implemented by this library reusing local functions.
-Local block and local exit implementation code should be obvious from the library source files so it is not listed here.
+The expansion of the local block macros for the main local block example presented in the __Tutorial__ section generates code equivalent to the following:
+
+[add_block_impl_cpp]
+
+[endsect]
+
+[section Local Exits]
+
+The expansion of the local exit macros for the main local exit example presented in the __Tutorial__ section generates code equivalent to the following:
+
+[add_exit_impl_cpp]
+
+[endsect]
+
+[section Parsing Macros]
+
+This library macros can parse the list of specified parameters and detect if any of the bound parameter name matches the token `this` (to generate special code to bind the object in scope), or if the parameter is bound by `const` (to generate special code to bind by constant), etc.
+The parameter tokens are inspected by preprocessor metaprogramming using both __Boost_Preprocessor__ and the `BOOST_DETAIL_PP_KEYWORD_...` macros that in brief work as follow:
+
+ #include <boost/detail/preprocessor/keyword/this.hpp>
+ #include <boost/detail/preprocessor/keyword/const.hpp>
+ #include <boost/locla/aux_/preprocessor/keyword/bind.hpp>
+
+ // Detect `this`.
+ BOOST_DETAIL_PP_KEYWORD_IS_THIS_BACK(const bind this) // Expand to 1.
+ BOOST_DETAIL_PP_KEYWORD_IS_THIS_BACK(const bind& x) // Expand to 0.
+
+ // Detect constant.
+ BOOST_DETAIL_PP_KEYWORD_IS_CONST_FRONT(const bind this) // Expand to 1.
+ BOOST_DETAIL_PP_KEYWORD_IS_CONST_FRONT(bind this) // Expand to 0.
+
+ // Detect binding (constant and not).
+ BOOST_LOCAL_AUX_PP_KEYWORD_IS_BIND_FRONT( // Expand to 1.
+ BOOST_DETAIL_PP_KEYWORD_CONST_REMOVE_FRONT(const bind this))
+ BOOST_LOCAL_AUX_PP_KEYWORD_IS_BIND_FRONT( // Also expand to 1.
+ BOOST_DETAIL_PP_KEYWORD_CONST_REMOVE_FRONT(bind this))
+ BOOST_LOCAL_AUX_PP_KEYWORD_IS_BIND_FRONT( // Expand to 0.
+ BOOST_DETAIL_PP_KEYWORD_CONST_REMOVE_FRONT(const int x))
+ BOOST_LOCAL_AUX_PP_KEYWORD_IS_BIND_FRONT( // Also expand to 0.
+ BOOST_DETAIL_PP_KEYWORD_CONST_REMOVE_FRONT(int x))
 
 [endsect]
 

Modified: sandbox/local/libs/local/doc/qbk/local.qbk
==============================================================================
--- sandbox/local/libs/local/doc/qbk/local.qbk (original)
+++ sandbox/local/libs/local/doc/qbk/local.qbk 2011-03-23 20:03:37 EDT (Wed, 23 Mar 2011)
@@ -122,6 +122,8 @@
 [import ../../example/params_all.cpp]
 [import ../../example/params_all_va.cpp]
 [import ../../example/factorial_impl.cpp]
+[import ../../example/add_block_impl.cpp]
+[import ../../example/add_exit_impl.cpp]
 
 The Boost Local library implements local functions, local blocks, and local exits for the C++ programming language.
 

Modified: sandbox/local/libs/local/example/Jamfile.jam
==============================================================================
--- sandbox/local/libs/local/example/Jamfile.jam (original)
+++ sandbox/local/libs/local/example/Jamfile.jam 2011-03-23 20:03:37 EDT (Wed, 23 Mar 2011)
@@ -9,22 +9,17 @@
 
 exe add_block : add_block.cpp ;
 exe add_block_va : add_block_va.cpp ;
+exe add_block_impl : add_block_impl.cpp ;
 
 exe add_except : add_except.cpp ;
 exe add_except_va : add_except_va.cpp ;
 
 exe add_exit : add_exit.cpp ;
 exe add_exit_va : add_exit_va.cpp ;
+exe add_exit_impl : add_exit_impl.cpp ;
 
-exe add_num_factor_sum : add_num_factor_sum.cpp ;
-exe add_num_factor_sum_va : add_num_factor_sum_va.cpp ;
-
-exe add_num_factor_sum_default : add_num_factor_sum_default.cpp ;
-exe add_num_factor_sum_default_va : add_num_factor_sum_default_va.cpp ;
-exe add_num_factor_sum_with_default_va : add_num_factor_sum_with_default_va.cpp ;
-
-exe add_num_sum : add_num_sum.cpp ;
-exe add_num_sum_va : add_num_sum_va.cpp ;
+exe add_function : add_function.cpp ;
+exe add_function_va : add_function_va.cpp ;
 
 exe add_optimizers : add_optimizers.cpp ;
 exe add_optimizers_va : add_optimizers_va.cpp ;
@@ -35,42 +30,63 @@
 exe add_this : add_this.cpp ;
 exe add_this_va : add_this_va.cpp ;
 
-exe block : block.cpp ;
-exe block_va : block_va.cpp ;
+exe add_x_y : add_x_y.cpp ;
+exe add_x_y_va : add_x_y_va.cpp ;
+
+exe add_x_y_default : add_x_y_default.cpp ;
+exe add_x_y_default_va : add_x_y_default_va.cpp ;
+exe add_x_y_default_with_va : add_x_y_default_with_va.cpp ;
 
 exe doit : doit.cpp ;
 exe doit_va : doit_va.cpp ;
 
-exe exit : exit.cpp ;
-exe exit_va : exit_va.cpp ;
-
 exe factorial : factorial.cpp ;
 exe factorial_va : factorial_va.cpp ;
+exe factorial_impl : factorial_impl.cpp ;
 
 exe find_if : find_if.cpp ;
 exe find_if_va : find_if_va.cpp ;
 
+exe gcc-access : gcc-access.cpp ;
+exe gcc-access_va : gcc-access_va.cpp ;
+
+exe gcc-square : gcc-square.cpp ;
+exe gcc-square_va : gcc-square_va.cpp ;
+
+exe gcc-store : gcc-store.cpp ;
+exe gcc-store_va : gcc-store_va.cpp ;
+
+exe nesting : nesting.cpp ;
+exe nesting_va : nesting_va.cpp ;
+
 exe params_all : params_all.cpp ;
 exe params_all_va : params_all_va.cpp ;
 
-exe params_none : params_none.cpp ;
-exe params_none_ep : params_none_ep.cpp ;
-
 exe print_map : print_map.cpp ;
 exe print_map_va : print_map_va.cpp ;
 
+exe scope_guards_errno : scope_guards_errno.cpp ;
+exe scope_guards_errno_va : scope_guards_errno_va.cpp ;
+
+exe scope_guards_execpt : scope_guards_except.cpp ;
+exe scope_guards_execpt_va : scope_guards_except_va.cpp ;
+
+exe ten : ten.cpp ;
+exe ten_va : ten_va.cpp ;
+exe ten_ep : ten_ep.cpp ;
+
 exe this : this.cpp ;
 exe this_va : this_va.cpp ;
 
 exe transform : transform.cpp ;
 exe transform_va : transform_va.cpp ;
 
-exe nesting : nesting.cpp ;
-exe nesting_va : nesting_va.cpp ;
-
 exe typeof : typeof.cpp ;
 exe typeof_va : typeof_va.cpp ;
 
 exe typeof_tpl : typeof_tpl.cpp ;
 exe typeof_tpl_va : typeof_tpl_va.cpp ;
 
+exe world_exit : world_exit.cpp ;
+exe world_exit_va : world_exit_va.cpp ;
+

Modified: sandbox/local/libs/local/example/add_this.cpp
==============================================================================
--- sandbox/local/libs/local/example/add_this.cpp (original)
+++ sandbox/local/libs/local/example/add_this.cpp 2011-03-23 20:03:37 EDT (Wed, 23 Mar 2011)
@@ -6,6 +6,8 @@
 
 //[ add_this_cpp
 #include <boost/local/function.hpp>
+#include <boost/local/block.hpp>
+#include <boost/local/exit.hpp>
 #include <vector>
 #include <algorithm>
 #include <iostream>
@@ -19,15 +21,15 @@
         void BOOST_LOCAL_FUNCTION_PARAMS( (double num) (const bind factor)
                 (bind this) ) {
             this_->sum_ += factor * num; // Use `this_` instead of `this`.
- std::clog << "Summed: " << this_->sum_ << std::endl;
+ std::cout << "Summed: " << this_->sum_ << std::endl;
         } BOOST_LOCAL_FUNCTION_NAME(add)
 
         BOOST_LOCAL_EXIT( (const bind this) ) {
- std::clog << "Exiting: " << this_->sum_ << std::endl;
+ std::cout << "Exiting: " << this_->sum_ << std::endl;
         } BOOST_LOCAL_EXIT_END
 
         BOOST_LOCAL_BLOCK( (const bind this) ) {
- std::clong << "Asserted: " << this_->sum_ << std::endl;
+ std::cout << "Asserted: " << this_->sum_ << std::endl;
             assert(this_->sum_ > 0.0);
         } BOOST_LOCAL_BLOCK_END
 

Modified: sandbox/local/libs/local/example/add_this_va.cpp
==============================================================================
--- sandbox/local/libs/local/example/add_this_va.cpp (original)
+++ sandbox/local/libs/local/example/add_this_va.cpp 2011-03-23 20:03:37 EDT (Wed, 23 Mar 2011)
@@ -6,6 +6,8 @@
 
 //[ add_this_va_cpp
 #include <boost/local/function.hpp>
+#include <boost/local/block.hpp>
+#include <boost/local/exit.hpp>
 #include <vector>
 #include <algorithm>
 #include <iostream>
@@ -19,9 +21,18 @@
         void BOOST_LOCAL_FUNCTION_PARAMS(double num, const bind factor,
                 bind this) {
             this_->sum_ += factor * num; // Use `this_` instead of `this`.
- std::clog << "Summed: " << this_->sum_ << std::endl;
+ std::cout << "Summed: " << this_->sum_ << std::endl;
         } BOOST_LOCAL_FUNCTION_NAME(add)
 
+ BOOST_LOCAL_EXIT(const bind this) {
+ std::cout << "Exiting: " << this_->sum_ << std::endl;
+ } BOOST_LOCAL_EXIT_END
+
+ BOOST_LOCAL_BLOCK(const bind this) {
+ std::cout << "Asserted: " << this_->sum_ << std::endl;
+ assert(this_->sum_ > 0.0);
+ } BOOST_LOCAL_BLOCK_END
+
         std::for_each(nums.begin(), nums.end(), add);
         return sum_;
     }

Modified: sandbox/local/libs/local/example/factorial.cpp
==============================================================================
--- sandbox/local/libs/local/example/factorial.cpp (original)
+++ sandbox/local/libs/local/example/factorial.cpp 2011-03-23 20:03:37 EDT (Wed, 23 Mar 2011)
@@ -10,26 +10,36 @@
 #include <sstream>
 #include <algorithm>
 #include <vector>
+#include <string>
 
-int main () {
+struct calculator {
     std::ostringstream output;
 
- int BOOST_LOCAL_FUNCTION_PARAMS( (int n) (bool recursion)(default false)
- (bind& output) ) {
- int result = 0;
-
- if (n < 2 ) result = 1;
- else result = n * factorial(n - 1, true); // Recursive call.
-
- if (!recursion) output << result << " ";
- return result;
- } BOOST_LOCAL_FUNCTION_NAME(factorial)
+ void factorials(const std::vector<int>& nums,
+ const std::string& separator = " ") {
+ int BOOST_LOCAL_FUNCTION_PARAMS( (int n) (bool recursion)(default false)
+ (const bind& separator) (bind this) ) {
+ int result = 0;
+
+ if (n < 2 ) result = 1;
+ else result = n * factorial(n - 1, true); // Recursive call.
+
+ if (!recursion) this_->output << result << separator;
+ return result;
+ } BOOST_LOCAL_FUNCTION_NAME(factorial)
+
+ std::for_each(nums.begin(), nums.end(), factorial);
+ }
+};
 
+int main() {
     std::vector<int> v(3);
     v[0] = 1; v[1] = 4; v[2] = 7;
- std::for_each(v.begin(), v.end(), factorial);
 
- std::cout << output.str() << std::endl;
+ calculator calc;
+ calc.factorials(v);
+ std::cout << calc.output.str() << std::endl;
+
     return 0;
 }
 //]

Modified: sandbox/local/libs/local/example/factorial_impl.cpp
==============================================================================
--- sandbox/local/libs/local/example/factorial_impl.cpp (original)
+++ sandbox/local/libs/local/example/factorial_impl.cpp 2011-03-23 20:03:37 EDT (Wed, 23 Mar 2011)
@@ -10,101 +10,153 @@
 #include <sstream>
 #include <algorithm>
 #include <vector>
+#include <string>
 
-int main () {
+struct calculator {
     std::ostringstream output;
 
- int // The local function result type (just before the `BOOST_LOCAL_FUNCTION_PARAMS` macro).
+ void factorials(const std::vector<int>& nums,
+ const std::string& separator = " ") {
 
- // *BEGIN* The macro
- // BOOST_LOCAL_FUNCTION_PARAMS( (int n) (bool recursion)(default false)
- // (bind& output) )
- // expands (at line 18) to:
-
- (*ERROR_missing_result_type_before_the_local_function_parameter_macro_id18)();
- typedef void (*boost_local_auxXdeduce_result_tag18)(int ERROR_missing_result_type_before_the_local_function_parameter_macro_id18);
- typedef BOOST_TYPEOF(boost::scope_exit::aux::wrap( boost::scope_exit::aux::deref( ERROR_missing_result_type_before_the_local_function_parameter_macro_id18, (boost_local_auxXdeduce_result_tag18)0))) boost_local_auxXdeduce_result_wrap18;
- typedef boost_local_auxXdeduce_result_wrap18::type boost_local_auxXdeduce_result_capture18;
- struct boost_local_auxXdeduce_result_params18 {
- typedef boost_local_auxXdeduce_result_capture18 function_ptr_type;
- };
-
- typedef boost::remove_pointer< boost_local_auxXdeduce_result_params18::function_ptr_type >::type boost_local_auxXdeduce_result_function_type18;
- typedef boost::function_traits< boost_local_auxXdeduce_result_function_type18>::result_type boost_local_auxXresult_type18;
- typedef void (*boost_se_tag_0_18)(int & output );
- typedef BOOST_TYPEOF(boost::scope_exit::aux::wrap( boost::scope_exit::aux::deref(& output, (boost_se_tag_0_18)0))) boost_se_wrapped_t_0_18;
- typedef boost_se_wrapped_t_0_18::type boost_se_capture_t_0_18;
- struct boost_se_params_t_18 {
- typedef boost_se_capture_t_0_18 boost_se_param_t_0_18;
- boost::scope_exit::aux::member< boost_se_param_t_0_18, boost_se_tag_0_18 > boost_se_param_0_18;
- } boost_local_auxXparams18 = {
- { boost::scope_exit::aux::deref(& output, (boost_se_tag_0_18)0) } // This is for GCC but no extra curly parenthesis on MSVC.
- };
-
- boost::scope_exit::aux::declared< boost::scope_exit::aux::resolve< sizeof(boost_local_auxXargs) >::cmp1<0>::cmp2 > boost_local_auxXargs;
- boost_local_auxXargs.value = &boost_local_auxXparams18;
-
- class boost_local_auxXfunctor18 : public ::boost::local::aux::abstract_function< boost_local_auxXresult_type18 ( int n , bool recursion ), 1 > {
- typedef boost_local_auxXresult_type18 (boost_local_auxXfunction_type) ( int n , bool recursion );
- public:
- explicit boost_local_auxXfunctor18( void* binding_data) :
- boost_local_auxXbinds(static_cast< boost_se_params_t_18*>(binding_data)) {
- boost_local_auxXinit_recursion();
- }
-
- boost_local_auxXresult_type18 operator()(
- ::boost::function_traits< boost_local_auxXfunction_type>::arg1_type arg1 ,
- ::boost::function_traits< boost_local_auxXfunction_type>::arg2_type arg2 ) {
- return boost_local_auxXbody( boost_local_auxXbinds-> boost_se_param_0_18.value , arg1 , arg2 );
- }
- boost_local_auxXresult_type18 operator()(
- ::boost::function_traits< boost_local_auxXfunction_type>::arg1_type arg1 ) {
- return boost_local_auxXbody( boost_local_auxXbinds-> boost_se_param_0_18.value , arg1 );
- }
-
- private:
- boost::scope_exit::aux::undeclared boost_local_auxXargs;
- typedef ::boost::local::function<boost_local_auxXfunction_type, 1 > boost_local_auxXfunctor_type;
- typedef boost_se_params_t_18:: boost_se_param_t_0_18 & outputXboost_local_auxXtypeof_type ;
- boost_se_params_t_18* boost_local_auxXbinds;
-
- boost_local_auxXresult_type18 boost_local_auxXbody( boost_se_params_t_18:: boost_se_param_t_0_18 & output , int n , bool recursion = false ) const
+ int // The local function result type (just before the `BOOST_LOCAL_FUNCTION_PARAMS` macro).
 
- // *END* The expansion of `BOOST_LOCAL_FUNCTION_PARAMS` ends here.
-
- // *BEGIN* The local function body code `{ ... }` as specified by the programmers:
-
- {
- int result = 0;
-
- if (n < 2 ) result = 1;
- else result = n * factorial(n - 1, true); // Recursive call.
-
- if (!recursion) output << result << " ";
- return result;
- }
+ // *BEGIN* The macro
+ // BOOST_LOCAL_FUNCTION_PARAMS( (int n) (bool recursion)(default false)
+ // (const bind& separator) (bind this) )
+ // expands (at line 21) to:
+
+ // DEDUCE RESULT TYPE
+ // Long name `ERROR_...` gives meaningful compiler-error message if programmers forget result type before the macro.
+ (*ERROR_missing_result_type_before_the_local_function_parameter_macro_id21)();
+ // Use Boost.ScopeExit type deduction technique (tagging, wrapping, struct, etc) so to work on all compilers (specifically, some GCC version give internal errors otherwise).
+ typedef void (*boost_local_auxXdeduce_result_tag21)(int ERROR_missing_result_type_before_the_local_function_parameter_macro_id21);
+ typedef BOOST_TYPEOF(boost::scope_exit::aux::wrap(boost::scope_exit::aux::deref(ERROR_missing_result_type_before_the_local_function_parameter_macro_id21, (boost_local_auxXdeduce_result_tag21)0))) boost_local_auxXdeduce_result_wrap21;
+ typedef boost_local_auxXdeduce_result_wrap21::type boost_local_auxXdeduce_result_capture21;
+ struct boost_local_auxXdeduce_result_params21 {
+ typedef boost_local_auxXdeduce_result_capture21 function_ptr_type;
+ };
+ typedef boost::remove_pointer< boost_local_auxXdeduce_result_params21::function_ptr_type >::type boost_local_auxXdeduce_result_function_type21;
+ typedef boost::function_traits< boost_local_auxXdeduce_result_function_type21>::result_type boost_local_auxXresult_type21;
+
+ // HANDLE BOUND PARAMETERS
+ // Deduce object `this` type (using technique from Boost.ScopeExit patch to support `this`).
+#if BOOST_WORKAROUND(BOOST_MSVC,>=1300)
+ enum { boost_se_thistype_index_21 = sizeof(*boost::scope_exit::msvc_typeof_this::encode_start(this)) };
+ typedef boost::scope_exit::msvc_typeof_this::msvc_typeid_wrapper<boost_se_thistype_index_21>::type se_this_type21;
+#else
+ typedef BOOST_TYPEOF(this) se_this_type21;
+#endif
+ // Deduce other `& separator` type (using Boost.ScopeExit technique).
+ typedef void (*boost_se_tag_0_21)(int & separator);
+ typedef BOOST_TYPEOF(boost::scope_exit::aux::wrap(boost::scope_exit::aux::deref(& separator, (boost_se_tag_0_21)0))) boost_se_wrapped_t_0_21;
+ typedef boost_se_wrapped_t_0_21::type boost_se_capture_t_0_21;
+ // Store bound parameter values and references.
+ struct boost_se_params_t_21 {
+ se_this_type21 se_this;
+ typedef boost_se_capture_t_0_21 boost_se_param_t_0_21;
+ boost::scope_exit::aux::member<boost_se_param_t_0_21, boost_se_tag_0_21> boost_se_param_0_21;
+ } boost_local_auxXparams21 = {
+ this,
+#ifdef BOOST_SCOPE_EXIT_AUX_TPL_WORKAROUND
+ {
+#endif
+ boost::scope_exit::aux::deref(& separator, (boost_se_tag_0_21)0)
+#ifdef BOOST_SCOPE_EXIT_AUX_TPL_WORKAROUND
+ }
+#endif
+ };
+ // Use variable name `...args` without line number to hold bound parameter values (so the same variable name can be used by the `NAME` macro even if it expands on a different line number).
+ // The `declared<>` template makes sure that the variable `...args` is not declared multiple times in the same context (if the variable is already declared, this template expand to a no-operation).
+ boost::scope_exit::aux::declared<boost::scope_exit::aux::resolve<sizeof(boost_local_auxXargs)>::cmp1<0>::cmp2> boost_local_auxXargs;
+ boost_local_auxXargs.value = &boost_local_auxXparams21;
+
+ // LOCAL FUNCTOR
+ class boost_local_auxXfunctor21:
+ // Base abstract class is used to later assign this local functor to `boost::local::function` so the local function can be passed as a template parameter (polymorphism ensures that the correct `operator()` as implemented by this class is called when this object is used as an `abstract_function` by `boost::local::function`).
+ public ::boost::local::aux::abstract_function<boost_local_auxXresult_type21 (int n, bool recursion), 1> {
+ typedef boost_local_auxXresult_type21 (boost_local_auxXfunction_type)(int n , bool recursion);
+ public:
+ // Take a generic pointer so it can be invoked by the `NAME` macro even if it expands on a different line number.
+ explicit boost_local_auxXfunctor21(void* binding_data):
+ boost_local_auxXbinds(static_cast<boost_se_params_t_21*>(binding_data)) {
+ boost_local_auxXinit_recursion();
+ }
+
+ // Implement `operator()` for all parameters and any combination of default parameter.
+ boost_local_auxXresult_type21 operator()(
+ ::boost::function_traits<boost_local_auxXfunction_type>::arg1_type arg1,
+ ::boost::function_traits<boost_local_auxXfunction_type>::arg2_type arg2) {
+ // Actual parameter names are not known to the macro syntax separately from their types so generic names `arg...` must be used (and therefore the parameter types are extracted from the function type).
+ return boost_local_auxXbody(boost_local_auxXbinds->boost_se_param_0_21.value, boost_local_auxXbinds->se_this, arg1, arg2);
+ }
+ boost_local_auxXresult_type21 operator()(
+ ::boost::function_traits<boost_local_auxXfunction_type>::arg1_type arg1) {
+ return boost_local_auxXbody(boost_local_auxXbinds->boost_se_param_0_21.value, boost_local_auxXbinds->se_this, arg1);
+ }
+
+ private:
+ // Local function functor type (for a later declaration).
+ typedef ::boost::local::function<boost_local_auxXfunction_type, 1> boost_local_auxXfunctor_type;
+ // Define the deduced types for using `BOOST_LOCAL_TYPEOF` from within the local function body (the `&` is kept because the bound parameter name is not known to the macro syntax separately from the reference qualifier).
+ typedef ::boost::add_const< boost_se_params_t_21:: boost_se_param_t_0_21 >::type & separatorXboost_local_auxXtypeof_type;
+ typedef se_this_type21 thisXboost_local_auxXtypeof_type;
+ // Hold bound parameters values and references.
+ boost_se_params_t_21* boost_local_auxXbinds;
+ // This same declaration is first made at global scope in one of the library header files. This declaration needs to be repeated here so it is also visible from within the local function body to allow for nesting local function into one another.
+ boost::scope_exit::aux::undeclared boost_local_auxXargs;
+
+ // The local function body. The body function cannot be static because is needs to access the member variable with the local function name to support recursion (and local classes cannot have static member variable) but unfortunately this implies that `this` can be misused within the body instead of `this_` without necessarily generating a compile-time error.
+ boost_local_auxXresult_type21 boost_local_auxXbody(
+ // Use special name `this_` instead of `this` here.
+ ::boost::add_const<boost_se_params_t_21::boost_se_param_t_0_21>::type & separator, se_this_type21 this_,
+ // Specify default parameter values here.
+ int n, bool recursion = false) const
+
+ // *END* The expansion of `BOOST_LOCAL_FUNCTION_PARAMS` ends here.
 
- // *END* The local function body `{ ... }` ends here.
-
- // *BEGIN* The macro `BOOST_LOCAL_FUNCTION_NAME(factorial)` expands to:
+ // *BEGIN* The local function body code `{ ... }` as specified by the programmers:
+
+ {
+ int result = 0;
 
- public:
- boost_local_auxXfunctor_type factorial;
+ if (n < 2 ) result = 1;
+ else result = n * factorial(n - 1, true); // Recursive call.
 
- private:
- void boost_local_auxXinit_recursion() {
- factorial = *this;
+ if (!recursion) this_->output << result << separator;
+ return result;
         }
- } boost_local_auxXfunctorXfactorial(boost_local_auxXargs.value);
- BOOST_TYPEOF(boost_local_auxXfunctorXfactorial.factorial) const factorial(boost_local_auxXfunctorXfactorial);
+
+ // *END* The local function body `{ ... }` ends here.
+
+ // *BEGIN* The macro `BOOST_LOCAL_FUNCTION_NAME(factorial)` expands to:
 
- // *END* The expansion of `BOOST_LOCAL_FUNCTION_NAME` ends here.
+ public:
+ // Member variable named after the local function so the body can recursively call the local function (this must be defined here because the local function name was not known before). This must be public because it is also used to deduce the local function functor type later when when declaring the actual local function object.
+ boost_local_auxXfunctor_type factorial;
+ private:
+ // Initializes the local functor member variable (this cannot be done directly within the constructor because the local function name is not known when the constructor code is expanded by the `PARAMS` macro).
+ void boost_local_auxXinit_recursion() {
+ factorial = *this;
+ }
+ // Declare the local class object -- which cannot be passed as template parameter (because it is a local class). It uses the variable with the generic `...args` name to pass the bound parameter values and references (so this variable name must not contain the line number because it is used by different macros expanding on different lines).
+ } boost_local_auxXfunctorXfactorial(boost_local_auxXargs.value);
+ // Declare the actual local function object with the local function name -- which can be passed as template parameter (because it is a `boost::local::function` functor and not a local class).
+ BOOST_TYPEOF(boost_local_auxXfunctorXfactorial.factorial) const factorial(boost_local_auxXfunctorXfactorial);
+
+ // *END* The expansion of `BOOST_LOCAL_FUNCTION_NAME` ends here.
+
+ std::for_each(nums.begin(), nums.end(), factorial);
+ }
+};
 
+int main() {
     std::vector<int> v(3);
     v[0] = 1; v[1] = 4; v[2] = 7;
- std::for_each(v.begin(), v.end(), factorial);
 
- std::cout << output.str() << std::endl;
+ calculator calc;
+ calc.factorials(v);
+ std::cout << calc.output.str() << std::endl;
+
     return 0;
 }
 //]

Modified: sandbox/local/libs/local/example/factorial_va.cpp
==============================================================================
--- sandbox/local/libs/local/example/factorial_va.cpp (original)
+++ sandbox/local/libs/local/example/factorial_va.cpp 2011-03-23 20:03:37 EDT (Wed, 23 Mar 2011)
@@ -10,26 +10,36 @@
 #include <sstream>
 #include <algorithm>
 #include <vector>
+#include <string>
 
-int main () {
+struct calculator {
     std::ostringstream output;
 
- int BOOST_LOCAL_FUNCTION_PARAMS(int n, bool recursion, default false,
- bind& output) {
- int result = 0;
-
- if (n < 2 ) result = 1;
- else result = n * factorial(n - 1, true); // Recursive call.
-
- if (!recursion) output << result << " ";
- return result;
- } BOOST_LOCAL_FUNCTION_NAME(factorial)
+ void factorials(const std::vector<int>& nums,
+ const std::string& separator = " ") {
+ int BOOST_LOCAL_FUNCTION_PARAMS(int n, bool recursion, default false,
+ const bind& separator, bind this) {
+ int result = 0;
+
+ if (n < 2 ) result = 1;
+ else result = n * factorial(n - 1, true); // Recursive call.
+
+ if (!recursion) this_->output << result << separator;
+ return result;
+ } BOOST_LOCAL_FUNCTION_NAME(factorial)
+
+ std::for_each(nums.begin(), nums.end(), factorial);
+ }
+};
 
+int main() {
     std::vector<int> v(3);
     v[0] = 1; v[1] = 4; v[2] = 7;
- std::for_each(v.begin(), v.end(), factorial);
 
- std::cout << output.str() << std::endl;
+ calculator calc;
+ calc.factorials(v);
+ std::cout << calc.output.str() << std::endl;
+
     return 0;
 }
 //]

Modified: sandbox/local/libs/local/example/gcc-access_va.cpp
==============================================================================
--- sandbox/local/libs/local/example/gcc-access_va.cpp (original)
+++ sandbox/local/libs/local/example/gcc-access_va.cpp 2011-03-23 20:03:37 EDT (Wed, 23 Mar 2011)
@@ -1,14 +1,23 @@
 
+//[gcc_access_va_cpp
 #include <boost/local/function.hpp>
+#include <iostream>
 
 void bar(int* array, int offset, int size) {
- int BOOST_LOCAL_FUNCTION_PARAMS(int* array, int index, const bind offset) {
+ int BOOST_LOCAL_FUNCTION_PARAMS(int* array, int index,
+ const bind offset) {
         return array[index + offset];
- }
+ } BOOST_LOCAL_FUNCTION_NAME(access)
 
     for (int i = 0; i < size; ++i) {
         std::cout << access(array, i) << std::endl;
     }
 }
 
+int main() {
+ int nums[3] = {1, 2, 3};
+ bar(nums, 0, 3);
+ return 0;
+}
+//]
 

Deleted: sandbox/local/libs/local/example/gcc-goto.cpp
==============================================================================
--- sandbox/local/libs/local/example/gcc-goto.cpp 2011-03-23 20:03:37 EDT (Wed, 23 Mar 2011)
+++ (empty file)
@@ -1,26 +0,0 @@
-
-#include <boost/local/function.hpp>
-#include <iostream>
-
-int print(int* array, int offset, int size) {
- int BOOST_LOCAL_FUNCTION_PARAMS( (int* array) (int index)
- (const bind offset) (const bind size) ) {
- if (index > size) goto failure;
- return array[index + offset];
- } BOOST_LOCAL_FUNCTION_NAME(access)
-
- for (int i = 0; i < size; ++i) {
- std::cout << access(array, i) << std::endl;
- }
- return 0;
-
-failure:
- return -1;
-}
-
-int main() {
- int a[] = {1, 2, 3, 4, 5};
- print(a, 1, 2);
- return 0;
-}
-

Modified: sandbox/local/libs/local/example/gcc-square.cpp
==============================================================================
--- sandbox/local/libs/local/example/gcc-square.cpp (original)
+++ sandbox/local/libs/local/example/gcc-square.cpp 2011-03-23 20:03:37 EDT (Wed, 23 Mar 2011)
@@ -1,13 +1,19 @@
 
+//[gcc_square_cpp
 #include <boost/local/function.hpp>
+#include <iostream>
 
-void add_square(double a, double b) {
- double BOOST_LOCAL_FUNCTION(double z) {
+double add_square(double a, double b) {
+ double BOOST_LOCAL_FUNCTION_PARAMS( (double z) ) {
         return z * z;
- } BOOST_LOCAL_FUNCTION_NAME(suare)
+ } BOOST_LOCAL_FUNCTION_NAME(square)
 
     return square(a) + square(b);
 }
 
-
+int main() {
+ std::cout << add_square(2.0, 3.0) << std::endl;
+ return 0;
+}
+//]
 

Modified: sandbox/local/libs/local/example/gcc-square_va.cpp
==============================================================================
--- sandbox/local/libs/local/example/gcc-square_va.cpp (original)
+++ sandbox/local/libs/local/example/gcc-square_va.cpp 2011-03-23 20:03:37 EDT (Wed, 23 Mar 2011)
@@ -1,13 +1,19 @@
 
+//[gcc_square_va_cpp
 #include <boost/local/function.hpp>
+#include <iostream>
 
-void add_square(double a, double b) {
- double BOOST_LOCAL_FUNCTION(double z) {
+double add_square(double a, double b) {
+ double BOOST_LOCAL_FUNCTION_PARAMS(double z) {
         return z * z;
- } BOOST_LOCAL_FUNCTION_NAME(suare)
+ } BOOST_LOCAL_FUNCTION_NAME(square)
 
     return square(a) + square(b);
 }
 
-
+int main() {
+ std::cout << add_square(2.0, 3.0) << std::endl;
+ return 0;
+}
+//]
 

Modified: sandbox/local/libs/local/example/gcc-store.cpp
==============================================================================
--- sandbox/local/libs/local/example/gcc-store.cpp (original)
+++ sandbox/local/libs/local/example/gcc-store.cpp 2011-03-23 20:03:37 EDT (Wed, 23 Mar 2011)
@@ -1,14 +1,22 @@
 
-void intermediate(void (*store_func)(int, int), int size) {
+//[gcc_store_cpp
+#include <boost/local/function.hpp>
+
+void intermediate(boost::local::function<void (int, int)> store_func,
+ int size) {
     store_func(size - 1, -1);
 }
 
 void hack(int* array, int size) {
- void BOOST_LOCAL_FUNCTION_PARAMS(int index, int value, bind array) {
+ void BOOST_LOCAL_FUNCTION_PARAMS( (int index) (int value) (bind array) ) {
         array[index] = value;
     } BOOST_LOCAL_FUNCTION_NAME(store)
 
     intermediate(store, size);
 }
 
+int main() {
+ return 0;
+}
+//]
 


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