|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r70496 - in sandbox/local: . boost/local 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-24 11:18:06
Author: lcaminiti
Date: 2011-03-24 11:17:58 EDT (Thu, 24 Mar 2011)
New Revision: 70496
URL: http://svn.boost.org/trac/boost/changeset/70496
Log:
Upd docs.
Added:
sandbox/local/libs/local/example/gcc_access.cpp
- copied unchanged from r70486, /sandbox/local/libs/local/example/gcc-access.cpp
sandbox/local/libs/local/example/gcc_access_va.cpp
- copied unchanged from r70485, /sandbox/local/libs/local/example/gcc-access_va.cpp
sandbox/local/libs/local/example/gcc_square.cpp
- copied unchanged from r70485, /sandbox/local/libs/local/example/gcc-square.cpp
sandbox/local/libs/local/example/gcc_square_va.cpp
- copied unchanged from r70485, /sandbox/local/libs/local/example/gcc-square_va.cpp
sandbox/local/libs/local/example/gcc_store.cpp
- copied unchanged from r70485, /sandbox/local/libs/local/example/gcc-store.cpp
sandbox/local/libs/local/example/gcc_store_va.cpp
- copied unchanged from r70486, /sandbox/local/libs/local/example/gcc-store_va.cpp
Removed:
sandbox/local/TODO.txt
sandbox/local/libs/local/example/gcc-access.cpp
sandbox/local/libs/local/example/gcc-access_va.cpp
sandbox/local/libs/local/example/gcc-square.cpp
sandbox/local/libs/local/example/gcc-square_va.cpp
sandbox/local/libs/local/example/gcc-store.cpp
sandbox/local/libs/local/example/gcc-store_va.cpp
Text files modified:
sandbox/local/boost/local/block.hpp | 8 +
sandbox/local/boost/local/exit.hpp | 8 +
sandbox/local/boost/local/function.hpp | 6
sandbox/local/libs/local/doc/html/BOOST_IDENTITY_TYPE.html | 2
sandbox/local/libs/local/doc/html/BOOST_IDENTITY_VALUE.html | 2
sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK.html | 3
sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK_END.html | 3
sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK_TPL.html | 2
sandbox/local/libs/local/doc/html/BOOST_LOCAL_CONFIG_COMPLIANT.html | 2
sandbox/local/libs/local/doc/html/BOOST_LOCAL_CONFIG_FUNCTION_ARITY_MAX.html | 2
sandbox/local/libs/local/doc/html/BOOST_LOCAL_CONFIG_THIS_PARAM_NAME.html | 2
sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT.html | 3
sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT_END.html | 3
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 | 3
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 | 50 +++++++--
sandbox/local/libs/local/doc/html/boost_local/Examples.html | 196 ++++++++++++++++++++++++++++++++++++++++
sandbox/local/libs/local/doc/html/boost_local/Implementation.html | 2
sandbox/local/libs/local/doc/html/boost_local/Release_Notes.html | 21 +++
sandbox/local/libs/local/doc/html/boost_local/Tutorial.html | 98 ++++++++++++++-----
sandbox/local/libs/local/doc/html/index.html | 2
sandbox/local/libs/local/doc/qbk/advanced_topics.qbk | 20 +++
sandbox/local/libs/local/doc/qbk/examples.qbk | 16 +++
sandbox/local/libs/local/doc/qbk/local.qbk | 6 +
sandbox/local/libs/local/doc/qbk/release_notes.qbk | 18 +++
sandbox/local/libs/local/doc/qbk/tutorial.qbk | 6
sandbox/local/libs/local/example/Jamfile.jam | 12 +-
sandbox/local/libs/local/example/factorial_impl.cpp | 2
32 files changed, 432 insertions(+), 76 deletions(-)
Deleted: sandbox/local/TODO.txt
==============================================================================
--- sandbox/local/TODO.txt 2011-03-24 11:17:58 EDT (Thu, 24 Mar 2011)
+++ (empty file)
@@ -1,56 +0,0 @@
-
-* Compile with COMPLIANT (local and/or typeof) defined.
- --> Disable va and ep examples if COMPLIANT and/or NO_VARIADICS.
-
-* 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).
-
-* Docs: PARAMS cannot appear on same line because they use __LINE__ to generate unique IDs (there's no way around this because this macro doesn't know the function name).
-
-* Docs: `this` can never be bound by ref (as usual in C++).
-
-* Code: Optimize macro expansion code for C++0x, C++03, etc. From John Bytheway:
-> Yes, in C++0x local structs can be passed as template parameters.
-> Obviously, in C++0x there are lambdas too, so you might think your
-> library is useless, but I'd expect most compilers to support passing
-> local structs as template parameters before they support lambdas, so
-> there is some advantage in having this intermediate implementation.
-> Also, your macros would allow writing code that worked in C++0x and
-> C++03, with the virtual function business in only those compilers/modes
-> where it is necessary.
-
-
Modified: sandbox/local/boost/local/block.hpp
==============================================================================
--- sandbox/local/boost/local/block.hpp (original)
+++ sandbox/local/boost/local/block.hpp 2011-03-24 11:17:58 EDT (Thu, 24 Mar 2011)
@@ -97,6 +97,10 @@
* }
* @EndParams
*
+ * @Note This macro cannot be used multiple times on the same line because it
+ * internally uses the line number <c>__LINE__</c> to generate unique
+ * identifiers.
+ *
* @See @RefSect{Tutorial} section, @RefSect2{Advanced_Topics, Advanced Topics}
* section, @RefMacro{BOOST_LOCAL_BLOCK_TPL},
* @RefMacro{BOOST_LOCAL_BLOCK_END}.
@@ -134,6 +138,10 @@
* This macro must follow the local block body code <c>{ ... }</c> as
* shown in the @RefMacro{BOOST_LOCAL_BLOCK} documentation.
*
+ * @Note This macro cannot be used multiple times on the same line because it
+ * internally uses the line number <c>__LINE__</c> to generate unique
+ * identifiers.
+ *
* @See @RefMacro{BOOST_LOCAL_BLOCK}, @RefSect{Tutorial} section.
*/
#define BOOST_LOCAL_BLOCK_END \
Modified: sandbox/local/boost/local/exit.hpp
==============================================================================
--- sandbox/local/boost/local/exit.hpp (original)
+++ sandbox/local/boost/local/exit.hpp 2011-03-24 11:17:58 EDT (Thu, 24 Mar 2011)
@@ -97,6 +97,10 @@
* }
* @EndParams
*
+ * @Note This macro cannot be used multiple times on the same line because it
+ * internally uses the line number <c>__LINE__</c> to generate unique
+ * identifiers.
+ *
* @See @RefSect{Tutorial} section, @RefSect2{Advanced_Topics, Advanced Topics}
* section, @RefMacro{BOOST_LOCAL_EXIT_TPL}, @RefMacro{BOOST_LOCAL_EXIT_END}.
*/
@@ -134,6 +138,10 @@
* This macro must follow the local exit body code <c>{ ... }</c> as
* shown in the @RefMacro{BOOST_LOCAL_EXIT} documentation.
*
+ * @Note This macro cannot be used multiple times on the same line because it
+ * internally uses the line number <c>__LINE__</c> to generate unique
+ * identifiers.
+ *
* @See @RefMacro{BOOST_LOCAL_EXIT}, @RefSect{Tutorial} section.
*/
#define BOOST_LOCAL_EXIT_END \
Modified: sandbox/local/boost/local/function.hpp
==============================================================================
--- sandbox/local/boost/local/function.hpp (original)
+++ sandbox/local/boost/local/function.hpp 2011-03-24 11:17:58 EDT (Thu, 24 Mar 2011)
@@ -18,8 +18,6 @@
#include <boost/preprocessor/facilities/empty.hpp>
#include <boost/config.hpp> // For variadic macros.
-// Params.
-
// Pass a parenthesized params seq `()()...` on C++. If variadic macros (C99,
// GCC, MVSC, etc) you can also pass a variable length tuple `..., ...` for
// params and nothing `` for no params.
@@ -116,6 +114,10 @@
* @Note Local functions are functors. They cannot be copied but they can be
* assigned to other functor objects like @RefClass{boost::local::function}.
*
+ * @Note This macro cannot be used multiple times on the same line because it
+ * internally uses the line number <c>__LINE__</c> to generate unique
+ * identifiers.
+ *
* @See @RefSect{Tutorial} section, @RefSect2{Advanced_Topics, Advanced Topics}
* section, @RefMacro{BOOST_LOCAL_FUNCTION_PARAMS_TPL},
* @RefMacro{BOOST_LOCAL_FUNCTION_NAME}, @RefClass{boost::local::function}.
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-24 11:17:58 EDT (Thu, 24 Mar 2011)
@@ -33,7 +33,7 @@
</span>BOOST_IDENTITY_TYPE(parenthesized_type)</pre></div>
<div class="refsect1">
-<a name="id914290"></a><h2>Description</h2>
+<a name="id915580"></a><h2>Description</h2>
<p>This macro expands to an expression that can be passed as a single macro parameter even if it contains commas and that evaluates to the specified type at compile-time (see the <a class="link" href="boost_local/Advanced_Topics.html" title="Advanced Topics"> Advanced Topics</a> section).</p>
<p>For example <code class="computeroutput">BOOST_IDENTITY_TYPE((std::map<int, double>))</code> can be passed as a single macro parameter when instead <code class="computeroutput">std::map<int, double></code> cannot (because it contains a comma not wrapped by round parenthesis so it will be interpreted as two separate macro parameters by the preprocessor).</p>
<p><span class="bold"><strong>Parameters:</strong></span> </p>
Modified: sandbox/local/libs/local/doc/html/BOOST_IDENTITY_VALUE.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_IDENTITY_VALUE.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_IDENTITY_VALUE.html 2011-03-24 11:17:58 EDT (Thu, 24 Mar 2011)
@@ -33,7 +33,7 @@
</span>BOOST_IDENTITY_VALUE(parenthesized_value)</pre></div>
<div class="refsect1">
-<a name="id914431"></a><h2>Description</h2>
+<a name="id915721"></a><h2>Description</h2>
<p>This macro expands to an expression that can be passed as a single macro parameter even if it contains commas and that evaluates to the specified value at run-time (see the <a class="link" href="boost_local/Advanced_Topics.html" title="Advanced Topics"> Advanced Topics</a> section).</p>
<p>For example <code class="computeroutput">BOOST_IDENTITY_VALUE((key_sizeof<int, double>::value))</code> can be passed as a single macro parameter when instead <code class="computeroutput">key_sizeof<int, double>::value</code> cannot (because it contains a comma not wrapped by round parenthesis so it will be interpreted as two separate macro parameters by the preprocessor).</p>
<p><span class="bold"><strong>Parameters:</strong></span> </p>
Modified: sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK.html 2011-03-24 11:17:58 EDT (Thu, 24 Mar 2011)
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_BLOCK(bindings)</pre></div>
<div class="refsect1">
-<a name="id909323"></a><h2>Description</h2>
+<a name="id910531"></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>
@@ -73,6 +73,7 @@
</table></div>
<p>
</p>
+<p><span class="bold"><strong>Note:</strong></span> This macro cannot be used multiple times on the same line because it internally uses the line number <code class="computeroutput">__LINE__</code> to generate unique identifiers.</p>
<p><span class="bold"><strong>See:</strong></span> <a class="link" href="boost_local/Tutorial.html" title="Tutorial">Tutorial</a> section, <a class="link" href="boost_local/Advanced_Topics.html" title="Advanced Topics"> Advanced Topics</a> section, <code class="computeroutput"><a class="link" href="BOOST_LOCAL_BLOCK_TPL.html" title="Macro BOOST_LOCAL_BLOCK_TPL">BOOST_LOCAL_BLOCK_TPL</a></code>, <code class="computeroutput"><a class="link" href="BOOST_LOCAL_BLOCK_END.html" title="Macro BOOST_LOCAL_BLOCK_END">BOOST_LOCAL_BLOCK_END</a></code>. </p>
</div>
</div>
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-24 11:17:58 EDT (Thu, 24 Mar 2011)
@@ -33,8 +33,9 @@
</span>BOOST_LOCAL_BLOCK_END</pre></div>
<div class="refsect1">
-<a name="id910044"></a><h2>Description</h2>
+<a name="id911268"></a><h2>Description</h2>
<p>This macro must follow the local block body code <code class="computeroutput">{ ... }</code> as shown in the <code class="computeroutput"><a class="link" href="BOOST_LOCAL_BLOCK.html" title="Macro BOOST_LOCAL_BLOCK">BOOST_LOCAL_BLOCK</a></code> documentation.</p>
+<p><span class="bold"><strong>Note:</strong></span> This macro cannot be used multiple times on the same line because it internally uses the line number <code class="computeroutput">__LINE__</code> to generate unique identifiers.</p>
<p><span class="bold"><strong>See:</strong></span> <code class="computeroutput"><a class="link" href="BOOST_LOCAL_BLOCK.html" title="Macro BOOST_LOCAL_BLOCK">BOOST_LOCAL_BLOCK</a></code>, <a class="link" href="boost_local/Tutorial.html" title="Tutorial">Tutorial</a> section. </p>
</div>
</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-24 11:17:58 EDT (Thu, 24 Mar 2011)
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_BLOCK_TPL(bindings)</pre></div>
<div class="refsect1">
-<a name="id909970"></a><h2>Description</h2>
+<a name="id911194"></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-24 11:17:58 EDT (Thu, 24 Mar 2011)
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_CONFIG_COMPLIANT</pre></div>
<div class="refsect1">
-<a name="id910196"></a><h2>Description</h2>
+<a name="id911436"></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-24 11:17:58 EDT (Thu, 24 Mar 2011)
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_CONFIG_FUNCTION_ARITY_MAX</pre></div>
<div class="refsect1">
-<a name="id910371"></a><h2>Description</h2>
+<a name="id911612"></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-24 11:17:58 EDT (Thu, 24 Mar 2011)
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_CONFIG_THIS_PARAM_NAME</pre></div>
<div class="refsect1">
-<a name="id910467"></a><h2>Description</h2>
+<a name="id911707"></a><h2>Description</h2>
<p>If programmers leave this configuration macro undefined, the default symbol used is <code class="computeroutput">this_</code>.</p>
<p><span class="bold"><strong>Warning:</strong></span> Programmers should not define this macro unless it is absolutely necessary (e.g., to avoid name clashes with another library which cannot be changed). Changing the symbol <code class="computeroutput">this_</code> effectively changes the public API of this library.</p>
<p><span class="bold"><strong>See:</strong></span> <a class="link" href="boost_local/Getting_Started.html" title="Getting Started"> Getting Started</a> section. </p>
Modified: sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT.html 2011-03-24 11:17:58 EDT (Thu, 24 Mar 2011)
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_EXIT(binding_list)</pre></div>
<div class="refsect1">
-<a name="id910607"></a><h2>Description</h2>
+<a name="id911848"></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>
@@ -73,6 +73,7 @@
</table></div>
<p>
</p>
+<p><span class="bold"><strong>Note:</strong></span> This macro cannot be used multiple times on the same line because it internally uses the line number <code class="computeroutput">__LINE__</code> to generate unique identifiers.</p>
<p><span class="bold"><strong>See:</strong></span> <a class="link" href="boost_local/Tutorial.html" title="Tutorial">Tutorial</a> section, <a class="link" href="boost_local/Advanced_Topics.html" title="Advanced Topics"> Advanced Topics</a> section, <code class="computeroutput"><a class="link" href="BOOST_LOCAL_EXIT_TPL.html" title="Macro BOOST_LOCAL_EXIT_TPL">BOOST_LOCAL_EXIT_TPL</a></code>, <code class="computeroutput"><a class="link" href="BOOST_LOCAL_EXIT_END.html" title="Macro BOOST_LOCAL_EXIT_END">BOOST_LOCAL_EXIT_END</a></code>. </p>
</div>
</div>
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-24 11:17:58 EDT (Thu, 24 Mar 2011)
@@ -33,8 +33,9 @@
</span>BOOST_LOCAL_EXIT_END</pre></div>
<div class="refsect1">
-<a name="id911339"></a><h2>Description</h2>
+<a name="id912596"></a><h2>Description</h2>
<p>This macro must follow the local exit body code <code class="computeroutput">{ ... }</code> as shown in the <code class="computeroutput"><a class="link" href="BOOST_LOCAL_EXIT.html" title="Macro BOOST_LOCAL_EXIT">BOOST_LOCAL_EXIT</a></code> documentation.</p>
+<p><span class="bold"><strong>Note:</strong></span> This macro cannot be used multiple times on the same line because it internally uses the line number <code class="computeroutput">__LINE__</code> to generate unique identifiers.</p>
<p><span class="bold"><strong>See:</strong></span> <code class="computeroutput"><a class="link" href="BOOST_LOCAL_EXIT.html" title="Macro BOOST_LOCAL_EXIT">BOOST_LOCAL_EXIT</a></code>, <a class="link" href="boost_local/Tutorial.html" title="Tutorial">Tutorial</a> section. </p>
</div>
</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-24 11:17:58 EDT (Thu, 24 Mar 2011)
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_EXIT_TPL(binding_list)</pre></div>
<div class="refsect1">
-<a name="id911265"></a><h2>Description</h2>
+<a name="id912522"></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-24 11:17:58 EDT (Thu, 24 Mar 2011)
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_FUNCTION_NAME(name)</pre></div>
<div class="refsect1">
-<a name="id913769"></a><h2>Description</h2>
+<a name="id915059"></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-24 11:17:58 EDT (Thu, 24 Mar 2011)
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_FUNCTION_PARAMS(parameters)</pre></div>
<div class="refsect1">
-<a name="id912811"></a><h2>Description</h2>
+<a name="id914085"></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>
@@ -84,6 +84,7 @@
<p>
</p>
<p><span class="bold"><strong>Note:</strong></span> Local functions are functors. They cannot be copied but they can be assigned to other functor objects like <code class="computeroutput"><a class="link" href="boost/local/function.html" title="Struct template function">boost::local::function</a></code>.</p>
+<p><span class="bold"><strong>Note:</strong></span> This macro cannot be used multiple times on the same line because it internally uses the line number <code class="computeroutput">__LINE__</code> to generate unique identifiers.</p>
<p><span class="bold"><strong>See:</strong></span> <a class="link" href="boost_local/Tutorial.html" title="Tutorial">Tutorial</a> section, <a class="link" href="boost_local/Advanced_Topics.html" title="Advanced Topics"> Advanced Topics</a> section, <code class="computeroutput"><a class="link" href="BOOST_LOCAL_FUNCTION_PARAMS_TPL.html" title="Macro BOOST_LOCAL_FUNCTION_PARAMS_TPL">BOOST_LOCAL_FUNCTION_PARAMS_TPL</a></code>, <code class="computeroutput"><a class="link" href="BOOST_LOCAL_FUNCTION_NAME.html" title="Macro BOOST_LOCAL_FUNCTION_NAME">BOOST_LOCAL_FUNCTION_NAME</a></code>, <code class="computeroutput"><a class="link" href="boost/local/function.html" title="Struct template function">boost::local::function</a></code>. </p>
</div>
</div>
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-24 11:17:58 EDT (Thu, 24 Mar 2011)
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_FUNCTION_PARAMS_TPL(parameters)</pre></div>
<div class="refsect1">
-<a name="id913695"></a><h2>Description</h2>
+<a name="id914985"></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-24 11:17:58 EDT (Thu, 24 Mar 2011)
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_TYPEOF(bound_variable_name)</pre></div>
<div class="refsect1">
-<a name="id913963"></a><h2>Description</h2>
+<a name="id915253"></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-24 11:17:58 EDT (Thu, 24 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="id911683"></a><h2>Description</h2>
+<a name="id912957"></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-24 11:17:58 EDT (Thu, 24 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="id880229" href="#ftn.id880229" 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="id881137" href="#ftn.id881137" 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="id881587" href="#ftn.id881587" class="footnote">16</a>]</sup>
+ macro. <sup>[<a name="id882495" href="#ftn.id882495" 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="id882892" href="#ftn.id882892" class="footnote">17</a>]</sup>
+ Consider the following complete example: <sup>[<a name="id883800" href="#ftn.id883800" class="footnote">17</a>]</sup>
</p>
<div class="informaltable"><table class="table">
<colgroup>
@@ -1888,14 +1888,14 @@
</tbody>
</table></div>
<a name="boost_local.Advanced_Topics.limitations__overloading__operators__etc_.overloading"></a><h6>
-<a name="id908490"></a>
+<a name="id909398"></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="id908514" href="#ftn.id908514" class="footnote">18</a>]</sup>
+ parameters). <sup>[<a name="id909422" href="#ftn.id909422" class="footnote">18</a>]</sup>
</p>
<p>
For example, the following code will <span class="bold"><strong>not</strong></span>
@@ -1914,12 +1914,12 @@
<span class="special">}</span>
</pre>
<a name="boost_local.Advanced_Topics.limitations__overloading__operators__etc_.operators"></a><h6>
-<a name="id908820"></a>
+<a name="id909728"></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="id908857" href="#ftn.id908857" class="footnote">19</a>]</sup>
+ will generate a compile-time error. <sup>[<a name="id909765" href="#ftn.id909765" class="footnote">19</a>]</sup>
</p>
<p>
For example, the following code will <span class="bold"><strong>not</strong></span>
@@ -1932,31 +1932,55 @@
<span class="special">};</span>
<span class="keyword">bool</span> <code class="computeroutput"><a class="link" href="../BOOST_LOCAL_FUNCTION_PARAMS.html" title="Macro BOOST_LOCAL_FUNCTION_PARAMS">BOOST_LOCAL_FUNCTION_PARAMS</a></code><span class="special">(</span>
- <span class="special">(</span><span class="keyword">const</span> <span class="identifier">point</span><span class="special">&)(</span><span class="identifier">p</span><span class="special">)</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">point</span><span class="special">&)(</span><span class="identifier">q</span><span class="special">)</span> <span class="special">)</span> <span class="special">{</span>
+ <span class="special">(</span><span class="keyword">const</span> <span class="identifier">point</span><span class="special">&</span> <span class="identifier">p</span><span class="special">)</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">point</span><span class="special">&</span> <span class="identifier">q</span><span class="special">)</span> <span class="special">)</span> <span class="special">{</span>
<span class="keyword">return</span> <span class="identifier">p</span><span class="special">.</span><span class="identifier">x</span> <span class="special">==</span> <span class="identifier">q</span><span class="special">.</span><span class="identifier">x</span> <span class="special">&&</span> <span class="identifier">p</span><span class="special">.</span><span class="identifier">y</span> <span class="special">==</span> <span class="identifier">q</span><span class="special">.</span><span class="identifier">y</span><span class="special">;</span>
<span class="special">)</span> <code class="computeroutput"><a class="link" href="../BOOST_LOCAL_FUNCTION_NAME.html" title="Macro BOOST_LOCAL_FUNCTION_NAME">BOOST_LOCAL_FUNCTION_NAME</a></code><span class="special">(</span><span class="keyword">operator</span><span class="special">==)</span> <span class="comment">// Error: Cannot be `operator==`.
</span>
<span class="special">...</span>
<span class="special">}</span>
</pre>
+<a name="boost_local.Advanced_Topics.limitations__overloading__operators__etc_.goto"></a><h6>
+<a name="id910140"></a>
+ <a class="link" href="Advanced_Topics.html#boost_local.Advanced_Topics.limitations__overloading__operators__etc_.goto">Goto</a>
+ </h6>
+<p>
+ It is not possible to jump with a <code class="computeroutput"><span class="keyword">goto</span></code>
+ from within a local function, local block, or local exit to a label defined
+ in the enclosing scope.
+ </p>
+<p>
+ For example, the following will <span class="bold"><strong>not</strong></span> compile:
+ </p>
+<pre class="programlisting"><span class="keyword">int</span> <span class="identifier">f</span><span class="special">()</span> <span class="special">{</span>
+ <span class="keyword">void</span> <code class="computeroutput"><a class="link" href="../BOOST_LOCAL_FUNCTION_PARAMS.html" title="Macro BOOST_LOCAL_FUNCTION_PARAMS">BOOST_LOCAL_FUNCTION_PARAMS</a></code><span class="special">(</span> <span class="special">(</span><span class="identifier">boost</span> <span class="identifier">error</span><span class="special">)</span> <span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">error</span><span class="special">)</span> <span class="keyword">goto</span> <span class="identifier">failure</span><span class="special">;</span> <span class="comment">// Error: Cannot jump to enclosing label `failure`.
+</span> <span class="special">}</span> <code class="computeroutput"><a class="link" href="../BOOST_LOCAL_FUNCTION_NAME.html" title="Macro BOOST_LOCAL_FUNCTION_NAME">BOOST_LOCAL_FUNCTION_NAME</a></code><span class="special">(</span><span class="identifier">l</span><span class="special">)</span>
+
+ <span class="identifier">l</span><span class="special">(</span><span class="keyword">true</span><span class="special">);</span>
+
+ <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
+<span class="identifier">failure</span><span class="special">:</span>
+ <span class="keyword">return</span> <span class="special">-</span><span class="number">1</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
</div>
<div class="footnotes">
<br><hr width="100" align="left">
-<div class="footnote"><p><sup>[<a id="ftn.id880229" href="#id880229" class="para">15</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id881137" href="#id881137" 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.id881587" href="#id881587" class="para">16</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id882495" href="#id882495" 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.id882892" href="#id882892" class="para">17</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id883800" href="#id883800" 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
@@ -1964,14 +1988,14 @@
(unless template metaprogramming is being used) so this is usually not
a problem.
</p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id908514" href="#id908514" class="para">18</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id909422" href="#id909422" 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.id908857" href="#id908857" class="para">19</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id909765" href="#id909765" 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/Examples.html
==============================================================================
--- sandbox/local/libs/local/doc/html/boost_local/Examples.html (original)
+++ sandbox/local/libs/local/doc/html/boost_local/Examples.html 2011-03-24 11:17:58 EDT (Thu, 24 Mar 2011)
@@ -35,6 +35,8 @@
(C++0x Lambdas)</a></span></dt>
<dt><span class="section"><a href="Examples.html#boost_local.Examples.binding__this___c__0x_lambdas_">Binding
<code class="computeroutput"><span class="keyword">this</span></code> (C++0x Lambdas)</a></span></dt>
+<dt><span class="section"><a href="Examples.html#boost_local.Examples.gcc_nested_functions">GCC Nested
+ Functions</a></span></dt>
<dt><span class="section"><a href="Examples.html#boost_local.Examples.all_parameter_permutations">All
Parameter Permutations</a></span></dt>
</dl></div>
@@ -733,6 +735,200 @@
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_local.Examples.gcc_nested_functions"></a><a class="link" href="Examples.html#boost_local.Examples.gcc_nested_functions" title="GCC Nested Functions">GCC Nested
+ Functions</a>
+</h3></div></div></div>
+<p>
+ The GCC compiler supports local functions under the name of <a href="http://gcc.gnu.org/onlinedocs/gcc/Nested-Functions.html" target="_top">nested
+ functions</a>. Nested functions are exclusively an extension of the GCC
+ compiler and they are not part of any C++ standard (ISO C++, C99, C++0x,
+ etc) nor they are supported by other compilers like MSVC.
+ </p>
+<p>
+ The following examples rework the GCC nested function examples using this
+ library local functions.
+ </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<thead><tr>
+<th>
+ <p>
+ Variadic Macro Syntax (C99 and later compilers)
+ </p>
+ </th>
+<th>
+ <p>
+ Sequencing Macro Syntax (all C++ compilers)
+ </p>
+ </th>
+</tr></thead>
+<tbody>
+<tr>
+<td>
+ <p>
+
+</p>
+<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">function</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span>
+
+<span class="keyword">double</span> <span class="identifier">add_square</span><span class="special">(</span><span class="keyword">double</span> <span class="identifier">a</span><span class="special">,</span> <span class="keyword">double</span> <span class="identifier">b</span><span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">double</span> <span class="identifier">BOOST_LOCAL_FUNCTION_PARAMS</span><span class="special">(</span><span class="keyword">double</span> <span class="identifier">z</span><span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">z</span> <span class="special">*</span> <span class="identifier">z</span><span class="special">;</span>
+ <span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">square</span><span class="special">)</span>
+
+ <span class="keyword">return</span> <span class="identifier">square</span><span class="special">(</span><span class="identifier">a</span><span class="special">)</span> <span class="special">+</span> <span class="identifier">square</span><span class="special">(</span><span class="identifier">b</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">cout</span> <span class="special"><<</span> <span class="identifier">add_square</span><span class="special">(</span><span class="number">2.0</span><span class="special">,</span> <span class="number">3.0</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+ </td>
+<td>
+ <p>
+
+</p>
+<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">function</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span>
+
+<span class="keyword">double</span> <span class="identifier">add_square</span><span class="special">(</span><span class="keyword">double</span> <span class="identifier">a</span><span class="special">,</span> <span class="keyword">double</span> <span class="identifier">b</span><span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">double</span> <span class="identifier">BOOST_LOCAL_FUNCTION_PARAMS</span><span class="special">(</span> <span class="special">(</span><span class="keyword">double</span> <span class="identifier">z</span><span class="special">)</span> <span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">z</span> <span class="special">*</span> <span class="identifier">z</span><span class="special">;</span>
+ <span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">square</span><span class="special">)</span>
+
+ <span class="keyword">return</span> <span class="identifier">square</span><span class="special">(</span><span class="identifier">a</span><span class="special">)</span> <span class="special">+</span> <span class="identifier">square</span><span class="special">(</span><span class="identifier">b</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">cout</span> <span class="special"><<</span> <span class="identifier">add_square</span><span class="special">(</span><span class="number">2.0</span><span class="special">,</span> <span class="number">3.0</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+
+</p>
+<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">function</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span>
+
+<span class="keyword">void</span> <span class="identifier">bar</span><span class="special">(</span><span class="keyword">int</span><span class="special">*</span> <span class="identifier">array</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">offset</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">size</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="special">*</span> <span class="identifier">array</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">index</span><span class="special">,</span>
+ <span class="keyword">const</span> <span class="identifier">bind</span> <span class="identifier">offset</span><span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">array</span><span class="special">[</span><span class="identifier">index</span> <span class="special">+</span> <span class="identifier">offset</span><span class="special">];</span>
+ <span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">access</span><span class="special">)</span>
+
+ <span class="keyword">for</span> <span class="special">(</span><span class="keyword">int</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><</span> <span class="identifier">size</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">access</span><span class="special">(</span><span class="identifier">array</span><span class="special">,</span> <span class="identifier">i</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="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="keyword">int</span> <span class="identifier">nums</span><span class="special">[</span><span class="number">3</span><span class="special">]</span> <span class="special">=</span> <span class="special">{</span><span class="number">1</span><span class="special">,</span> <span class="number">2</span><span class="special">,</span> <span class="number">3</span><span class="special">};</span>
+ <span class="identifier">bar</span><span class="special">(</span><span class="identifier">nums</span><span class="special">,</span> <span class="number">0</span><span class="special">,</span> <span class="number">3</span><span class="special">);</span>
+ <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+ </td>
+<td>
+ <p>
+
+</p>
+<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">function</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span>
+
+<span class="keyword">void</span> <span class="identifier">bar</span><span class="special">(</span><span class="keyword">int</span><span class="special">*</span> <span class="identifier">array</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">offset</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">size</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="special">*</span> <span class="identifier">array</span><span class="special">)</span> <span class="special">(</span><span class="keyword">int</span> <span class="identifier">index</span><span class="special">)</span>
+ <span class="special">(</span><span class="keyword">const</span> <span class="identifier">bind</span> <span class="identifier">offset</span><span class="special">)</span> <span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">array</span><span class="special">[</span><span class="identifier">index</span> <span class="special">+</span> <span class="identifier">offset</span><span class="special">];</span>
+ <span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">access</span><span class="special">)</span>
+
+ <span class="keyword">for</span> <span class="special">(</span><span class="keyword">int</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><</span> <span class="identifier">size</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">access</span><span class="special">(</span><span class="identifier">array</span><span class="special">,</span> <span class="identifier">i</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="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="keyword">int</span> <span class="identifier">nums</span><span class="special">[</span><span class="number">3</span><span class="special">]</span> <span class="special">=</span> <span class="special">{</span><span class="number">1</span><span class="special">,</span> <span class="number">2</span><span class="special">,</span> <span class="number">3</span><span class="special">};</span>
+ <span class="identifier">bar</span><span class="special">(</span><span class="identifier">nums</span><span class="special">,</span> <span class="number">0</span><span class="special">,</span> <span class="number">3</span><span class="special">);</span>
+ <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+
+</p>
+<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">function</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+
+<span class="keyword">void</span> <span class="identifier">intermediate</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">local</span><span class="special">::</span><span class="identifier">function</span><span class="special"><</span><span class="keyword">void</span> <span class="special">(</span><span class="keyword">int</span><span class="special">,</span> <span class="keyword">int</span><span class="special">)></span> <span class="identifier">store_func</span><span class="special">,</span>
+ <span class="keyword">int</span> <span class="identifier">size</span><span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">store_func</span><span class="special">(</span><span class="identifier">size</span> <span class="special">-</span> <span class="number">1</span><span class="special">,</span> <span class="special">-</span><span class="number">1</span><span class="special">);</span>
+<span class="special">}</span>
+
+<span class="keyword">void</span> <span class="identifier">hack</span><span class="special">(</span><span class="keyword">int</span><span class="special">*</span> <span class="identifier">array</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">size</span><span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">void</span> <span class="identifier">BOOST_LOCAL_FUNCTION_PARAMS</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">index</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">value</span><span class="special">,</span> <span class="identifier">bind</span> <span class="identifier">array</span><span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">array</span><span class="special">[</span><span class="identifier">index</span><span class="special">]</span> <span class="special">=</span> <span class="identifier">value</span><span class="special">;</span>
+ <span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">store</span><span class="special">)</span>
+
+ <span class="identifier">intermediate</span><span class="special">(</span><span class="identifier">store</span><span class="special">,</span> <span class="identifier">size</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="keyword">return</span> <span class="number">0</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+ </td>
+<td>
+ <p>
+
+</p>
+<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">function</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+
+<span class="keyword">void</span> <span class="identifier">intermediate</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">local</span><span class="special">::</span><span class="identifier">function</span><span class="special"><</span><span class="keyword">void</span> <span class="special">(</span><span class="keyword">int</span><span class="special">,</span> <span class="keyword">int</span><span class="special">)></span> <span class="identifier">store_func</span><span class="special">,</span>
+ <span class="keyword">int</span> <span class="identifier">size</span><span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">store_func</span><span class="special">(</span><span class="identifier">size</span> <span class="special">-</span> <span class="number">1</span><span class="special">,</span> <span class="special">-</span><span class="number">1</span><span class="special">);</span>
+<span class="special">}</span>
+
+<span class="keyword">void</span> <span class="identifier">hack</span><span class="special">(</span><span class="keyword">int</span><span class="special">*</span> <span class="identifier">array</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">size</span><span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">void</span> <span class="identifier">BOOST_LOCAL_FUNCTION_PARAMS</span><span class="special">(</span> <span class="special">(</span><span class="keyword">int</span> <span class="identifier">index</span><span class="special">)</span> <span class="special">(</span><span class="keyword">int</span> <span class="identifier">value</span><span class="special">)</span> <span class="special">(</span><span class="identifier">bind</span> <span class="identifier">array</span><span class="special">)</span> <span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">array</span><span class="special">[</span><span class="identifier">index</span><span class="special">]</span> <span class="special">=</span> <span class="identifier">value</span><span class="special">;</span>
+ <span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">store</span><span class="special">)</span>
+
+ <span class="identifier">intermediate</span><span class="special">(</span><span class="identifier">store</span><span class="special">,</span> <span class="identifier">size</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="keyword">return</span> <span class="number">0</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+ </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
<a name="boost_local.Examples.all_parameter_permutations"></a><a class="link" href="Examples.html#boost_local.Examples.all_parameter_permutations" title="All Parameter Permutations">All
Parameter Permutations</a>
</h3></div></div></div>
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-24 11:17:58 EDT (Thu, 24 Mar 2011)
@@ -155,7 +155,7 @@
<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 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 the member variable named `...args` to support nesting (local classes cannot have static member variable). 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"><</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">>::</span><span class="identifier">type</span> <span class="special">&</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>
Modified: sandbox/local/libs/local/doc/html/boost_local/Release_Notes.html
==============================================================================
--- sandbox/local/libs/local/doc/html/boost_local/Release_Notes.html (original)
+++ sandbox/local/libs/local/doc/html/boost_local/Release_Notes.html 2011-03-24 11:17:58 EDT (Thu, 24 Mar 2011)
@@ -70,13 +70,28 @@
</h3></div></div></div>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
- Finish local function parenthesized syntax validation macros.
+ <span class="bold"><strong>Examples.</strong></span> Compile with COMPLIANT (local
+ and/or typeof) defined. Disable va and ep examples if COMPLIANT and/or
+ NO_VARIADICS.
</li>
<li class="listitem">
- Add examples to Alternatives section for Local Classes, C++0x lambads,
- Boost.Lambda, and Boost.Phoenix (ask boosters).
+ <span class="bold"><strong>Examples.</strong></span> Use std::cout instead of std::clog
+ in all examples.
+ </li>
+<li class="listitem">
+ <span class="bold"><strong>Code.</strong></span> Optimize macro expansion code
+ for C++0x, C++03, etc. From John Bytheway:
</li>
</ol></div>
+<pre class="programlisting"><span class="special">></span> <span class="identifier">Yes</span><span class="special">,</span> <span class="identifier">in</span> <span class="identifier">C</span><span class="special">++</span><span class="number">0</span><span class="identifier">x</span> <span class="identifier">local</span> <span class="identifier">structs</span> <span class="identifier">can</span> <span class="identifier">be</span> <span class="identifier">passed</span> <span class="identifier">as</span> <span class="keyword">template</span> <span class="identifier">parameters</span><span class="special">.</span>
+<span class="special">></span> <span class="identifier">Obviously</span><span class="special">,</span> <span class="identifier">in</span> <span class="identifier">C</span><span class="special">++</span><span class="number">0</span><span class="identifier">x</span> <span class="identifier">there</span> <span class="identifier">are</span> <span class="identifier">lambdas</span> <span class="identifier">too</span><span class="special">,</span> <span class="identifier">so</span> <span class="identifier">you</span> <span class="identifier">might</span> <span class="identifier">think</span> <span class="identifier">your</span>
+<span class="special">></span> <span class="identifier">library</span> <span class="identifier">is</span> <span class="identifier">useless</span><span class="special">,</span> <span class="identifier">but</span> <span class="identifier">I</span><span class="error">'</span><span class="identifier">d</span> <span class="identifier">expect</span> <span class="identifier">most</span> <span class="identifier">compilers</span> <span class="identifier">to</span> <span class="identifier">support</span> <span class="identifier">passing</span>
+<span class="special">></span> <span class="identifier">local</span> <span class="identifier">structs</span> <span class="identifier">as</span> <span class="keyword">template</span> <span class="identifier">parameters</span> <span class="identifier">before</span> <span class="identifier">they</span> <span class="identifier">support</span> <span class="identifier">lambdas</span><span class="special">,</span> <span class="identifier">so</span>
+<span class="special">></span> <span class="identifier">there</span> <span class="identifier">is</span> <span class="identifier">some</span> <span class="identifier">advantage</span> <span class="identifier">in</span> <span class="identifier">having</span> <span class="keyword">this</span> <span class="identifier">intermediate</span> <span class="identifier">implementation</span><span class="special">.</span>
+<span class="special">></span> <span class="identifier">Also</span><span class="special">,</span> <span class="identifier">your</span> <span class="identifier">macros</span> <span class="identifier">would</span> <span class="identifier">allow</span> <span class="identifier">writing</span> <span class="identifier">code</span> <span class="identifier">that</span> <span class="identifier">worked</span> <span class="identifier">in</span> <span class="identifier">C</span><span class="special">++</span><span class="number">0</span><span class="identifier">x</span> <span class="keyword">and</span>
+<span class="special">></span> <span class="identifier">C</span><span class="special">++</span><span class="number">03</span><span class="special">,</span> <span class="identifier">with</span> <span class="identifier">the</span> <span class="keyword">virtual</span> <span class="identifier">function</span> <span class="identifier">business</span> <span class="identifier">in</span> <span class="identifier">only</span> <span class="identifier">those</span> <span class="identifier">compilers</span><span class="special">/</span><span class="identifier">modes</span>
+<span class="special">></span> <span class="identifier">where</span> <span class="identifier">it</span> <span class="identifier">is</span> <span class="identifier">necessary</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-24 11:17:58 EDT (Thu, 24 Mar 2011)
@@ -548,6 +548,10 @@
<pre class="programlisting"><span class="keyword">const</span> <span class="identifier">bind</span><span class="special">&</span> <span class="emphasis"><em>variable-name</em></span> <span class="comment">// Bind by constant value.
</span></pre>
<p>
+ Note that when <code class="computeroutput"><span class="keyword">const</span></code> is used,
+ it must always precede <code class="computeroutput"><span class="identifier">bind</span></code>.
+ </p>
+<p>
If a variable is bound by value, then a copy of the variable value is taken
at the point of the local function declaration. If a variable is bound by
reference instead, the variable will refer to the value it has at the point
@@ -566,7 +570,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="id870527" href="#ftn.id870527" class="footnote">8</a>]</sup> Programmers might want to bind variables of complex types by
+ lambda</a> functions). <sup>[<a name="id870552" href="#ftn.id870552" 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).
@@ -579,7 +583,10 @@
by (non-constant) reference, and program the body to perform the summation:
</p>
<div class="informaltable"><table class="table">
-<colgroup><col></colgroup>
+<colgroup>
+<col>
+<col>
+</colgroup>
<thead><tr>
<th>
<p>
@@ -592,24 +599,59 @@
</p>
</th>
</tr></thead>
-<tbody>
-<tr><td>
+<tbody><tr>
+<td>
<p>
- [add_num_factor_sum_va_cpp
+
+</p>
+<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">function</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span>
+
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span> <span class="special">{</span>
+ <span class="keyword">double</span> <span class="identifier">sum</span> <span class="special">=</span> <span class="number">0.0</span><span class="special">;</span>
+ <span class="keyword">int</span> <span class="identifier">factor</span> <span class="special">=</span> <span class="number">10</span><span class="special">;</span>
+
+ <span class="keyword">void</span> <span class="identifier">BOOST_LOCAL_FUNCTION_PARAMS</span><span class="special">(</span><span class="keyword">double</span> <span class="identifier">num</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">bind</span> <span class="identifier">factor</span><span class="special">,</span>
+ <span class="identifier">bind</span><span class="special">&</span> <span class="identifier">sum</span><span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">sum</span> <span class="special">+=</span> <span class="identifier">factor</span> <span class="special">*</span> <span class="identifier">num</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">clog</span> <span class="special"><<</span> <span class="string">"Summed: "</span> <span class="special"><<</span> <span class="identifier">sum</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">add</span><span class="special">)</span>
+
+ <span class="identifier">add</span><span class="special">(</span><span class="number">100.0</span><span class="special">);</span>
+ <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
</p>
- </td></tr>
-<tr><td>
+ </td>
+<td>
<p>
- add_num_factor_sum_cpp
+
+</p>
+<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">function</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span>
+
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span> <span class="special">{</span>
+ <span class="keyword">double</span> <span class="identifier">sum</span> <span class="special">=</span> <span class="number">0.0</span><span class="special">;</span>
+ <span class="keyword">int</span> <span class="identifier">factor</span> <span class="special">=</span> <span class="number">10</span><span class="special">;</span>
+
+ <span class="keyword">void</span> <span class="identifier">BOOST_LOCAL_FUNCTION_PARAMS</span><span class="special">(</span> <span class="special">(</span><span class="keyword">double</span> <span class="identifier">num</span><span class="special">)</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">bind</span> <span class="identifier">factor</span><span class="special">)</span>
+ <span class="special">(</span><span class="identifier">bind</span><span class="special">&</span> <span class="identifier">sum</span><span class="special">)</span> <span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">sum</span> <span class="special">+=</span> <span class="identifier">factor</span> <span class="special">*</span> <span class="identifier">num</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">clog</span> <span class="special"><<</span> <span class="string">"Summed: "</span> <span class="special"><<</span> <span class="identifier">sum</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">add</span><span class="special">)</span>
+
+ <span class="identifier">add</span><span class="special">(</span><span class="number">100.0</span><span class="special">);</span>
+ <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
</p>
- </td></tr>
-</tbody>
+ </td>
+</tr></tbody>
</table></div>
-<p>
- ]
- </p>
<a name="boost_local.Tutorial.Binding.binding_the_object__code__phrase_role__keyword__this__phrase___code_"></a><h6>
-<a name="id870718"></a>
+<a name="id871539"></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 +705,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="id871037" href="#ftn.id871037" class="footnote">9</a>]</sup>
+ the bound object. <sup>[<a name="id871858" href="#ftn.id871858" 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="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
+ will not necessarily generate a compile-time error. <sup>[<a name="id871952" href="#ftn.id871952" 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>
@@ -851,7 +893,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="id874354" href="#ftn.id874354" class="footnote">11</a>]</sup>
+ <sup>[<a name="id875264" href="#ftn.id875264" class="footnote">11</a>]</sup>
</p></td></tr>
</table></div>
<p>
@@ -954,7 +996,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="id875559" href="#ftn.id875559" class="footnote">12</a>]</sup>
+ not terminate because of an uncaught exception. <sup>[<a name="id876468" href="#ftn.id876468" class="footnote">12</a>]</sup>
</p>
<p>
Only bound variables specified by <code class="literal"><span class="emphasis"><em>bindings</em></span></code>
@@ -1058,7 +1100,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="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
+ the object <code class="computeroutput"><span class="keyword">this</span></code>. <sup>[<a name="id877720" href="#ftn.id877720" 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).
@@ -1072,7 +1114,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="id877090" href="#ftn.id877090" class="footnote">14</a>]</sup>
+ the Reference section): <sup>[<a name="id877999" href="#ftn.id877999" 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>
@@ -1250,7 +1292,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.id870527" href="#id870527" class="para">8</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id870552" href="#id870552" 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
@@ -1265,7 +1307,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.id871037" href="#id871037" class="para">9</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id871858" href="#id871858" 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
@@ -1279,7 +1321,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.id871131" href="#id871131" class="para">10</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id871952" href="#id871952" 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>
@@ -1292,7 +1334,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.id874354" href="#id874354" class="para">11</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id875264" href="#id875264" 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),
@@ -1310,7 +1352,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.id875559" href="#id875559" class="para">12</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id876468" href="#id876468" 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
@@ -1319,7 +1361,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.id876810" href="#id876810" class="para">13</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id877720" href="#id877720" 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"
@@ -1344,9 +1386,9 @@
are not known under the name of "scope functions" -- they are
indeed known by either the name of "local functions" or by the
name of "<a href="http://gcc.gnu.org/onlinedocs/gcc/Nested-Functions.html" target="_top">nested
- functions</a>".
+ functions</a>" (GCC compiler extension).
</p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id877090" href="#id877090" class="para">14</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id877999" href="#id877999" 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-24 11:17:58 EDT (Thu, 24 Mar 2011)
@@ -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 24, 2011 at 00:01:35 GMT</small></p></td>
+<td align="left"><p><small>Last revised: March 24, 2011 at 15:15:22 GMT</small></p></td>
<td align="right"><div class="copyright-footer"></div></td>
</tr></table>
<hr>
Modified: sandbox/local/libs/local/doc/qbk/advanced_topics.qbk
==============================================================================
--- sandbox/local/libs/local/doc/qbk/advanced_topics.qbk (original)
+++ sandbox/local/libs/local/doc/qbk/advanced_topics.qbk 2011-03-24 11:17:58 EDT (Thu, 24 Mar 2011)
@@ -438,13 +438,31 @@
};
bool __BOOST_LOCAL_FUNCTION_PARAMS__(
- (const point&)(p) (const point&)(q) ) {
+ (const point& p) (const point& q) ) {
return p.x == q.x && p.y == q.y;
) __BOOST_LOCAL_FUNCTION_NAME__(operator==) // Error: Cannot be `operator==`.
...
}
+[h5 Goto]
+
+It is not possible to jump with a `goto` from within a local function, local block, or local exit to a label defined in the enclosing scope.
+
+For example, the following will *not* compile:
+
+ int f() {
+ void __BOOST_LOCAL_FUNCTION_PARAMS__( (boost error) ) {
+ if (error) goto failure; // Error: Cannot jump to enclosing label `failure`.
+ } __BOOST_LOCAL_FUNCTION_NAME__(l)
+
+ l(true);
+
+ return 0;
+ failure:
+ return -1;
+ }
+
[endsect]
[endsect]
Modified: sandbox/local/libs/local/doc/qbk/examples.qbk
==============================================================================
--- sandbox/local/libs/local/doc/qbk/examples.qbk (original)
+++ sandbox/local/libs/local/doc/qbk/examples.qbk 2011-03-24 11:17:58 EDT (Thu, 24 Mar 2011)
@@ -64,6 +64,22 @@
[endsect]
+[section GCC Nested Functions]
+
+The GCC compiler supports local functions under the name of [@http://gcc.gnu.org/onlinedocs/gcc/Nested-Functions.html nested functions].
+Nested functions are exclusively an extension of the GCC compiler and they are not part of any C++ standard (ISO C++, C99, C++0x, etc) nor they are supported by other compilers like MSVC.
+
+The following examples rework the GCC nested function examples using this library local functions.
+
+[table
+[ [Variadic Macro Syntax (C99 and later compilers)] [Sequencing Macro Syntax (all C++ compilers)] ]
+[ [ [gcc_square_va_cpp] ] [ [gcc_square_cpp] ] ]
+[ [ [gcc_access_va_cpp] ] [ [gcc_access_cpp] ] ]
+[ [ [gcc_store_va_cpp] ] [ [gcc_store_cpp] ] ]
+]
+
+[endsect]
+
[section All Parameter Permutations]
This example shows all possible parameter permutations (with and without binding, etc).
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-24 11:17:58 EDT (Thu, 24 Mar 2011)
@@ -119,6 +119,12 @@
[import ../../example/find_if_va.cpp]
[import ../../example/this.cpp]
[import ../../example/this_va.cpp]
+[import ../../example/gcc_square.cpp]
+[import ../../example/gcc_square_va.cpp]
+[import ../../example/gcc_access.cpp]
+[import ../../example/gcc_access_va.cpp]
+[import ../../example/gcc_store.cpp]
+[import ../../example/gcc_store_va.cpp]
[import ../../example/params_all.cpp]
[import ../../example/params_all_va.cpp]
[import ../../example/factorial_impl.cpp]
Modified: sandbox/local/libs/local/doc/qbk/release_notes.qbk
==============================================================================
--- sandbox/local/libs/local/doc/qbk/release_notes.qbk (original)
+++ sandbox/local/libs/local/doc/qbk/release_notes.qbk 2011-03-24 11:17:58 EDT (Thu, 24 Mar 2011)
@@ -28,8 +28,22 @@
[section TODO]
-# Finish local function parenthesized syntax validation macros.
-# Add examples to Alternatives section for Local Classes, C++0x lambads, Boost.Lambda, and Boost.Phoenix (ask boosters).
+# *Examples.* Compile with COMPLIANT (local and/or typeof) defined.
+Disable va and ep examples if COMPLIANT and/or NO_VARIADICS.
+
+# *Examples.* Use std::cout instead of std::clog in all examples.
+
+# *Code.* Optimize macro expansion code for C++0x, C++03, etc.
+From John Bytheway:
+
+ > Yes, in C++0x local structs can be passed as template parameters.
+ > Obviously, in C++0x there are lambdas too, so you might think your
+ > library is useless, but I'd expect most compilers to support passing
+ > local structs as template parameters before they support lambdas, so
+ > there is some advantage in having this intermediate implementation.
+ > Also, your macros would allow writing code that worked in C++0x and
+ > C++03, with the virtual function business in only those compilers/modes
+ > where it is necessary.
[endsect]
Modified: sandbox/local/libs/local/doc/qbk/tutorial.qbk
==============================================================================
--- sandbox/local/libs/local/doc/qbk/tutorial.qbk (original)
+++ sandbox/local/libs/local/doc/qbk/tutorial.qbk 2011-03-24 11:17:58 EDT (Thu, 24 Mar 2011)
@@ -177,6 +177,8 @@
Or by constant reference:
const bind& ``/variable-name/`` // Bind by constant value.
+
+Note that when `const` is used, it must always precede `bind`.
If a variable is bound by value, then a copy of the variable value is taken at the point of the local function declaration.
If a variable is bound by reference instead, the variable will refer to the value it has at the point of the local function call.
@@ -197,7 +199,7 @@
[table
[ [Variadic Macro Syntax (C99 and later compilers)] [Sequencing Macro Syntax (all C++ compilers)] ]
-[ [ [add_num_factor_sum_va_cpp] ] [ [add_num_factor_sum_cpp] ] ]
+[ [ [add_function_va_cpp] ] [ [add_function_cpp] ] ]
]
[h5 Binding the Object `this`]
@@ -332,7 +334,7 @@
However, the new `BOOST_SCOPE_EXIT` macro will not be backward compatible with the current __Boost_ScopeExit__ macro because it will require to prefix the bound variable with `bind` or `const bind` (in order to differentiate from constant and non-constant binding).
Local blocks would be named "scope blocks" and they would be provided by the `BOOST_SCOPE_BLOCK...` macros (the "scope block" names seem reasonably expressive).
However, local functions would have to be named "scope functions" and they would be provided by the `BOOST_SCOPE_FUNCTION...` macros.
-These names might not expressive enough because local functions are not known under the name of "scope functions" -- they are indeed known by either the name of "local functions" or by the name of "[@http://gcc.gnu.org/onlinedocs/gcc/Nested-Functions.html nested functions]".
+These names might not expressive enough because local functions are not known under the name of "scope functions" -- they are indeed known by either the name of "local functions" or by the name of "[@http://gcc.gnu.org/onlinedocs/gcc/Nested-Functions.html nested functions]" (GCC compiler extension).
]
Local exits can be used to emulate the __D_Programming_Language__ /scope guards/ (see the __Examples_Emulating_Ds_Scope_Guards__ example).
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-24 11:17:58 EDT (Thu, 24 Mar 2011)
@@ -47,14 +47,14 @@
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_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_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 gcc_store : gcc_store.cpp ;
+exe gcc_store_va : gcc_store_va.cpp ;
exe nesting : nesting.cpp ;
exe nesting_va : nesting_va.cpp ;
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-24 11:17:58 EDT (Thu, 24 Mar 2011)
@@ -105,7 +105,7 @@
// 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.
+ // 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 the member variable named `...args` to support nesting (local classes cannot have static member variable). 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_,
Deleted: sandbox/local/libs/local/example/gcc-access.cpp
==============================================================================
--- sandbox/local/libs/local/example/gcc-access.cpp 2011-03-24 11:17:58 EDT (Thu, 24 Mar 2011)
+++ (empty file)
@@ -1,23 +0,0 @@
-
-//[gcc_access_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) ) {
- 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-access_va.cpp
==============================================================================
--- sandbox/local/libs/local/example/gcc-access_va.cpp 2011-03-24 11:17:58 EDT (Thu, 24 Mar 2011)
+++ (empty file)
@@ -1,23 +0,0 @@
-
-//[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) {
- 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-square.cpp
==============================================================================
--- sandbox/local/libs/local/example/gcc-square.cpp 2011-03-24 11:17:58 EDT (Thu, 24 Mar 2011)
+++ (empty file)
@@ -1,19 +0,0 @@
-
-//[gcc_square_cpp
-#include <boost/local/function.hpp>
-#include <iostream>
-
-double add_square(double a, double b) {
- double BOOST_LOCAL_FUNCTION_PARAMS( (double z) ) {
- return z * z;
- } BOOST_LOCAL_FUNCTION_NAME(square)
-
- return square(a) + square(b);
-}
-
-int main() {
- std::cout << add_square(2.0, 3.0) << std::endl;
- return 0;
-}
-//]
-
Deleted: sandbox/local/libs/local/example/gcc-square_va.cpp
==============================================================================
--- sandbox/local/libs/local/example/gcc-square_va.cpp 2011-03-24 11:17:58 EDT (Thu, 24 Mar 2011)
+++ (empty file)
@@ -1,19 +0,0 @@
-
-//[gcc_square_va_cpp
-#include <boost/local/function.hpp>
-#include <iostream>
-
-double add_square(double a, double b) {
- double BOOST_LOCAL_FUNCTION_PARAMS(double z) {
- return z * z;
- } BOOST_LOCAL_FUNCTION_NAME(square)
-
- return square(a) + square(b);
-}
-
-int main() {
- std::cout << add_square(2.0, 3.0) << std::endl;
- return 0;
-}
-//]
-
Deleted: sandbox/local/libs/local/example/gcc-store.cpp
==============================================================================
--- sandbox/local/libs/local/example/gcc-store.cpp 2011-03-24 11:17:58 EDT (Thu, 24 Mar 2011)
+++ (empty file)
@@ -1,22 +0,0 @@
-
-//[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) ) {
- array[index] = value;
- } BOOST_LOCAL_FUNCTION_NAME(store)
-
- intermediate(store, size);
-}
-
-int main() {
- return 0;
-}
-//]
-
Deleted: sandbox/local/libs/local/example/gcc-store_va.cpp
==============================================================================
--- sandbox/local/libs/local/example/gcc-store_va.cpp 2011-03-24 11:17:58 EDT (Thu, 24 Mar 2011)
+++ (empty file)
@@ -1,22 +0,0 @@
-
-//[gcc_store_va_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) {
- 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