Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r77042 - in trunk: boost boost/local_function/detail/preprocessor libs/local_function/doc libs/local_function/doc/html libs/local_function/doc/html/boost_localfunction libs/local_function/example libs/local_function/test libs/scope_exit/example libs/scope_exit/test libs/utility/identity_type/doc libs/utility/identity_type/test
From: lorcaminiti_at_[hidden]
Date: 2012-02-16 13:24:38


Author: lcaminiti
Date: 2012-02-16 13:24:34 EST (Thu, 16 Feb 2012)
New Revision: 77042
URL: http://svn.boost.org/trac/boost/changeset/77042

Log:
Fixed a bug in BOOST_LOCAL_FUNCTION_DETAIL_PP_VOID_LIST: a typo VOId -> VOID.
Fixed a bug in scope_exit.hpp: An extra trailing \ in a macro definition (compiled only when BOOST_NO_VARIADIC_MACROS is defined).
Renamed LocalFunction and ScopeExit tests and examples from _err to _error.
Updated LocalFunction docs.
Added:
   trunk/libs/local_function/example/const_block_error.cpp
      - copied unchanged from r77032, /trunk/libs/local_function/example/const_block_err.cpp
   trunk/libs/local_function/example/noncopyable_lambda_error.cpp
      - copied, changed from r77032, /trunk/libs/local_function/example/noncopyable_lambda_err.cpp
   trunk/libs/local_function/test/goto_error.cpp
      - copied, changed from r77032, /trunk/libs/local_function/test/goto_err.cpp
   trunk/libs/local_function/test/operator_error.cpp
      - copied, changed from r77032, /trunk/libs/local_function/test/operator_err.cpp
   trunk/libs/utility/identity_type/test/var_error.cpp
      - copied, changed from r77032, /trunk/libs/utility/identity_type/test/var_err.cpp
Removed:
   trunk/libs/local_function/example/const_block_err.cpp
   trunk/libs/local_function/example/noncopyable_lambda_err.cpp
   trunk/libs/local_function/test/goto_err.cpp
   trunk/libs/local_function/test/operator_err.cpp
   trunk/libs/utility/identity_type/test/var_err.cpp
Text files modified:
   trunk/boost/local_function/detail/preprocessor/void_list.hpp | 2 +-
   trunk/boost/scope_exit.hpp | 2 +-
   trunk/libs/local_function/doc/advanced_topics.qbk | 15 ++++++++-------
   trunk/libs/local_function/doc/alternatives.qbk | 8 ++++----
   trunk/libs/local_function/doc/examples.qbk | 6 +++---
   trunk/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION.html | 2 +-
   trunk/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_CONFIG_ARITY_MAX.html | 2 +-
   trunk/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX.html | 2 +-
   trunk/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_NAME.html | 2 +-
   trunk/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_TPL.html | 2 +-
   trunk/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_TYPEOF.html | 2 +-
   trunk/libs/local_function/doc/html/boost_localfunction/Advanced_Topics.html | 20 ++++++++++++--------
   trunk/libs/local_function/doc/html/boost_localfunction/Alternatives.html | 15 ++++++++-------
   trunk/libs/local_function/doc/html/boost_localfunction/Examples.html | 13 +++++++------
   trunk/libs/local_function/doc/html/index.html | 4 ++--
   trunk/libs/local_function/doc/local_function.qbk | 8 ++++----
   trunk/libs/local_function/example/Jamfile.v2 | 10 +++++-----
   trunk/libs/local_function/example/add_phoenix.cpp | 2 +-
   trunk/libs/local_function/example/noncopyable_lambda_error.cpp | 2 +-
   trunk/libs/local_function/test/Jamfile.v2 | 9 +++++++--
   trunk/libs/local_function/test/goto_error.cpp | 2 +-
   trunk/libs/local_function/test/operator_error.cpp | 2 +-
   trunk/libs/scope_exit/example/Jamfile.v2 | 6 ++++++
   trunk/libs/scope_exit/test/Jamfile.v2 | 16 ++++++++++++----
   trunk/libs/utility/identity_type/doc/identity_type.qbk | 6 +++---
   trunk/libs/utility/identity_type/test/Jamfile.v2 | 2 +-
   trunk/libs/utility/identity_type/test/var_error.cpp | 2 +-
   27 files changed, 95 insertions(+), 69 deletions(-)

Modified: trunk/boost/local_function/detail/preprocessor/void_list.hpp
==============================================================================
--- trunk/boost/local_function/detail/preprocessor/void_list.hpp (original)
+++ trunk/boost/local_function/detail/preprocessor/void_list.hpp 2012-02-16 13:24:34 EST (Thu, 16 Feb 2012)
@@ -44,7 +44,7 @@
 #ifdef BOOST_NO_VARIADIC_MACROS
 
 #define BOOST_LOCAL_FUNCTION_DETAIL_PP_VOID_LIST_(is_void_macro, seq) \
- BOOST_LOCAL_FUNCTION_DETAIL_PP_VOId_LIST_HANDLE_SEQ_(is_void_macro, seq)
+ BOOST_LOCAL_FUNCTION_DETAIL_PP_VOID_LIST_HANDLE_SEQ_(is_void_macro, seq)
 
 #else // VARIADICS
 

Modified: trunk/boost/scope_exit.hpp
==============================================================================
--- trunk/boost/scope_exit.hpp (original)
+++ trunk/boost/scope_exit.hpp 2012-02-16 13:24:34 EST (Thu, 16 Feb 2012)
@@ -573,7 +573,7 @@
 # define BOOST_SCOPE_EXIT_TPL(void_or_seq) \
             BOOST_SCOPE_EXIT(void_or_seq)
 # endif
-# if defined(BOOST_SCOPE_EXIT_AUX_LAMBDAS) /* C++11 only */ \
+# if defined(BOOST_SCOPE_EXIT_AUX_LAMBDAS) /* C++11 only */
 # define BOOST_SCOPE_EXIT_ALL(seq) \
             BOOST_SCOPE_EXIT_AUX_IMPL( \
                   BOOST_LOCAL_FUNCTION_DETAIL_PP_LINE_COUNTER \

Modified: trunk/libs/local_function/doc/advanced_topics.qbk
==============================================================================
--- trunk/libs/local_function/doc/advanced_topics.qbk (original)
+++ trunk/libs/local_function/doc/advanced_topics.qbk 2012-02-16 13:24:34 EST (Thu, 16 Feb 2012)
@@ -157,9 +157,10 @@
 
 Note that:
 
-[important
-As with __CPP11_lambda__ functions, programmers are responsible to ensure that bound references are valid in any scope where the local function object is called.
-(This might be tricky to verify in a program when local functions are returned and called outside the local scope of their declaration.)
+[warning
+As with __CPP11_lambda__ functions, programmers are responsible to ensure that bound variables are valid in any scope where the local function object is called.
+Returning and calling a local function outside its declaration scope will lead to undefined behaviour if any of the bound variable is no longer valid in the scope where the local function is called (see the __Example__ section for more examples on the extra care needed when returning a local function closure).
+It is always safe instead to call a local function within its declaration scope.
 ]
 
 In addition, a local function can bind and call another local function.
@@ -446,17 +447,17 @@
 This is the because a local function name must be a valid local variable name (the local variable used to hold the local functor) and operators cannot be used as local variable names.
 ]
 
-For example, the following code will not compile:
+For example, the following code will not compile (see also [@../../test/operator_error.cpp =operator_error.cpp=]):
 
-[operator_err]
+[operator_error]
 
 [h5 Goto]
 
 It is not possible to jump with a `goto` from within a local function to a label defined in the enclosing scope.
 
-For example, the following will not compile:
+For example, the following will not compile (see also [@../../test/goto_error.cpp =goto_error.cpp=]):
 
-[goto_err]
+[goto_error]
 
 [endsect]
 

Modified: trunk/libs/local_function/doc/alternatives.qbk
==============================================================================
--- trunk/libs/local_function/doc/alternatives.qbk (original)
+++ trunk/libs/local_function/doc/alternatives.qbk 2012-02-16 13:24:34 EST (Thu, 16 Feb 2012)
@@ -96,11 +96,11 @@
 Both constant reference and non-constant value binding are instead supported by this library.
 However, __CPP11_lambda__ functions provide a short-hand syntax to bind all variables in scope at once (`&` or `=`).
 
-For example, for non-copyable objects (see also [@../../example/noncopyable_lambda_err.cpp =noncopyable_lambda_err.cpp=] and [@../../example/noncopyable_local_function.cpp =noncopyable_local_function.cpp=]):
+For example, for non-copyable objects (see also [@../../example/noncopyable_lambda_error.cpp =noncopyable_lambda_error.cpp=] and [@../../example/noncopyable_local_function.cpp =noncopyable_local_function.cpp=]):
 
 [table
     [ [C++11 Lambda] [Boost.LocalFunction] ]
- [ [[noncopyable_lambda_err]] [[noncopyable_local_function]] ]
+ [ [[noncopyable_lambda_error]] [[noncopyable_local_function]] ]
 ]
 
 Or, for objects with expensive copy operations (see also [@../../example/expensive_copy_lambda.cpp =expensive_copy_lambda.cpp=] and [@../../example/expensive_copy_local_function.cpp =expensive_copy_local_function.cpp=]):
@@ -110,8 +110,8 @@
     [ [[expensive_copy_lambda]] [[expensive_copy_local_function]] ]
 ]
 
-When constant binding functionality is needed for __CPP11_lambda__ functions, the best alternative might be to bind an extra local variable declared constant and initialized to the original variable (for example, `const n& const_x = x` and then bind `const_x` instead of `x` to the lambda function).
-In many cases the use of the extra constant variable `const_x` can be acceptable but in other cases (e.g., /constant blocks/ presented in the __Examples__ section) it might be preferable to maintain the same variable name `x` within the function body.
+When constant binding functionality is needed for __CPP11_lambda__ functions, the best alternative might be to bind an extra local variable declared constant and initialized to the original variable (for example, `const decltype(x)& const_x = x` and then bind `const_x` instead of `x` to the lambda function).
+In many cases the use of an extra constant variable `const_x` can be acceptable but in other cases (e.g., /constant blocks/ presented in the __Examples__ section) it might be preferable to maintain the same variable name `x` within the function body.
 
 [*Local Functor]
 

Modified: trunk/libs/local_function/doc/examples.qbk
==============================================================================
--- trunk/libs/local_function/doc/examples.qbk (original)
+++ trunk/libs/local_function/doc/examples.qbk 2012-02-16 13:24:34 EST (Thu, 16 Feb 2012)
@@ -9,7 +9,7 @@
 
 This section lists some examples that use this library.
 
-[section GCC Lambdas (Without C++11)]
+[section GCC Lambdas (without C++11)]
 
 Combing local functions with the [@http://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html statement expression] extension of GCC compilers, it is possible to implement lambda functions for GCC compilers even without __CPP11__ support.
 
@@ -46,7 +46,7 @@
 
 Ideally this code will not compile instead this example not only compiles but the assertion even passes the run-time check and no error is generated at all.
 The __N1613__ paper introduces the idea of a /const-block/ which could be used to wrap the assertion above and catch the programming error at compile-time.
-Similarly, the following code will generate a compile-time error when `operator=` is mistakenly used instead of `operator==` because both `x` and `y` are made constants (using local functions) within the block of code performing the assertion (see also [@../../example/const_block_err.cpp =const_block_err.cpp=]):
+Similarly, the following code will generate a compile-time error when `operator=` is mistakenly used instead of `operator==` because both `x` and `y` are made constants (using local functions) within the block of code performing the assertion (see also [@../../example/const_block_error.cpp =const_block_error.cpp=]):
 
 [table
     [ [With Local Functions] [N1613 Const-Blocks] ]
@@ -129,7 +129,7 @@
 
 [section Closures]
 
-The following are examples of [@http://en.wikipedia.org/wiki/Closure_(computer_science) closures] that illustrate how to return local functions to the calling scope (and the relative precautions to take).
+The following are examples of [@http://en.wikipedia.org/wiki/Closure_(computer_science) closures] that illustrate how to return local functions to the calling scope (note how extra care is taken in order to ensure that all bound variables remain valid at the calling scope):
 
 [table
     [ [Files] ]

Modified: trunk/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION.html
==============================================================================
--- trunk/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION.html (original)
+++ trunk/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION.html 2012-02-16 13:24:34 EST (Thu, 16 Feb 2012)
@@ -33,7 +33,7 @@
 
 </span>BOOST_LOCAL_FUNCTION(declarations)</pre></div>
 <div class="refsect1">
-<a name="id878789"></a><h2>Description</h2>
+<a name="id878733"></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_localfunction/Tutorial.html" title="Tutorial">Tutorial</a> and <a class="link" href="boost_localfunction/Advanced_Topics.html" title="Advanced Topics"> Advanced Topics</a> sections): </p>
 <pre class="programlisting"><span class="special">{</span> <span class="comment">// Some declarative context.</span>
     <span class="special">...</span>

Modified: trunk/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_CONFIG_ARITY_MAX.html
==============================================================================
--- trunk/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_CONFIG_ARITY_MAX.html (original)
+++ trunk/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_CONFIG_ARITY_MAX.html 2012-02-16 13:24:34 EST (Thu, 16 Feb 2012)
@@ -33,7 +33,7 @@
 
 </span>BOOST_LOCAL_FUNCTION_CONFIG_ARITY_MAX</pre></div>
 <div class="refsect1">
-<a name="id881266"></a><h2>Description</h2>
+<a name="id881966"></a><h2>Description</h2>
 <p>If programmers leave this configuration macro undefined, its default value is <code class="computeroutput">5</code> (increasing this number might increase compilation time). When defined by programmers, this macro must be a non-negative integer number.</p>
 <p><span class="bold"><strong>Note:</strong></span> This macro specifies the maximum number of local function parameters excluding bound variables (which are instead specified by <code class="computeroutput"><a class="link" href="BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX.html" title="Macro BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX">BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX</a></code>).</p>
 <p><span class="bold"><strong>See:</strong></span> <a class="link" href="boost_localfunction/Tutorial.html" title="Tutorial">Tutorial</a> section, <a class="link" href="boost_localfunction/Getting_Started.html" title="Getting Started"> Getting Started</a> section, <code class="computeroutput"><a class="link" href="BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX.html" title="Macro BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX">BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX</a></code>. </p>

Modified: trunk/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX.html
==============================================================================
--- trunk/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX.html (original)
+++ trunk/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX.html 2012-02-16 13:24:34 EST (Thu, 16 Feb 2012)
@@ -33,7 +33,7 @@
 
 </span>BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX</pre></div>
 <div class="refsect1">
-<a name="id881341"></a><h2>Description</h2>
+<a name="id882040"></a><h2>Description</h2>
 <p>If programmers leave this configuration macro undefined, its default value is <code class="computeroutput">10</code> (increasing this number might increase compilation time). When defined by programmers, this macro must be a non-negative integer number.</p>
 <p><span class="bold"><strong>Note:</strong></span> This macro specifies the maximum number of bound variables excluding local function parameters (which are instead specified by <code class="computeroutput"><a class="link" href="BOOST_LOCAL_FUNCTION_CONFIG_ARITY_MAX.html" title="Macro BOOST_LOCAL_FUNCTION_CONFIG_ARITY_MAX">BOOST_LOCAL_FUNCTION_CONFIG_ARITY_MAX</a></code>).</p>
 <p><span class="bold"><strong>See:</strong></span> <a class="link" href="boost_localfunction/Tutorial.html" title="Tutorial">Tutorial</a> section, <a class="link" href="boost_localfunction/Getting_Started.html" title="Getting Started"> Getting Started</a> section, <code class="computeroutput"><a class="link" href="BOOST_LOCAL_FUNCTION_CONFIG_ARITY_MAX.html" title="Macro BOOST_LOCAL_FUNCTION_CONFIG_ARITY_MAX">BOOST_LOCAL_FUNCTION_CONFIG_ARITY_MAX</a></code>. </p>

Modified: trunk/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_NAME.html
==============================================================================
--- trunk/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_NAME.html (original)
+++ trunk/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_NAME.html 2012-02-16 13:24:34 EST (Thu, 16 Feb 2012)
@@ -33,7 +33,7 @@
 
 </span>BOOST_LOCAL_FUNCTION_NAME(qualified_function_name)</pre></div>
 <div class="refsect1">
-<a name="id880744"></a><h2>Description</h2>
+<a name="id881444"></a><h2>Description</h2>
 <p>This macro must follow the local function body code block <code class="computeroutput">{ ... }</code>: </p>
 <pre class="programlisting"><span class="special">{</span> <span class="comment">// Some declarative context.</span>
     <span class="special">...</span>

Modified: trunk/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_TPL.html
==============================================================================
--- trunk/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_TPL.html (original)
+++ trunk/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_TPL.html 2012-02-16 13:24:34 EST (Thu, 16 Feb 2012)
@@ -33,7 +33,7 @@
 
 </span>BOOST_LOCAL_FUNCTION_TPL(declarations)</pre></div>
 <div class="refsect1">
-<a name="id880567"></a><h2>Description</h2>
+<a name="id881266"></a><h2>Description</h2>
 <p>This macro must be used instead of <code class="computeroutput"><a class="link" href="BOOST_LOCAL_FUNCTION.html" title="Macro BOOST_LOCAL_FUNCTION">BOOST_LOCAL_FUNCTION</a></code> when declaring a local function within a template. A part from that, this macro has the exact same syntax as <code class="computeroutput"><a class="link" href="BOOST_LOCAL_FUNCTION.html" title="Macro BOOST_LOCAL_FUNCTION">BOOST_LOCAL_FUNCTION</a></code> (see <code class="computeroutput"><a class="link" href="BOOST_LOCAL_FUNCTION.html" title="Macro BOOST_LOCAL_FUNCTION">BOOST_LOCAL_FUNCTION</a></code> for more information): </p>
 <pre class="programlisting"><span class="special">{</span> <span class="comment">// Some declarative context with a template.</span>
     <span class="special">...</span>

Modified: trunk/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_TYPEOF.html
==============================================================================
--- trunk/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_TYPEOF.html (original)
+++ trunk/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_TYPEOF.html 2012-02-16 13:24:34 EST (Thu, 16 Feb 2012)
@@ -33,7 +33,7 @@
 
 </span>BOOST_LOCAL_FUNCTION_TYPEOF(bound_variable_name)</pre></div>
 <div class="refsect1">
-<a name="id881054"></a><h2>Description</h2>
+<a name="id881753"></a><h2>Description</h2>
 <p>This macro can be used within the local functions body to refer to the bound variable types so to declare local variables, check concepts (using Boost.ConceptCheck), etc (see the <a class="link" href="boost_localfunction/Advanced_Topics.html" title="Advanced Topics"> Advanced Topics</a> section). This way the local function can be programmed entirely without explicitly specifying the bound variable types thus facilitating maintenance (e.g., if the type of a bound variable changes in the enclosing scope, the local function code does not have to change).</p>
 <p><span class="bold"><strong>Parameters:</strong></span> </p>
 <div class="informaltable"><table class="table">

Modified: trunk/libs/local_function/doc/html/boost_localfunction/Advanced_Topics.html
==============================================================================
--- trunk/libs/local_function/doc/html/boost_localfunction/Advanced_Topics.html (original)
+++ trunk/libs/local_function/doc/html/boost_localfunction/Advanced_Topics.html 2012-02-16 13:24:34 EST (Thu, 16 Feb 2012)
@@ -330,17 +330,21 @@
 <p>
         Note that:
       </p>
-<div class="important"><table border="0" summary="Important">
+<div class="warning"><table border="0" summary="Warning">
 <tr>
-<td rowspan="2" align="center" valign="top" width="25"><img alt="[Important]" src="../../../../../doc/src/images/important.png"></td>
-<th align="left">Important</th>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="../../../../../doc/src/images/warning.png"></td>
+<th align="left">Warning</th>
 </tr>
 <tr><td align="left" valign="top"><p>
           As with <a href="http://en.wikipedia.org/wiki/C%2B%2B0x#Lambda_functions_and_expressions" target="_top">C++11
           lambda</a> functions, programmers are responsible to ensure that bound
- references are valid in any scope where the local function object is called.
- (This might be tricky to verify in a program when local functions are returned
- and called outside the local scope of their declaration.)
+ variables are valid in any scope where the local function object is called.
+ Returning and calling a local function outside its declaration scope will
+ lead to undefined behaviour if any of the bound variable is no longer valid
+ in the scope where the local function is called (see the __Example__ section
+ for more examples on the extra care needed when returning a local function
+ closure). It is always safe instead to call a local function within its
+ declaration scope.
         </p></td></tr>
 </table></div>
 <p>
@@ -1137,7 +1141,7 @@
         will generate a compile-time error. <sup>[<a name="boost_localfunction.Advanced_Topics.limitations__operators__etc_.f1" href="#ftn.boost_localfunction.Advanced_Topics.limitations__operators__etc_.f1" class="footnote">26</a>]</sup>
       </p>
 <p>
- For example, the following code will not compile:
+ For example, the following code will not compile (see also operator_error.cpp):
       </p>
 <p>
 </p>
@@ -1167,7 +1171,7 @@
         from within a local function to a label defined in the enclosing scope.
       </p>
 <p>
- For example, the following will not compile:
+ For example, the following will not compile (see also goto_error.cpp):
       </p>
 <p>
 </p>

Modified: trunk/libs/local_function/doc/html/boost_localfunction/Alternatives.html
==============================================================================
--- trunk/libs/local_function/doc/html/boost_localfunction/Alternatives.html (original)
+++ trunk/libs/local_function/doc/html/boost_localfunction/Alternatives.html 2012-02-16 13:24:34 EST (Thu, 16 Feb 2012)
@@ -340,7 +340,7 @@
         </li>
 </ul></div>
 <p>
- For example, for non-copyable objects (see also noncopyable_lambda_err.cpp
+ For example, for non-copyable objects (see also noncopyable_lambda_error.cpp
       and noncopyable_local_function.cpp):
     </p>
 <div class="informaltable"><table class="table">
@@ -485,11 +485,12 @@
       When constant binding functionality is needed for <a href="http://en.wikipedia.org/wiki/C%2B%2B0x#Lambda_functions_and_expressions" target="_top">C++11
       lambda</a> functions, the best alternative might be to bind an extra local
       variable declared constant and initialized to the original variable (for example,
- <code class="computeroutput"><span class="keyword">const</span> <span class="identifier">n</span><span class="special">&amp;</span> <span class="identifier">const_x</span> <span class="special">=</span> <span class="identifier">x</span></code> and then
- bind <code class="computeroutput"><span class="identifier">const_x</span></code> instead of <code class="computeroutput"><span class="identifier">x</span></code> to the lambda function). In many cases
- the use of the extra constant variable <code class="computeroutput"><span class="identifier">const_x</span></code>
- can be acceptable but in other cases (e.g., <span class="emphasis"><em>constant blocks</em></span>
- presented in the <a class="link" href="Examples.html" title="Examples">Examples</a>
+ <code class="computeroutput"><span class="keyword">const</span> <span class="identifier">decltype</span><span class="special">(</span><span class="identifier">x</span><span class="special">)&amp;</span>
+ <span class="identifier">const_x</span> <span class="special">=</span>
+ <span class="identifier">x</span></code> and then bind <code class="computeroutput"><span class="identifier">const_x</span></code>
+ instead of <code class="computeroutput"><span class="identifier">x</span></code> to the lambda
+ function). In many cases the use of an extra constant variable <code class="computeroutput"><span class="identifier">const_x</span></code> can be acceptable but in other cases
+ (e.g., <span class="emphasis"><em>constant blocks</em></span> presented in the <a class="link" href="Examples.html" title="Examples">Examples</a>
       section) it might be preferable to maintain the same variable name <code class="computeroutput"><span class="identifier">x</span></code> within the function body.
     </p>
 <p>
@@ -692,7 +693,7 @@
     <span class="comment">// Passed to template, `factor` by constant, and defined in expression.</span>
     <span class="identifier">std</span><span class="special">::</span><span class="identifier">for_each</span><span class="special">(</span><span class="identifier">nums</span><span class="special">,</span> <span class="identifier">nums</span> <span class="special">+</span> <span class="number">3</span><span class="special">,</span> <span class="identifier">let</span><span class="special">(</span><span class="identifier">_f</span> <span class="special">=</span> <span class="identifier">cref</span><span class="special">(</span><span class="identifier">factor</span><span class="special">))[</span>
         <span class="comment">// Unfortunately, body cannot use C++ statement syntax.</span>
- <span class="identifier">ref</span><span class="special">(</span><span class="identifier">sum</span><span class="special">)</span> <span class="special">+=</span> <span class="identifier">_f</span> <span class="special">*</span> <span class="identifier">_1</span> <span class="comment">// Access `sum` by reference.</span>
+ <span class="identifier">ref</span><span class="special">(</span><span class="identifier">sum</span><span class="special">)</span> <span class="special">+=</span> <span class="identifier">_f</span> <span class="special">*</span> <span class="identifier">_1</span><span class="special">,</span> <span class="identifier">_1</span> <span class="comment">// Access `sum` by reference.</span>
     <span class="special">]);</span>
 
     <span class="identifier">BOOST_CHECK</span><span class="special">(</span> <span class="identifier">sum</span> <span class="special">==</span> <span class="number">60</span> <span class="special">);</span>

Modified: trunk/libs/local_function/doc/html/boost_localfunction/Examples.html
==============================================================================
--- trunk/libs/local_function/doc/html/boost_localfunction/Examples.html (original)
+++ trunk/libs/local_function/doc/html/boost_localfunction/Examples.html 2012-02-16 13:24:34 EST (Thu, 16 Feb 2012)
@@ -28,7 +28,7 @@
 </h2></div></div></div>
 <div class="toc"><dl>
 <dt><span class="section"><a href="Examples.html#boost_localfunction.Examples.gcc_lambdas__without_c__11_">GCC
- Lambdas (Without C++11)</a></span></dt>
+ Lambdas (without C++11)</a></span></dt>
 <dt><span class="section"><a href="Examples.html#boost_localfunction.Examples.constant_blocks">Constant
       Blocks</a></span></dt>
 <dt><span class="section">Scope Exits</span></dt>
@@ -44,8 +44,8 @@
     </p>
 <div class="section boost_localfunction_Examples_gcc_lambdas__without_c__11_">
 <div class="titlepage"><div><div><h3 class="title">
-<a name="boost_localfunction.Examples.gcc_lambdas__without_c__11_"></a><a class="link" href="Examples.html#boost_localfunction.Examples.gcc_lambdas__without_c__11_" title="GCC Lambdas (Without C++11)">GCC
- Lambdas (Without C++11)</a>
+<a name="boost_localfunction.Examples.gcc_lambdas__without_c__11_"></a><a class="link" href="Examples.html#boost_localfunction.Examples.gcc_lambdas__without_c__11_" title="GCC Lambdas (without C++11)">GCC
+ Lambdas (without C++11)</a>
 </h3></div></div></div>
 <p>
         Combing local functions with the <a href="http://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html" target="_top">statement
@@ -178,7 +178,7 @@
         is mistakenly used instead of <code class="computeroutput"><span class="keyword">operator</span><span class="special">==</span></code> because both <code class="computeroutput"><span class="identifier">x</span></code>
         and <code class="computeroutput"><span class="identifier">y</span></code> are made constants
         (using local functions) within the block of code performing the assertion
- (see also const_block_err.cpp):
+ (see also const_block_error.cpp):
       </p>
 <div class="informaltable"><table class="table">
 <colgroup>
@@ -441,8 +441,9 @@
 </h3></div></div></div>
 <p>
         The following are examples of closures
- that illustrate how to return local functions to the calling scope (and the
- relative precautions to take).
+ that illustrate how to return local functions to the calling scope (note
+ how extra care is taken in order to ensure that all bound variables remain
+ valid at the calling scope):
       </p>
 <div class="informaltable"><table class="table">
 <colgroup><col></colgroup>

Modified: trunk/libs/local_function/doc/html/index.html
==============================================================================
--- trunk/libs/local_function/doc/html/index.html (original)
+++ trunk/libs/local_function/doc/html/index.html 2012-02-16 13:24:34 EST (Thu, 16 Feb 2012)
@@ -81,7 +81,7 @@
 <dt><span class="section">Examples</span></dt>
 <dd><dl>
 <dt><span class="section"><a href="boost_localfunction/Examples.html#boost_localfunction.Examples.gcc_lambdas__without_c__11_">GCC
- Lambdas (Without C++11)</a></span></dt>
+ Lambdas (without C++11)</a></span></dt>
 <dt><span class="section"><a href="boost_localfunction/Examples.html#boost_localfunction.Examples.constant_blocks">Constant
       Blocks</a></span></dt>
 <dt><span class="section">Scope Exits</span></dt>
@@ -222,7 +222,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: February 14, 2012 at 15:46:08 GMT</small></p></td>
+<td align="left"><p><small>Last revised: February 16, 2012 at 18:20:11 GMT</small></p></td>
 <td align="right"><div class="copyright-footer"></div></td>
 </tr></table>
 <hr>

Modified: trunk/libs/local_function/doc/local_function.qbk
==============================================================================
--- trunk/libs/local_function/doc/local_function.qbk (original)
+++ trunk/libs/local_function/doc/local_function.qbk 2012-02-16 13:24:34 EST (Thu, 16 Feb 2012)
@@ -83,18 +83,18 @@
 [import ../test/overload.cpp]
 [import ../test/add_except.cpp]
 [import ../test/add_classifiers.cpp]
-[import ../test/operator_err.cpp]
-[import ../test/goto_err.cpp]
+[import ../test/operator_error.cpp]
+[import ../test/goto_error.cpp]
 [import ../test/seq.cpp]
 
 [import ../example/gcc_lambda.cpp]
 [import ../example/gcc_lambda_cpp11.cpp]
-[import ../example/const_block_err.cpp]
+[import ../example/const_block_error.cpp]
 [import ../example/scope_exit.cpp]
 [import ../example/scope_exit.hpp]
 [import ../example/phoenix_factorial_local.cpp]
 [import ../example/phoenix_factorial.cpp]
-[import ../example/noncopyable_lambda_err.cpp]
+[import ../example/noncopyable_lambda_error.cpp]
 [import ../example/noncopyable_local_function.cpp]
 [import ../example/expensive_copy_lambda.cpp]
 [import ../example/expensive_copy_local_function.cpp]

Modified: trunk/libs/local_function/example/Jamfile.v2
==============================================================================
--- trunk/libs/local_function/example/Jamfile.v2 (original)
+++ trunk/libs/local_function/example/Jamfile.v2 2012-02-16 13:24:34 EST (Thu, 16 Feb 2012)
@@ -11,12 +11,11 @@
 
 run add_global_functor.cpp ;
 run add_local_functor.cpp ;
-# I'm not sure why this does not compile... I've asked Booster.
-#run add_phoenix.cpp ;
+run add_phoenix.cpp ;
 
 run const_block.cpp ;
-# Compilation fails for debug but not for release builds so commented out.
-#compile-fail const_block_err.cpp ;
+compile-fail const_block_error.cpp : <variant>debug : ;
+run const_block_error.cpp : <variant>release : ;
 
 run expensive_copy_lambda.cpp ;
 run expensive_copy_local_function.cpp ;
@@ -33,12 +32,13 @@
 run n2529_this.cpp ;
 run n2550_find_if.cpp ;
 
-compile-fail noncopyable_lambda_err.cpp ;
+compile-fail noncopyable_lambda_error.cpp ;
 run noncopyable_local_function.cpp ;
 
 run phoenix_factorial.cpp ;
 run phoenix_factorial_local.cpp ;
 
+# Only compile and do not run these programs (they take a long time to run).
 exe profile_global_functor : profile_global_functor.cpp
     : <library>/boost/chrono//boost_chrono
         <library>/boost/system//boost_system

Modified: trunk/libs/local_function/example/add_phoenix.cpp
==============================================================================
--- trunk/libs/local_function/example/add_phoenix.cpp (original)
+++ trunk/libs/local_function/example/add_phoenix.cpp 2012-02-16 13:24:34 EST (Thu, 16 Feb 2012)
@@ -26,7 +26,7 @@
     // Passed to template, `factor` by constant, and defined in expression.
     std::for_each(nums, nums + 3, let(_f = cref(factor))[
         // Unfortunately, body cannot use C++ statement syntax.
- ref(sum) += _f * _1 // Access `sum` by reference.
+ ref(sum) += _f * _1, _1 // Access `sum` by reference.
     ]);
 
     BOOST_CHECK( sum == 60 );

Deleted: trunk/libs/local_function/example/const_block_err.cpp
==============================================================================
--- trunk/libs/local_function/example/const_block_err.cpp 2012-02-16 13:24:34 EST (Thu, 16 Feb 2012)
+++ (empty file)
@@ -1,20 +0,0 @@
-
-// Copyright (C) 2009-2012 Lorenzo Caminiti
-// Distributed under the Boost Software License, Version 1.0
-// (see accompanying file LICENSE_1_0.txt or a copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-// Home at http://www.boost.org/libs/local_function
-
-#include "const_block.hpp"
-#include <cassert>
-
-int main(void) {
- //[const_block
- int x = 1, y = 2;
- CONST_BLOCK(x, y) { // Constant block.
- assert(x = y); // Compiler error.
- } CONST_BLOCK_END
- //]
- return 0;
-}
-

Deleted: trunk/libs/local_function/example/noncopyable_lambda_err.cpp
==============================================================================
--- trunk/libs/local_function/example/noncopyable_lambda_err.cpp 2012-02-16 13:24:34 EST (Thu, 16 Feb 2012)
+++ (empty file)
@@ -1,37 +0,0 @@
-
-// Copyright (C) 2009-2012 Lorenzo Caminiti
-// Distributed under the Boost Software License, Version 1.0
-// (see accompanying file LICENSE_1_0.txt or a copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-// Home at http://www.boost.org/libs/local_function
-
-#include <boost/config.hpp>
-#ifndef BOOST_NO_LAMBDAS
-
-#include <boost/noncopyable.hpp>
-#include <cassert>
-
-//[noncopyable_lambda_err
-struct n: boost::noncopyable {
- int i;
- n(int _i): i(_i) {}
-};
-
-int main(void) {
- n x(-1);
-
- auto f = [x](void) { // Error: x is non-copyable, but if
- assert( x.i == -1 ); // bind `&x` then `x` is not constant.
- };
- f();
-
- return 0;
-}
-//]
-
-#else // NO_LAMBDAS
-
-#error "Trivial failure."
-
-#endif // NO_LAMBDAS
-

Copied: trunk/libs/local_function/example/noncopyable_lambda_error.cpp (from r77032, /trunk/libs/local_function/example/noncopyable_lambda_err.cpp)
==============================================================================
--- /trunk/libs/local_function/example/noncopyable_lambda_err.cpp (original)
+++ trunk/libs/local_function/example/noncopyable_lambda_error.cpp 2012-02-16 13:24:34 EST (Thu, 16 Feb 2012)
@@ -11,7 +11,7 @@
 #include <boost/noncopyable.hpp>
 #include <cassert>
 
-//[noncopyable_lambda_err
+//[noncopyable_lambda_error
 struct n: boost::noncopyable {
     int i;
     n(int _i): i(_i) {}

Modified: trunk/libs/local_function/test/Jamfile.v2
==============================================================================
--- trunk/libs/local_function/test/Jamfile.v2 (original)
+++ trunk/libs/local_function/test/Jamfile.v2 2012-02-16 13:24:34 EST (Thu, 16 Feb 2012)
@@ -23,11 +23,11 @@
 
 run factorial.cpp ;
 run goto.cpp ;
-compile-fail goto_err.cpp ;
+compile-fail goto_error.cpp ;
 run macro_commas.cpp ;
 run nesting.cpp ;
 run operator.cpp ;
-compile-fail operator_err.cpp ;
+compile-fail operator_error.cpp ;
 run overload.cpp ;
 run ten_void.cpp ;
 run transform.cpp ;
@@ -40,6 +40,11 @@
 run return_setget.cpp ;
 run return_this.cpp ;
 
+# Compile sequence syntax also forcing no variadic macros.
 run add_seq.cpp ;
+run add_seq.cpp : : : <define>BOOST_NO_VARIADIC_MACROS
+ : add_seq_no_variadics : ;
 run seq.cpp ;
+run seq.cpp : : : <define>BOOST_NO_VARIADIC_MACROS
+ : seq_no_variadics : ;
 

Deleted: trunk/libs/local_function/test/goto_err.cpp
==============================================================================
--- trunk/libs/local_function/test/goto_err.cpp 2012-02-16 13:24:34 EST (Thu, 16 Feb 2012)
+++ (empty file)
@@ -1,31 +0,0 @@
-
-// Copyright (C) 2009-2012 Lorenzo Caminiti
-// Distributed under the Boost Software License, Version 1.0
-// (see accompanying file LICENSE_1_0.txt or a copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-// Home at http://www.boost.org/libs/local_function
-
-#include <boost/local_function.hpp>
-#define BOOST_TEST_MODULE TestGotoErr
-#include <boost/test/unit_test.hpp>
-
-//[goto_err
-int error(int x, int y) {
- int BOOST_LOCAL_FUNCTION(int x) {
- if(x <= 0) goto failure; // Error: Cannot jump to enclosing scope.
- else goto success; // OK: Can jump within local function.
-
- success:
- return 0;
- } BOOST_LOCAL_FUNCTION_NAME(validate)
-
- return validate(x + y);
-faliure:
- return -1;
-}
-//]
-
-BOOST_AUTO_TEST_CASE( test_goto_err ) {
- error(1, 2);
-}
-

Copied: trunk/libs/local_function/test/goto_error.cpp (from r77032, /trunk/libs/local_function/test/goto_err.cpp)
==============================================================================
--- /trunk/libs/local_function/test/goto_err.cpp (original)
+++ trunk/libs/local_function/test/goto_error.cpp 2012-02-16 13:24:34 EST (Thu, 16 Feb 2012)
@@ -9,7 +9,7 @@
 #define BOOST_TEST_MODULE TestGotoErr
 #include <boost/test/unit_test.hpp>
 
-//[goto_err
+//[goto_error
 int error(int x, int y) {
     int BOOST_LOCAL_FUNCTION(int x) {
         if(x <= 0) goto failure; // Error: Cannot jump to enclosing scope.

Deleted: trunk/libs/local_function/test/operator_err.cpp
==============================================================================
--- trunk/libs/local_function/test/operator_err.cpp 2012-02-16 13:24:34 EST (Thu, 16 Feb 2012)
+++ (empty file)
@@ -1,28 +0,0 @@
-
-// Copyright (C) 2009-2012 Lorenzo Caminiti
-// Distributed under the Boost Software License, Version 1.0
-// (see accompanying file LICENSE_1_0.txt or a copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-// Home at http://www.boost.org/libs/local_function
-
-#include <boost/local_function.hpp>
-#define BOOST_TEST_MODULE TestOperatorErr
-#include <boost/test/unit_test.hpp>
-
-//[operator_err
-struct point {
- int x;
- int y;
-};
-
-BOOST_AUTO_TEST_CASE( test_operator_err ) {
- bool BOOST_LOCAL_FUNCTION(const point& p, const point& q) {
- return p.x == q.x && p.y == q.y;
- } BOOST_LOCAL_FUNCTION_NAME(operator==) // Error: Cannot use `operator...`.
-
- point a; a.x = 1; a.y = 2;
- point b = a;
- BOOST_CHECK( a == b );
-}
-//]
-

Copied: trunk/libs/local_function/test/operator_error.cpp (from r77032, /trunk/libs/local_function/test/operator_err.cpp)
==============================================================================
--- /trunk/libs/local_function/test/operator_err.cpp (original)
+++ trunk/libs/local_function/test/operator_error.cpp 2012-02-16 13:24:34 EST (Thu, 16 Feb 2012)
@@ -9,7 +9,7 @@
 #define BOOST_TEST_MODULE TestOperatorErr
 #include <boost/test/unit_test.hpp>
 
-//[operator_err
+//[operator_error
 struct point {
     int x;
     int y;

Modified: trunk/libs/scope_exit/example/Jamfile.v2
==============================================================================
--- trunk/libs/scope_exit/example/Jamfile.v2 (original)
+++ trunk/libs/scope_exit/example/Jamfile.v2 2012-02-16 13:24:34 EST (Thu, 16 Feb 2012)
@@ -8,9 +8,15 @@
 
 import testing ;
 
+# Compile sequence syntax also forcing no varadic macros.
+
 run try_catch.cpp ;
 run try_catch_seq.cpp ;
+run try_catch_seq.cpp : : : <define>BOOST_NO_VARIADIC_MACROS
+ : try_catch_seq_no_variadics : ;
 
 run scope_guard.cpp ;
 run scope_guard_seq.cpp ;
+run scope_guard_seq.cpp : : : <define>BOOST_NO_VARIADIC_MACROS
+ : scope_guard_seq_no_variadics : ;
 

Modified: trunk/libs/scope_exit/test/Jamfile.v2
==============================================================================
--- trunk/libs/scope_exit/test/Jamfile.v2 (original)
+++ trunk/libs/scope_exit/test/Jamfile.v2 2012-02-16 13:24:34 EST (Thu, 16 Feb 2012)
@@ -15,23 +15,31 @@
         <link>static
     ;
 
+# Compile sequence syntax also forcing no variadic macros.
 test-suite world_tests
     : [ run world.cpp ]
         [ run world_seq.cpp ]
+ [ run world_seq.cpp : : : <define>BOOST_NO_VARIADIC_MACROS
+ : world_seq_no_variadics ]
         
         [ run world_void.cpp ]
         
         [ run world_this.cpp ]
- [ run world_this_seq.cpp ]
+ [ run world_this_seq.cpp : : : <define>BOOST_NO_VARIADIC_MACROS
+ : world_this_seq_no_variadics ]
         
         [ run world_tpl.cpp ]
- [ run world_tpl_seq.cpp ]
+ [ run world_tpl_seq.cpp : : : <define>BOOST_NO_VARIADIC_MACROS
+ : world_tpl_seq_no_variadics ]
         
         [ run world_checkpoint.cpp ]
- [ run world_checkpoint_seq.cpp ]
+ [ run world_checkpoint_seq.cpp : : : <define>BOOST_NO_VARIADIC_MACROS
+ : world_checkpoint_seq_no_variadics ]
         
         [ run world_checkpoint_all.cpp ]
- [ run world_checkpoint_all_seq.cpp ]
+ [ run world_checkpoint_all_seq.cpp : :
+ : <define>BOOST_NO_VARIADIC_MACROS
+ : world_checkpoint_all_seq_no_variadics ]
         
         [ run world_lambda.cpp ]
     ;

Modified: trunk/libs/utility/identity_type/doc/identity_type.qbk
==============================================================================
--- trunk/libs/utility/identity_type/doc/identity_type.qbk (original)
+++ trunk/libs/utility/identity_type/doc/identity_type.qbk 2012-02-16 13:24:34 EST (Thu, 16 Feb 2012)
@@ -21,16 +21,16 @@
 
 This library allows to wrap type expressions within round parenthesis so they can be passed to macros even when they contain commas.
 
-[import ../test/var_err.cpp]
+[import ../test/var_error.cpp]
 [import ../test/var.cpp]
 [import ../test/template.cpp]
 [import ../test/tmp_assert.cpp]
 
 [section Motivation]
 
-Consider the following macro which declares a variable named `var`/n/ with the specified /type/ (see also [@../../test/var_err.cpp =var_err.cpp=]):
+Consider the following macro which declares a variable named `var`/n/ with the specified /type/ (see also [@../../test/var_error.cpp =var_error.cpp=]):
 
-[var_err]
+[var_error]
 
 The first macro invocation works correctly declaring a variable named `var1` of type `int`.
 However, the second macro invocation fails generating a preprocessor error similar to the following:

Modified: trunk/libs/utility/identity_type/test/Jamfile.v2
==============================================================================
--- trunk/libs/utility/identity_type/test/Jamfile.v2 (original)
+++ trunk/libs/utility/identity_type/test/Jamfile.v2 2012-02-16 13:24:34 EST (Thu, 16 Feb 2012)
@@ -7,7 +7,7 @@
 
 import testing ;
 
-compile-fail var_err.cpp ;
+compile-fail var_error.cpp ;
 run var.cpp ;
 run template.cpp ;
 run tmp_assert.cpp ;

Deleted: trunk/libs/utility/identity_type/test/var_err.cpp
==============================================================================
--- trunk/libs/utility/identity_type/test/var_err.cpp 2012-02-16 13:24:34 EST (Thu, 16 Feb 2012)
+++ (empty file)
@@ -1,18 +0,0 @@
-
-// Copyright (C) 2009-2012 Lorenzo Caminiti
-// Distributed under the Boost Software License, Version 1.0
-// (see accompanying file LICENSE_1_0.txt or a copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-// Home at http://www.boost.org/libs/utility/identity_type
-
-#include <map>
-
-//[var_err
-#define VAR(type, n) type var ## n
-
-VAR( int, 1 ); // OK.
-VAR( std::map<int, char>, 2 ); // Error.
-//]
-
-int main() { return 0; }
-

Copied: trunk/libs/utility/identity_type/test/var_error.cpp (from r77032, /trunk/libs/utility/identity_type/test/var_err.cpp)
==============================================================================
--- /trunk/libs/utility/identity_type/test/var_err.cpp (original)
+++ trunk/libs/utility/identity_type/test/var_error.cpp 2012-02-16 13:24:34 EST (Thu, 16 Feb 2012)
@@ -7,7 +7,7 @@
 
 #include <map>
 
-//[var_err
+//[var_error
 #define VAR(type, n) type var ## n
 
 VAR( int, 1 ); // OK.


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