|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r76814 - in sandbox/local_function: boost boost/functional boost/functional/overloaded_function boost/functional/overloaded_function/detail boost/local_function/aux_ libs/functional/overloaded_function/doc libs/functional/overloaded_function/doc/html libs/functional/overloaded_function/doc/html/boost libs/functional/overloaded_function/test 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/doc libs/scope_exit/doc/html libs/scope_exit/doc/html/scope_exit libs/scope_exit/test libs/utility/identity_type libs/utility/identity_type/doc libs/utility/identity_type/doc/html libs/utility/identity_type/test
From: lorcaminiti_at_[hidden]
Date: 2012-01-31 19:02:58
Author: lcaminiti
Date: 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
New Revision: 76814
URL: http://svn.boost.org/trac/boost/changeset/76814
Log:
Updated all docs.
Removed:
sandbox/local_function/libs/local_function/example/impl_factorial.cpp
Text files modified:
sandbox/local_function/boost/functional/overloaded_function.hpp | 14 +-
sandbox/local_function/boost/functional/overloaded_function/config.hpp | 6
sandbox/local_function/boost/functional/overloaded_function/detail/base.hpp | 2
sandbox/local_function/boost/functional/overloaded_function/detail/function_type.hpp | 2
sandbox/local_function/boost/local_function.hpp | 62 +++++---
sandbox/local_function/boost/local_function/aux_/function.hpp | 1
sandbox/local_function/boost/scope_exit.hpp | 40 ++---
sandbox/local_function/libs/functional/overloaded_function/doc/Jamfile.v2 | 4
sandbox/local_function/libs/functional/overloaded_function/doc/html/BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX.html | 8
sandbox/local_function/libs/functional/overloaded_function/doc/html/BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX.html | 14 +-
sandbox/local_function/libs/functional/overloaded_function/doc/html/boost/make_overloaded_function.html | 10
sandbox/local_function/libs/functional/overloaded_function/doc/html/boost/overloaded_function.html | 34 ++--
sandbox/local_function/libs/functional/overloaded_function/doc/html/index.html | 45 +++---
sandbox/local_function/libs/functional/overloaded_function/doc/html/reference.html | 10
sandbox/local_function/libs/functional/overloaded_function/doc/overloaded_function.qbk | 59 ++++----
sandbox/local_function/libs/functional/overloaded_function/test/Jamfile.v2 | 2
sandbox/local_function/libs/functional/overloaded_function/test/identity.cpp | 5
sandbox/local_function/libs/local_function/doc/acknowledgements.qbk | 6
sandbox/local_function/libs/local_function/doc/advanced_topics.qbk | 111 ++++++++--------
sandbox/local_function/libs/local_function/doc/alternatives.qbk | 56 ++++---
sandbox/local_function/libs/local_function/doc/bibliography.qbk | 2
sandbox/local_function/libs/local_function/doc/examples.qbk | 34 ++--
sandbox/local_function/libs/local_function/doc/getting_started.qbk | 2
sandbox/local_function/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION.html | 13 +
sandbox/local_function/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_CONFIG_ARITY_MAX.html | 4
sandbox/local_function/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX.html | 4
sandbox/local_function/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_NAME.html | 14 +-
sandbox/local_function/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_TPL.html | 4
sandbox/local_function/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_TYPEOF.html | 13 +
sandbox/local_function/libs/local_function/doc/html/boost_localfunction/Acknowledgments.html | 20 +-
sandbox/local_function/libs/local_function/doc/html/boost_localfunction/Advanced_Topics.html | 175 ++++++++++++++-----------
sandbox/local_function/libs/local_function/doc/html/boost_localfunction/Alternatives.html | 142 +++++++++++---------
sandbox/local_function/libs/local_function/doc/html/boost_localfunction/Bibliography.html | 6
sandbox/local_function/libs/local_function/doc/html/boost_localfunction/Examples.html | 70 +++++-----
sandbox/local_function/libs/local_function/doc/html/boost_localfunction/Getting_Started.html | 26 +-
sandbox/local_function/libs/local_function/doc/html/boost_localfunction/Implementation.html | 213 +-----------------------------
sandbox/local_function/libs/local_function/doc/html/boost_localfunction/No_Variadic_Macros.html | 43 ++++--
sandbox/local_function/libs/local_function/doc/html/boost_localfunction/Release_Notes.html | 36 ++++
sandbox/local_function/libs/local_function/doc/html/boost_localfunction/Tutorial.html | 76 +++++-----
sandbox/local_function/libs/local_function/doc/html/index.html | 32 ++--
sandbox/local_function/libs/local_function/doc/html/reference.html | 2
sandbox/local_function/libs/local_function/doc/implementation.qbk | 16 -
sandbox/local_function/libs/local_function/doc/introduction.qbk | 12
sandbox/local_function/libs/local_function/doc/local_function.qbk | 41 ++---
sandbox/local_function/libs/local_function/doc/no_variadic_macros.qbk | 16 +-
sandbox/local_function/libs/local_function/doc/release_notes.qbk | 9 +
sandbox/local_function/libs/local_function/doc/tutorial.qbk | 47 +++---
sandbox/local_function/libs/local_function/example/Jamfile.v2 | 3
sandbox/local_function/libs/local_function/example/add_global_functor.cpp | 2
sandbox/local_function/libs/local_function/example/gcc_lambda_cpp11.cpp | 1
sandbox/local_function/libs/local_function/example/impl_pp_keyword.cpp | 6
sandbox/local_function/libs/local_function/example/noncopyable_lambda_err.cpp | 2
sandbox/local_function/libs/local_function/test/add_classifiers.cpp | 5
sandbox/local_function/libs/local_function/test/add_lambda.cpp | 7
sandbox/local_function/libs/local_function/test/add_seq.cpp | 18 +-
sandbox/local_function/libs/local_function/test/add_template.cpp | 1
sandbox/local_function/libs/local_function/test/add_typed.cpp | 2
sandbox/local_function/libs/local_function/test/factorial.cpp | 2
sandbox/local_function/libs/local_function/test/macro_commas.cpp | 2
sandbox/local_function/libs/scope_exit/doc/Jamfile.v2 | 18 +-
sandbox/local_function/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT.html | 12
sandbox/local_function/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_ALL.html | 16 +-
sandbox/local_function/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_CONFIG_NO_CPP11.html | 12
sandbox/local_function/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_END.html | 6
sandbox/local_function/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_TPL.html | 8
sandbox/local_function/libs/scope_exit/doc/html/index.html | 35 +---
sandbox/local_function/libs/scope_exit/doc/html/reference.html | 10
sandbox/local_function/libs/scope_exit/doc/html/scope_exit/Getting_Started.html | 22 --
sandbox/local_function/libs/scope_exit/doc/html/scope_exit/No_Variadic_Macros.html | 183 ++++++++++++++------------
sandbox/local_function/libs/scope_exit/doc/html/scope_exit/Tutorial.html | 83 ++++++------
sandbox/local_function/libs/scope_exit/doc/html/scope_exit/acknowledgements.html | 20 +-
sandbox/local_function/libs/scope_exit/doc/html/scope_exit/annex__alternatives.html | 269 ++++++++++++++++++---------------------
sandbox/local_function/libs/scope_exit/doc/scope_exit.qbk | 148 +++++++++------------
sandbox/local_function/libs/scope_exit/test/Jamfile.v2 | 105 +++++++-------
sandbox/local_function/libs/utility/identity_type/doc/html/index.html | 58 ++++----
sandbox/local_function/libs/utility/identity_type/doc/identity_type.qbk | 28 ++--
sandbox/local_function/libs/utility/identity_type/index.html | 2
sandbox/local_function/libs/utility/identity_type/test/tmp_assert.cpp | 2
78 files changed, 1258 insertions(+), 1393 deletions(-)
Modified: sandbox/local_function/boost/functional/overloaded_function.hpp
==============================================================================
--- sandbox/local_function/boost/functional/overloaded_function.hpp (original)
+++ sandbox/local_function/boost/functional/overloaded_function.hpp 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -1,5 +1,5 @@
-// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Copyright (C) 2011-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)
@@ -178,7 +178,7 @@
namespace boost {
/**
-_at_brief Function object that overloads functions with distinct signatures.
+@brief Function object to overload functions with distinct signatures.
This function object aggregates together calls to functions of all the
specified function types <c>F1</c>, <c>F2</c>, etc.
@@ -214,9 +214,9 @@
/**
@brief Construct the overloaded function object.
- Any function pointer, function reference, function object that can be
- converted to a <c>boost::function</c> function object can be specified as
- parameter.
+ Any function pointer, function reference, and monomorphic function object
+ that can be converted to a <c>boost::function</c> function object can be
+ specified as parameter.
*/
overloaded_function(const boost::function<F1>&,
const boost::function<F2>&, ...);
@@ -241,7 +241,7 @@
the constructor.
@Note Similar call operators are present for all specified function types
- <c>F1</c>, <c>F2</c>, etc (even if not explicitly listed by this
+ <c>F1</c>, <c>F2</c>, etc (even if not exhaustively listed by this
documentation).
*/
typename boost::function_traits<F2>::result_type operator()(
@@ -264,7 +264,7 @@
compared with @RefClass{overloaded_function}.
This is especially useful when the explicit type of the returned
@RefClass{overloaded_function} does not need to be known (e.g., when used with Boost.Typeof's <c>BOOST_AUTO</c> (or C++11 <c>auto</c>) or when the overloaded
-function object is deduced using a function template parameter, see the
+function object is handled using a function template parameter, see the
@RefSect{Tutorial} section).
The maximum number of functions to overload is given by the
Modified: sandbox/local_function/boost/functional/overloaded_function/config.hpp
==============================================================================
--- sandbox/local_function/boost/functional/overloaded_function/config.hpp (original)
+++ sandbox/local_function/boost/functional/overloaded_function/config.hpp 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -1,5 +1,5 @@
-// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Copyright (C) 2011-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)
@@ -21,7 +21,7 @@
@See
@RefSectId{Getting_Started, Getting Started},
- @RefClass{overloaded_function}.
+ @RefClass{boost::overloaded_function}.
*/
#ifndef BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX
#define BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX 5
@@ -38,7 +38,7 @@
@See
@RefSectId{Getting_Started, Getting Started},
- @RefClass{overloaded_function}.
+ @RefClass{boost::overloaded_function}.
*/
#ifndef BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX
#define BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX 5
Modified: sandbox/local_function/boost/functional/overloaded_function/detail/base.hpp
==============================================================================
--- sandbox/local_function/boost/functional/overloaded_function/detail/base.hpp (original)
+++ sandbox/local_function/boost/functional/overloaded_function/detail/base.hpp 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -1,5 +1,5 @@
-// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Copyright (C) 2011-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)
Modified: sandbox/local_function/boost/functional/overloaded_function/detail/function_type.hpp
==============================================================================
--- sandbox/local_function/boost/functional/overloaded_function/detail/function_type.hpp (original)
+++ sandbox/local_function/boost/functional/overloaded_function/detail/function_type.hpp 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -1,5 +1,5 @@
-// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Copyright (C) 2011-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)
Modified: sandbox/local_function/boost/local_function.hpp
==============================================================================
--- sandbox/local_function/boost/local_function.hpp (original)
+++ sandbox/local_function/boost/local_function.hpp 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -121,9 +121,9 @@
void | declaration_sequence
@endcode
-(Lexical conventions: <c>token1 | token2</c> means either <c>token1</c> or
+Lexical conventions: <c>token1 | token2</c> means either <c>token1</c> or
<c>token2</c>; <c>[token]</c> means either <c>token</c> or nothing;
-<c>{expression}</c> means the token resulting from the expression.)
+<c>{expression}</c> means the token resulting from the expression.
}
@EndParams
@@ -138,11 +138,14 @@
When binding the object <c>this</c>, the special symbol <c>this_</c> needs to
be used instead of <c>this</c> as the name of the variable to bind and also
within the local function body to access the object.
-(Mistakenly using <c>this</c> instead of <c>this_</c> might not always result in a compiler error and will in general lead to undefined behaviour.)
+(Mistakenly using <c>this</c> instead of <c>this_</c> might not always result in a compiler error and will in general result in undefined behaviour.)
The result type must either be specified just before the macro or within the
macro declarations prefixed by <c>return</c> (but not in both places).
+Within the local function body it possible to access the result type using <c>result_type</c>, the type of the first parameter using <c>arg1_type</c>, the type of the second parameter using <c>arg2_type</c>, etc.
+The bound variable types can be accessed using @RefMacro{BOOST_LOCAL_FUNCTION_TYPEOF}.
+
The maximum number of local function parameters (excluding bound variables) is
specified by the configuration macro
@RefMacro{BOOST_LOCAL_FUNCTION_CONFIG_ARITY_MAX}.
@@ -152,14 +155,15 @@
@Note Local functions are functors so they can be assigned to other functors
like <c>boost::function</c> (see Boost.Function).
-_at_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).
+@Note This macro cannot be portably used multiple times on the same line
+(because on GCC and other compilers, it internally uses the line number
+<c>__LINE__</c> to generate unique identifiers).
@See @RefSect{Tutorial} section,
@RefSectId{Advanced_Topics, Advanced Topics} section,
@RefMacro{BOOST_LOCAL_FUNCTION_TPL},
@RefMacro{BOOST_LOCAL_FUNCTION_NAME},
+@RefMacro{BOOST_LOCAL_FUNCTION_TYPEOF},
@RefMacro{BOOST_LOCAL_FUNCTION_CONFIG_ARITY_MAX},
@RefMacro{BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX}.
*/
@@ -212,13 +216,13 @@
qualified_function_name:
[inline] [recursive] name
@endcode
-(Lexical conventions: <c>token1 | token2</c> means either <c>token1</c> or
+Lexical conventions: <c>token1 | token2</c> means either <c>token1</c> or
<c>token2</c>; <c>[token]</c> means either <c>token</c> or nothing;
-<c>{expression}</c> means the token resulting from the expression.)
+<c>{expression}</c> means the token resulting from the expression.
}
@EndParams
-The local function name can be qualified by prefixing it with the "keyword"
+The local function name can be qualified by prefixing it with the keyword
<c>inline</c> (see the @RefSectId{Advanced_Topics, Advanced Topics} section):
<c>BOOST_LOCAL_FUNCTION_NAME(inline name)</c>.
This increases the chances that the compiler will be able to inline the local
@@ -240,25 +244,33 @@
However, compilers have not been observed to be able to inline recursive
local function calls (not even when the recursive local function is also
declared inline: <c>BOOST_LOCAL_FUNCTION(inline recursive name)</c>).
+Furthermore, recursive local functions should only be called within their
+declaration scope (otherwise the result is undefined behaviour).
@Note The local function name cannot be the name of an operator
<c>operator...</c> and it cannot be the same name of another local function
-declared within the same enclosing scope (the <c>boost::overloaded_function</c>
-functor can be used to overload local functions, see
+declared within the same enclosing scope (but <c>boost::overloaded_function</c>
+can be used to overload local functions, see
Boost.Functional/OverloadedFunction and the
@RefSectId{Advanced_Topics, Advanced Topics} section).
-_at_See @RefMacro{BOOST_LOCAL_FUNCTION}, @RefSect{Tutorial} section,
-_at_RefSectId{Advanced_Topics, Advanced Topics} section.
+@See @RefSect{Tutorial} section,
+@RefSectId{Advanced_Topics, Advanced Topics} section,
+@RefMacro{BOOST_LOCAL_FUNCTION}.
*/
#define BOOST_LOCAL_FUNCTION_NAME(qualified_function_name)
/**
@brief This macro expands to the type of the specified bound variable.
-The type returned by the macro is fully qualified in that it contains the extra
-constant and reference qualifiers when the specified variable was bound by
-constant and by reference.
+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 @RefSectId{Advanced_Topics, Advanced Topics}
+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).
@Params
@Param{bound_variable_name,
@@ -266,6 +278,9 @@
}
@EndParams
+The type returned by the macro is fully qualified in that it contains the extra
+constant and reference qualifiers when the specified variable is bound by
+constant and by reference.
For example, if a variable named <c>t</c> of type <c>T</c> is:
@li Bound by value using <c>bind t</c> then
<c>BOOST_LOCAL_FUNCTION_TYPEOF(t)</c> is <c>T</c>.
@@ -276,17 +291,12 @@
@li Bound by constant reference using <c>const bind& t</c> then
<c>BOOST_LOCAL_FUNCTION_TYPEOF(t)</c> is <c>const T&</c>.
-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 @RefSectId{Advanced_Topics, Advanced Topics}
-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).
+This macro must be prefixed by <c>typename</c> when used in a type dependant context.
+
+It is best to use this macro instead of Boost.Typeof so to reduce the number of times Boost.Typeof is used to deduce types (see the @RefSectId{Advanced_Topics, Advanced Topics} section).
-_at_See @RefMacro{BOOST_LOCAL_FUNCTION},
-_at_RefSectId{Advanced_Topics, Advanced Topics} section.
+@See @RefSectId{Advanced_Topics, Advanced Topics} section,
+@RefMacro{BOOST_LOCAL_FUNCTION}.
*/
#define BOOST_LOCAL_FUNCTION_TYPEOF(bound_variable_name)
Modified: sandbox/local_function/boost/local_function/aux_/function.hpp
==============================================================================
--- sandbox/local_function/boost/local_function/aux_/function.hpp (original)
+++ sandbox/local_function/boost/local_function/aux_/function.hpp 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -295,6 +295,7 @@
#endif
BOOST_PP_REPEAT(BOOST_PP_INC(BOOST_LOCAL_FUNCTION_AUX_defaults),
BOOST_LOCAL_FUNCTION_AUX_call_init, ~) // INC for no defaults.
+ unused_ = 0; // To avoid a GCC uninitialized warning.
}
// Result operator(Arg1, ..., ArgN-1, ArgN) -- iff defaults >= 0
Modified: sandbox/local_function/boost/scope_exit.hpp
==============================================================================
--- sandbox/local_function/boost/scope_exit.hpp (original)
+++ sandbox/local_function/boost/scope_exit.hpp 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -8,7 +8,7 @@
#ifndef FILE_boost_scope_exit_hpp_INCLUDED
#define FILE_boost_scope_exit_hpp_INCLUDED
-#ifndef DOXY
+#ifndef DOXYGEN
#include <boost/local_function/detail/preprocessor/line_counter.hpp>
#include <boost/local_function/detail/preprocessor/void_list.hpp>
@@ -625,7 +625,7 @@
// DOCUMENTATION //
-#else // DOXY (Doxygen documentation)
+#else // DOXYGEN
/** @file
@brief Scope exits allow to execute arbitrary code when the enclosing scope exits.
@@ -648,7 +648,7 @@
The enclosing scope must be local.
If multiple scope exits are declared within the same enclosing scope, the scope exit bodies are executed in the reversed order of their declarations.
-Note how the end of the scope exit body must be marked with the @RefMacro{BOOST_SCOPE_EXIT_END} (or with a <c>;</c> but only on C++11).
+Note how the end of the scope exit body must be marked by @RefMacro{BOOST_SCOPE_EXIT_END} (or by a <c>;</c> but only on C++11).
@Params
@Param{capture_list,
@@ -674,10 +674,9 @@
[&]variable | this_ | this
@endcode
-(Where the following lexical conventions are adopted: <c>token1 | token2</c>
-means either <c>token1</c> or <c>token2</c>; <c>[token]</c> means either
-<c>token</c> or nothing; <c>{expression}</c> means the token resulting from the
-expression.)
+Lexical conventions: <c>token1 | token2</c> means either <c>token1</c> or
+<c>token2</c>; <c>[token]</c> means either <c>token</c> or nothing;
+<c>{expression}</c> means the token resulting from the expression.
}
@EndParams
@@ -701,7 +700,7 @@
@Warning The implementation executes the scope exit body within a destructor thus the scope exit body must never throw in order to comply with STL exception safety requirements.
@Note The implementation uses Boost.Typeof to automatically deduce the types of the captured variables.
-In order to compile code in typeof-emulation mode, Boost.Typeof must be properly configured (see the @RefSectId{Getting_Started, Getting Started} section).
+In order to compile code in type-of emulation mode, Boost.Typeof must be properly configured (see the @RefSectId{Getting_Started, Getting Started} section).
@See @RefSect{Tutorial} section, @RefSectId{Getting_Started, Getting Started} section, @RefSectId{No_Variadic_Macros, No Variadic Macros} section, @RefMacro{BOOST_SCOPE_EXIT_TPL}, @RefMacro{BOOST_SCOPE_EXIT_ALL}, @RefMacro{BOOST_SCOPE_EXIT_END}.
*/
@@ -725,7 +724,7 @@
The syntax of @RefMacro{BOOST_SCOPE_EXIT_TPL} is the exact same as the one of @RefMacro{BOOST_SCOPE_EXIT} (see @RefMacro{BOOST_SCOPE_EXIT} for more information).
-On C++11, @RefMacro{BOOST_SCOPE_EXIT_TPL} is not needed because @RefMacro{BOOST_SCOPE_EXIT} always compiles on GCC versions that support C++11.
+On C++11, @RefMacro{BOOST_SCOPE_EXIT_TPL} is not needed because @RefMacro{BOOST_SCOPE_EXIT} always compiles on GCC versions that support C++11 (that is also why there is no need for a <c>BOOST_SCOPE_EXIT_ALL_TPL</c> macro given that @RefMacro{BOOST_SCOPE_EXIT_ALL} is only available for C++11 compilers on which it always compiles correctly).
However, @RefMacro{BOOST_SCOPE_EXIT_TPL} is still provided on C++11 so to write code that is portable between C++03 and C++11 compilers.
@Note The problem boils down to the following code (see also GCC bug 37920):
@@ -754,8 +753,8 @@
/**
@brief This macro declares a scope exit that captures all variables in scope (C++11 only).
-_at_Warning This macro is only available on C++11 compilers.
-It is not defined on non-C++11 compilers so its use on non-C++11 compilers will generate a compiler error.
+This macro accepts a capture list starting with either <c>&</c> or <c>=</c> to capture all variables in scope by reference or value respectively (following the same syntax of C++11 lambdas).
+A part from that, this macro works like @RefMacro{BOOST_SCOPE_EXIT} (see @RefMacro{BOOST_SCOPE_EXIT} for more information).
@code
{ // Some local scope.
@@ -767,8 +766,8 @@
}
@endcode
-This macro accepts a capture list starting with either <c>&</c> or <c>=</c> to capture all variables in scope by reference or value respectively (following the same syntax of C++11 lambdas).
-A part from that, this macro works like @RefMacro{BOOST_SCOPE_EXIT} (see @RefMacro{BOOST_SCOPE_EXIT} for more information).
+@Warning This macro is only available on C++11 compilers.
+It is not defined on non-C++11 compilers so its use on non-C++11 compilers will generate a compiler error.
@Params
@Param{capture_list,
@@ -783,21 +782,18 @@
[&]variable | this_ | this
@endcode
-(Where the following lexical conventions are adopted: <c>token1 | token2</c>
-means either <c>token1</c> or <c>token2</c>; <c>[token]</c> means either
-<c>token</c> or nothing; <c>{expression}</c> means the token resulting from the
-expression.)
+Lexical conventions: <c>token1 | token2</c> means either <c>token1</c> or
+<c>token2</c>; <c>[token]</c> means either <c>token</c> or nothing;
+<c>{expression}</c> means the token resulting from the expression.
}
@EndParams
-Note that on compilers with variadic macro support (which should be all C++11 compilers), the capture list can be specified as a comma-separated list.
-On all compilers, the same macro @RefMacro{BOOST_SCOPE_EXIT_ALL} also allows to specify the capture list as a Boost.Preprocessor sequence (to allow to use a syntax consistent with the one of <c>BOOST_SCOPE_EXIT</c> when used on compilers without variadic macro support).
-
For this macro, the capture list must always contain at least the leading <c>&</c> or <c>=</c> so it can never be <c>void</c>.
+Note that on compilers with variadic macro support (which should be all C++11 compilers), the capture list can be specified as a comma-separated list.
+On all compilers, the same macro @RefMacro{BOOST_SCOPE_EXIT_ALL} also allows to specify the capture list as a Boost.Preprocessor sequence (to allow to use a syntax consistent with the one of <c>BOOST_SCOPE_EXIT</c> when used on compilers without variadic macro support).
The scope exit body declared by this macro can be terminated equivalently by either a semi-column <c>;</c> or by the macro @RefMacro{BOOST_SCOPE_EXIT_END}.
The @RefMacro{BOOST_SCOPE_EXIT_ALL} macro is only available on C++11 where the terminating semi-column <c>;</c> can always be used without worrying about portability with C++03 (see @RefMacro{BOOST_SCOPE_EXIT_END} for more information).
-
Similarly, this macro can always use <c>this</c> instead of <c>this_</c> to capture the enclosing object without worrying about portability with C++03 because this macro is only available on C++11 compilers.
@Note In summary, this macro can take advantage of all syntax improvements allowed by C++11 but it optionally supports the same syntax required by C++03 so programmers can always program both @RefMacro{BOOST_SCOPE_EXIT_ALL} and @RefMacro{BOOST_SCOPE_EXIT} using the same syntax and for all compilers if they wish to do so.
@@ -851,7 +847,7 @@
*/
#define BOOST_SCOPE_EXIT_CONFIG_NO_CPP11
-#endif // DOXY
+#endif // DOXYGEN
#endif // #ifndef FILE_boost_scope_exit_hpp_INCLUDED
Modified: sandbox/local_function/libs/functional/overloaded_function/doc/Jamfile.v2
==============================================================================
--- sandbox/local_function/libs/functional/overloaded_function/doc/Jamfile.v2 (original)
+++ sandbox/local_function/libs/functional/overloaded_function/doc/Jamfile.v2 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -1,5 +1,5 @@
-# Copyright (C) 2009-2012 Lorenzo Caminiti
+# Copyright (C) 2011-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)
@@ -16,7 +16,7 @@
<doxygen:param>WARN_IF_UNDOCUMENTED=NO
<doxygen:param>HIDE_UNDOC_MEMBERS=YES
<doxygen:param>HIDE_UNDOC_CLASSES=YES
- <doxygen:param>ALIASES=" Params=\"<b>Parameters:</b> <table border="0">\" Param{2}=\"<tr><td><b><tt>\\1</tt></b></td><td>\\2</td></tr>\" EndParams=\"</table>\" Returns=\"<b>Returns:</b>\" Note=\"<b>Note:</b>\" Warning=\"<b>Warning:</b>\" See=\"<b>See:</b>\" RefSect{1}=\"\\xmlonly<link linkend='functional_overloaded_function.\\1'>\\1</link>\\endxmlonly\" RefSectId{2}=\"\\xmlonly<link linkend='functional_overloaded_function.\\1'>\\2</link>\\endxmlonly\" RefClass{1}=\"\\xmlonly<computeroutput><classname alt='\\1'>\\1</classname></computeroutput>\\endxmlonly\" RefFunc{1}=\"\\xmlonly<computeroutput><functionname alt='\\1'>\\1</functionname></computeroutput>\\endxmlonly\" RefMacro{1}=\"\\xmlonly<computeroutput><macroname alt='\\1'>\\1</macroname></computeroutput>\\endxmlonly\" "
+ <doxygen:param>ALIASES=" Params=\"<b>Parameters:</b> <table border="0">\" Param{2}=\"<tr><td><b><tt>\\1</tt></b></td><td>\\2</td></tr>\" EndParams=\"</table>\" Returns=\"<b>Returns:</b>\" Note=\"<b>Note:</b>\" Warning=\"<b>Warning:</b>\" See=\"<b>See:</b>\" RefSect{1}=\"\\xmlonly<link linkend='boost_functional_overloadedfunction.\\1'>\\1</link>\\endxmlonly\" RefSectId{2}=\"\\xmlonly<link linkend='boost_functional_overloadedfunction.\\1'>\\2</link>\\endxmlonly\" RefClass{1}=\"\\xmlonly<computeroutput><classname alt='\\1'>\\1</classname></computeroutput>\\endxmlonly\" RefFunc{1}=\"\\xmlonly<computeroutput><functionname alt='\\1'>\\1</functionname></computeroutput>\\endxmlonly\" RefMacro{1}=\"\\xmlonly<computeroutput><macroname alt='\\1'>\\1</macroname></computeroutput>\\endxmlonly\" "
# Extract Doxygen that comments non-variant macros.
<doxygen:param>PREDEFINED="DOXY"
Modified: sandbox/local_function/libs/functional/overloaded_function/doc/html/BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX.html
==============================================================================
--- sandbox/local_function/libs/functional/overloaded_function/doc/html/BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX.html (original)
+++ sandbox/local_function/libs/functional/overloaded_function/doc/html/BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX.html 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -33,15 +33,15 @@
</span>BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX</pre></div>
<div class="refsect1">
-<a name="id805235"></a><h2>Description</h2>
+<a name="id834751"></a><h2>Description</h2>
<p>If this macro is left undefined by the user, it has a default value of 5 (increasing this number might increase compilation time). When specified by the user, this macro must be a non-negative integer number.</p>
-<p><span class="bold"><strong>See:</strong></span> <a class="link" href="functional_overloaded_function/Getting_Started.html" title="Getting Started"> Getting Started</a>, <code class="computeroutput">overloaded_function</code>. </p>
+<p><span class="bold"><strong>See:</strong></span> <a class="link" href="boost_functional_overloadedfunction/Getting_Started.html" title="Getting Started"> Getting Started</a>, <code class="computeroutput"><a class="link" href="boost/overloaded_function.html" title="Class template overloaded_function">boost::overloaded_function</a></code>. </p>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
-<td align="right"><div class="copyright-footer">Copyright © 2012 Lorenzo Caminiti<p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
+<td align="right"><div class="copyright-footer">Copyright © 2011, 2012 Lorenzo Caminiti<p>
+ Distributed under the Boost Software License, Version 1.0 (see accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
</p>
</div></td>
Modified: sandbox/local_function/libs/functional/overloaded_function/doc/html/BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX.html
==============================================================================
--- sandbox/local_function/libs/functional/overloaded_function/doc/html/BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX.html (original)
+++ sandbox/local_function/libs/functional/overloaded_function/doc/html/BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX.html 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -7,7 +7,7 @@
<link rel="home" href="index.html" title="Chapter 1. Boost.Functional/OverloadedFunction 1.0.0">
<link rel="up" href="reference.html#header.boost.functional.overloaded_function.config_hpp" title="Header <boost/functional/overloaded_function/config.hpp>">
<link rel="prev" href="BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX.html" title="Macro BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX">
-<link rel="next" href="functional_overloaded_function/acknowledgments.html" title="Acknowledgments">
+<link rel="next" href="boost_functional_overloadedfunction/Acknowledgments.html" title="Acknowledgments">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
@@ -20,7 +20,7 @@
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.functional.overloaded_function.config_hpp"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="functional_overloaded_function/acknowledgments.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
+<a accesskey="p" href="BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.functional.overloaded_function.config_hpp"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="boost_functional_overloadedfunction/Acknowledgments.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX"></a><div class="titlepage"></div>
@@ -33,22 +33,22 @@
</span>BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX</pre></div>
<div class="refsect1">
-<a name="id805290"></a><h2>Description</h2>
+<a name="id834809"></a><h2>Description</h2>
<p>If this macro is left undefined by the user, it has a default value of 5 (increasing this number might increase compilation time). When defined by the user, this macro must be an integer number greater or equal than 2 (because at least two distinct functions need to be specified in order to define an overload).</p>
-<p><span class="bold"><strong>See:</strong></span> <a class="link" href="functional_overloaded_function/Getting_Started.html" title="Getting Started"> Getting Started</a>, <code class="computeroutput">overloaded_function</code>. </p>
+<p><span class="bold"><strong>See:</strong></span> <a class="link" href="boost_functional_overloadedfunction/Getting_Started.html" title="Getting Started"> Getting Started</a>, <code class="computeroutput"><a class="link" href="boost/overloaded_function.html" title="Class template overloaded_function">boost::overloaded_function</a></code>. </p>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
-<td align="right"><div class="copyright-footer">Copyright © 2012 Lorenzo Caminiti<p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
+<td align="right"><div class="copyright-footer">Copyright © 2011, 2012 Lorenzo Caminiti<p>
+ Distributed under the Boost Software License, Version 1.0 (see accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.functional.overloaded_function.config_hpp"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="functional_overloaded_function/acknowledgments.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
+<a accesskey="p" href="BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.functional.overloaded_function.config_hpp"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="boost_functional_overloadedfunction/Acknowledgments.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
Modified: sandbox/local_function/libs/functional/overloaded_function/doc/html/boost/make_overloaded_function.html
==============================================================================
--- sandbox/local_function/libs/functional/overloaded_function/doc/html/boost/make_overloaded_function.html (original)
+++ sandbox/local_function/libs/functional/overloaded_function/doc/html/boost/make_overloaded_function.html 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -36,18 +36,18 @@
<a class="link" href="overloaded_function.html" title="Class template overloaded_function">overloaded_function</a><span class="special"><</span> <span class="identifier">__function_type__</span><span class="special"><</span> <span class="identifier">F1</span> <span class="special">></span><span class="special">,</span> <span class="identifier">__function_type__</span><span class="special"><</span> <span class="identifier">F2</span> <span class="special">></span><span class="special">,</span><span class="special">...</span><span class="special">></span>
<span class="identifier">make_overloaded_function</span><span class="special">(</span><span class="identifier">F1</span> f1<span class="special">,</span> <span class="identifier">F2</span> f2<span class="special">,</span> <span class="special">...</span><span class="special">)</span><span class="special">;</span></pre></div>
<div class="refsect1">
-<a name="id805054"></a><h2>Description</h2>
+<a name="id834570"></a><h2>Description</h2>
<p>This function template creates and returns an <code class="computeroutput"><code class="computeroutput"><a class="link" href="overloaded_function.html" title="Class template overloaded_function">overloaded_function</a></code></code> function object that overloads all the specified functions <code class="computeroutput">f1</code>, <code class="computeroutput">f2</code>, etc.</p>
-<p>The function types are internally determined from the template parameter types so they do not need to be explicitly specified. Therefore, this function template usually has a more concise syntax when compared with <code class="computeroutput"><code class="computeroutput"><a class="link" href="overloaded_function.html" title="Class template overloaded_function">overloaded_function</a></code></code>. This is especially useful when the explicit type of the returned <code class="computeroutput"><code class="computeroutput"><a class="link" href="overloaded_function.html" title="Class template overloaded_function">overloaded_function</a></code></code> does not need to be known (e.g., when used with Boost.Typeof's <code class="computeroutput">BOOST_AUTO</code> (or C++11 <code class="computeroutput">auto</code>) or when the overloaded function object is deduced using a function template parameter, see the <a class="link" href="../functional_overloaded_function/Tutorial.html" title="Tutorial">Tutorial</a> sect
ion).</p>
+<p>The function types are internally determined from the template parameter types so they do not need to be explicitly specified. Therefore, this function template usually has a more concise syntax when compared with <code class="computeroutput"><code class="computeroutput"><a class="link" href="overloaded_function.html" title="Class template overloaded_function">overloaded_function</a></code></code>. This is especially useful when the explicit type of the returned <code class="computeroutput"><code class="computeroutput"><a class="link" href="overloaded_function.html" title="Class template overloaded_function">overloaded_function</a></code></code> does not need to be known (e.g., when used with Boost.Typeof's <code class="computeroutput">BOOST_AUTO</code> (or C++11 <code class="computeroutput">auto</code>) or when the overloaded function object is handled using a function template parameter, see the <a class="link" href="../boost_functional_overloadedfunction/Tutorial.html" title="Tutorial">Tutorial</a>
section).</p>
<p>The maximum number of functions to overload is given by the <code class="computeroutput"><code class="computeroutput"><a class="link" href="../BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX.html" title="Macro BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX">BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX</a></code></code> configuration macro.</p>
<p><span class="bold"><strong>Note:</strong></span> In this documentation, <code class="computeroutput">__function_type__</code> is a placeholder for a symbol that is specific to implementation of this library.</p>
-<p><span class="bold"><strong>See:</strong></span> <a class="link" href="../functional_overloaded_function/Tutorial.html" title="Tutorial">Tutorial</a> section, <code class="computeroutput"><code class="computeroutput"><a class="link" href="overloaded_function.html" title="Class template overloaded_function">overloaded_function</a></code></code>, <code class="computeroutput"><code class="computeroutput"><a class="link" href="../BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX.html" title="Macro BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX">BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX</a></code></code>. </p>
+<p><span class="bold"><strong>See:</strong></span> <a class="link" href="../boost_functional_overloadedfunction/Tutorial.html" title="Tutorial">Tutorial</a> section, <code class="computeroutput"><code class="computeroutput"><a class="link" href="overloaded_function.html" title="Class template overloaded_function">overloaded_function</a></code></code>, <code class="computeroutput"><code class="computeroutput"><a class="link" href="../BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX.html" title="Macro BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX">BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX</a></code></code>. </p>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
-<td align="right"><div class="copyright-footer">Copyright © 2012 Lorenzo Caminiti<p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
+<td align="right"><div class="copyright-footer">Copyright © 2011, 2012 Lorenzo Caminiti<p>
+ Distributed under the Boost Software License, Version 1.0 (see accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
</p>
</div></td>
Modified: sandbox/local_function/libs/functional/overloaded_function/doc/html/boost/overloaded_function.html
==============================================================================
--- sandbox/local_function/libs/functional/overloaded_function/doc/html/boost/overloaded_function.html (original)
+++ sandbox/local_function/libs/functional/overloaded_function/doc/html/boost/overloaded_function.html 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -26,7 +26,7 @@
<a name="boost.overloaded_function"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Class template overloaded_function</span></h2>
-<p>boost::overloaded_function — Function object that overloads functions with distinct signatures. </p>
+<p>boost::overloaded_function — Function object to overload functions with distinct signatures. </p>
</div>
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="../reference.html#header.boost.functional.overloaded_function_hpp" title="Header <boost/functional/overloaded_function.hpp>">boost/functional/overloaded_function.hpp</a>>
@@ -35,49 +35,49 @@
<span class="keyword">class</span> <a class="link" href="overloaded_function.html" title="Class template overloaded_function">overloaded_function</a> <span class="special">{</span>
<span class="keyword">public</span><span class="special">:</span>
<span class="comment">// <a class="link" href="overloaded_function.html#boost.overloaded_functionconstruct-copy-destruct">construct/copy/destruct</a></span>
- <a class="link" href="overloaded_function.html#id250967-bb"><span class="identifier">overloaded_function</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span><span class="special"><</span> <span class="identifier">F1</span> <span class="special">></span> <span class="special">&</span><span class="special">,</span>
+ <a class="link" href="overloaded_function.html#id237883-bb"><span class="identifier">overloaded_function</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span><span class="special"><</span> <span class="identifier">F1</span> <span class="special">></span> <span class="special">&</span><span class="special">,</span>
<span class="keyword">const</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span><span class="special"><</span> <span class="identifier">F2</span> <span class="special">></span> <span class="special">&</span><span class="special">,</span> <span class="special">...</span><span class="special">)</span><span class="special">;</span>
- <span class="comment">// <a class="link" href="overloaded_function.html#id250897-bb">public member functions</a></span>
+ <span class="comment">// <a class="link" href="overloaded_function.html#id237814-bb">public member functions</a></span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_traits</span><span class="special"><</span> <span class="identifier">F1</span> <span class="special">></span><span class="special">::</span><span class="identifier">result_type</span>
- <a class="link" href="overloaded_function.html#id250899-bb"><span class="keyword">operator</span><span class="special">(</span><span class="special">)</span></a><span class="special">(</span><span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_traits</span><span class="special"><</span> <span class="identifier">F1</span> <span class="special">></span><span class="special">::</span><span class="identifier">arg1_type</span><span class="special">,</span>
+ <a class="link" href="overloaded_function.html#id237816-bb"><span class="keyword">operator</span><span class="special">(</span><span class="special">)</span></a><span class="special">(</span><span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_traits</span><span class="special"><</span> <span class="identifier">F1</span> <span class="special">></span><span class="special">::</span><span class="identifier">arg1_type</span><span class="special">,</span>
<span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_traits</span><span class="special"><</span> <span class="identifier">F1</span> <span class="special">></span><span class="special">::</span><span class="identifier">arg2_type</span><span class="special">,</span> <span class="special">...</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_traits</span><span class="special"><</span> <span class="identifier">F2</span> <span class="special">></span><span class="special">::</span><span class="identifier">result_type</span>
- <a class="link" href="overloaded_function.html#id250926-bb"><span class="keyword">operator</span><span class="special">(</span><span class="special">)</span></a><span class="special">(</span><span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_traits</span><span class="special"><</span> <span class="identifier">F2</span> <span class="special">></span><span class="special">::</span><span class="identifier">arg1_type</span><span class="special">,</span>
+ <a class="link" href="overloaded_function.html#id237843-bb"><span class="keyword">operator</span><span class="special">(</span><span class="special">)</span></a><span class="special">(</span><span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_traits</span><span class="special"><</span> <span class="identifier">F2</span> <span class="special">></span><span class="special">::</span><span class="identifier">arg1_type</span><span class="special">,</span>
<span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_traits</span><span class="special"><</span> <span class="identifier">F2</span> <span class="special">></span><span class="special">::</span><span class="identifier">arg2_type</span><span class="special">,</span> <span class="special">...</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
<span class="special">}</span><span class="special">;</span></pre></div>
<div class="refsect1">
-<a name="id804307"></a><h2>Description</h2>
+<a name="id833824"></a><h2>Description</h2>
<p>This function object aggregates together calls to functions of all the specified function types <code class="computeroutput">F1</code>, <code class="computeroutput">F2</code>, etc. The specified function types must have distinct parameters from one another and they must be in the following format (which is the Boost.Function preferred syntax): </p>
<pre class="programlisting"> <span class="identifier">result_type</span> <span class="special">(</span><span class="identifier">argument1_type</span><span class="special">,</span> <span class="identifier">argumgnet2_type</span><span class="special">,</span> <span class="special">...</span><span class="special">)</span>
</pre>
<p>In some cases, the <code class="computeroutput"><a class="link" href="make_overloaded_function.html" title="Function template make_overloaded_function">make_overloaded_function</a></code> function template can be useful to construct the overloaded function object without explicitly specifying the function types.</p>
<p>The maximum number of functions to overload is given by the <code class="computeroutput"><a class="link" href="../BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX.html" title="Macro BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX">BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX</a></code> configuration macro. The maximum number of function parameters for each of the specified function types is given by the <code class="computeroutput"><a class="link" href="../BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX.html" title="Macro BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX">BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX</a></code> configuration macro.</p>
-<p><span class="bold"><strong>See:</strong></span> <a class="link" href="../functional_overloaded_function/Tutorial.html" title="Tutorial">Tutorial</a> section, <code class="computeroutput"><a class="link" href="make_overloaded_function.html" title="Function template make_overloaded_function">make_overloaded_function</a></code>, <code class="computeroutput"><a class="link" href="../BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX.html" title="Macro BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX">BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX</a></code>, <code class="computeroutput"><a class="link" href="../BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX.html" title="Macro BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX">BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX</a></code>, Boost.Function. </p>
+<p><span class="bold"><strong>See:</strong></span> <a class="link" href="../boost_functional_overloadedfunction/Tutorial.html" title="Tutorial">Tutorial</a> section, <code class="computeroutput"><a class="link" href="make_overloaded_function.html" title="Function template make_overloaded_function">make_overloaded_function</a></code>, <code class="computeroutput"><a class="link" href="../BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX.html" title="Macro BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX">BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX</a></code>, <code class="computeroutput"><a class="link" href="../BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX.html" title="Macro BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX">BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX</a></code>, Boost.Function. </p>
<div class="refsect2">
-<a name="id804427"></a><h3>
+<a name="id833944"></a><h3>
<a name="boost.overloaded_functionconstruct-copy-destruct"></a><code class="computeroutput">overloaded_function</code>
public
construct/copy/destruct</h3>
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
-<pre class="literallayout"><a name="id250967-bb"></a><span class="identifier">overloaded_function</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span><span class="special"><</span> <span class="identifier">F1</span> <span class="special">></span> <span class="special">&</span><span class="special">,</span>
- <span class="keyword">const</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span><span class="special"><</span> <span class="identifier">F2</span> <span class="special">></span> <span class="special">&</span><span class="special">,</span> <span class="special">...</span><span class="special">)</span><span class="special">;</span></pre>Construct the overloaded function object. <p>Any function pointer, function reference, function object that can be converted to a <code class="computeroutput">boost::function</code> function object can be specified as parameter. </p>
+<pre class="literallayout"><a name="id237883-bb"></a><span class="identifier">overloaded_function</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span><span class="special"><</span> <span class="identifier">F1</span> <span class="special">></span> <span class="special">&</span><span class="special">,</span>
+ <span class="keyword">const</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span><span class="special"><</span> <span class="identifier">F2</span> <span class="special">></span> <span class="special">&</span><span class="special">,</span> <span class="special">...</span><span class="special">)</span><span class="special">;</span></pre>Construct the overloaded function object. <p>Any function pointer, function reference, and monomorphic function object that can be converted to a <code class="computeroutput">boost::function</code> function object can be specified as parameter. </p>
</li></ol></div>
</div>
<div class="refsect2">
-<a name="id804552"></a><h3>
-<a name="id250897-bb"></a><code class="computeroutput">overloaded_function</code> public member functions</h3>
+<a name="id834069"></a><h3>
+<a name="id237814-bb"></a><code class="computeroutput">overloaded_function</code> public member functions</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_traits</span><span class="special"><</span> <span class="identifier">F1</span> <span class="special">></span><span class="special">::</span><span class="identifier">result_type</span>
-<a name="id250899-bb"></a><span class="keyword">operator</span><span class="special">(</span><span class="special">)</span><span class="special">(</span><span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_traits</span><span class="special"><</span> <span class="identifier">F1</span> <span class="special">></span><span class="special">::</span><span class="identifier">arg1_type</span><span class="special">,</span>
+<a name="id237816-bb"></a><span class="keyword">operator</span><span class="special">(</span><span class="special">)</span><span class="special">(</span><span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_traits</span><span class="special"><</span> <span class="identifier">F1</span> <span class="special">></span><span class="special">::</span><span class="identifier">arg1_type</span><span class="special">,</span>
<span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_traits</span><span class="special"><</span> <span class="identifier">F1</span> <span class="special">></span><span class="special">::</span><span class="identifier">arg2_type</span><span class="special">,</span> <span class="special">...</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Call operator matching the signature of the function type specified as 1st template parameter. <p>This will in turn invoke the call operator of the 1st function passed to the constructor. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_traits</span><span class="special"><</span> <span class="identifier">F2</span> <span class="special">></span><span class="special">::</span><span class="identifier">result_type</span>
-<a name="id250926-bb"></a><span class="keyword">operator</span><span class="special">(</span><span class="special">)</span><span class="special">(</span><span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_traits</span><span class="special"><</span> <span class="identifier">F2</span> <span class="special">></span><span class="special">::</span><span class="identifier">arg1_type</span><span class="special">,</span>
+<a name="id237843-bb"></a><span class="keyword">operator</span><span class="special">(</span><span class="special">)</span><span class="special">(</span><span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_traits</span><span class="special"><</span> <span class="identifier">F2</span> <span class="special">></span><span class="special">::</span><span class="identifier">arg1_type</span><span class="special">,</span>
<span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_traits</span><span class="special"><</span> <span class="identifier">F2</span> <span class="special">></span><span class="special">::</span><span class="identifier">arg2_type</span><span class="special">,</span> <span class="special">...</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Call operator matching the signature of the function type specified as 2nd template parameter. <p>This will in turn invoke the call operator of the 2nd function passed to the constructor.</p>
-<p><span class="bold"><strong>Note:</strong></span> Similar call operators are present for all specified function types <code class="computeroutput">F1</code>, <code class="computeroutput">F2</code>, etc (even if not explicitly listed by this documentation). </p>
+<p><span class="bold"><strong>Note:</strong></span> Similar call operators are present for all specified function types <code class="computeroutput">F1</code>, <code class="computeroutput">F2</code>, etc (even if not exhaustively listed by this documentation). </p>
</li>
</ol></div>
</div>
@@ -85,8 +85,8 @@
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
-<td align="right"><div class="copyright-footer">Copyright © 2012 Lorenzo Caminiti<p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
+<td align="right"><div class="copyright-footer">Copyright © 2011, 2012 Lorenzo Caminiti<p>
+ Distributed under the Boost Software License, Version 1.0 (see accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
</p>
</div></td>
Modified: sandbox/local_function/libs/functional/overloaded_function/doc/html/index.html
==============================================================================
--- sandbox/local_function/libs/functional/overloaded_function/doc/html/index.html (original)
+++ sandbox/local_function/libs/functional/overloaded_function/doc/html/index.html 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -5,7 +5,7 @@
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="Chapter 1. Boost.Functional/OverloadedFunction 1.0.0">
-<link rel="next" href="functional_overloaded_function/Getting_Started.html" title="Getting Started">
+<link rel="next" href="boost_functional_overloadedfunction/Getting_Started.html" title="Getting Started">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
@@ -17,18 +17,18 @@
<td align="center">More</td>
</tr></table>
<hr>
-<div class="spirit-nav"><a accesskey="n" href="functional_overloaded_function/Getting_Started.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a></div>
+<div class="spirit-nav"><a accesskey="n" href="boost_functional_overloadedfunction/Getting_Started.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a></div>
<div class="chapter">
<div class="titlepage"><div>
<div><h2 class="title">
-<a name="functional_overloaded_function"></a>Chapter 1. Boost.Functional/OverloadedFunction 1.0.0</h2></div>
+<a name="boost_functional_overloadedfunction"></a>Chapter 1. Boost.Functional/OverloadedFunction 1.0.0</h2></div>
<div><div class="author"><h3 class="author">
-<span class="firstname">Lorenzo</span> <span class="surname">Caminiti</span>
+<span class="firstname">Lorenzo</span> <span class="surname">Caminiti <code class="email"><<a class="email" href="mailto:lorcaminiti_at_[hidden]">lorcaminiti_at_[hidden]</a>></code></span>
</h3></div></div>
-<div><p class="copyright">Copyright © 2012 Lorenzo Caminiti</p></div>
+<div><p class="copyright">Copyright © 2011, 2012 Lorenzo Caminiti</p></div>
<div><div class="legalnotice">
-<a name="functional_overloaded_function.legal"></a><p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
+<a name="boost_functional_overloadedfunction.legal"></a><p>
+ Distributed under the Boost Software License, Version 1.0 (see accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
</p>
</div></div>
@@ -36,18 +36,18 @@
<div class="toc">
<p><b>Table of Contents</b></p>
<dl>
-<dt><span class="section">Introduction</span></dt>
-<dt><span class="section"><a href="functional_overloaded_function/Getting_Started.html">Getting
+<dt><span class="section">Introduction</span></dt>
+<dt><span class="section"><a href="boost_functional_overloadedfunction/Getting_Started.html">Getting
Started</a></span></dt>
<dd><dl>
-<dt><span class="section"><a href="functional_overloaded_function/Getting_Started.html#functional_overloaded_function.Getting_Started.compilers_and_platforms">Compilers
+<dt><span class="section"><a href="boost_functional_overloadedfunction/Getting_Started.html#boost_functional_overloadedfunction.Getting_Started.compilers_and_platforms">Compilers
and Platforms</a></span></dt>
-<dt><span class="section">Installation</span></dt>
+<dt><span class="section">Installation</span></dt>
</dl></dd>
-<dt><span class="section">Tutorial</span></dt>
+<dt><span class="section">Tutorial</span></dt>
<dd><dl>
-<dt><span class="section">Overloading</span></dt>
-<dt><span class="section"><a href="functional_overloaded_function/Tutorial.html#functional_overloaded_function.Tutorial.without_function_types">Without
+<dt><span class="section">Overloading</span></dt>
+<dt><span class="section"><a href="boost_functional_overloadedfunction/Tutorial.html#boost_functional_overloadedfunction.Tutorial.without_function_types">Without
Function Types</a></span></dt>
</dl></dd>
<dt><span class="section">Reference</span></dt>
@@ -55,7 +55,7 @@
<dt><span class="section">Header <boost/functional/overloaded_function.hpp></span></dt>
<dt><span class="section">Header <boost/functional/overloaded_function/config.hpp></span></dt>
</dl></dd>
-<dt><span class="section">Acknowledgments</span></dt>
+<dt><span class="section">Acknowledgments</span></dt>
</dl>
</div>
<p>
@@ -63,7 +63,7 @@
</p>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="functional_overloaded_function.Introduction"></a><a class="link" href="index.html#functional_overloaded_function.Introduction" title="Introduction">Introduction</a>
+<a name="boost_functional_overloadedfunction.Introduction"></a><a class="link" href="index.html#boost_functional_overloadedfunction.Introduction" title="Introduction">Introduction</a>
</h2></div></div></div>
<p>
Consider the following functions with distinct signatures:
@@ -83,7 +83,7 @@
<p>
Instead of calling them using their separate names (here <code class="computeroutput"><span class="identifier">BOOST_CHECK</span></code>
is equivalent to <code class="computeroutput"><span class="identifier">assert</span></code>):
- <sup>[<a name="functional_overloaded_function.Introduction.f0" href="#ftn.functional_overloaded_function.Introduction.f0" class="footnote">1</a>]</sup>
+ <sup>[<a name="boost_functional_overloadedfunction.Introduction.f0" href="#ftn.boost_functional_overloadedfunction.Introduction.f0" class="footnote">1</a>]</sup>
</p>
<p>
</p>
@@ -97,7 +97,7 @@
It is possible to use this library to create a single overloaded
function object (or functor)
named <code class="computeroutput"><span class="identifier">identity</span></code> that aggregates
- together the calls to the specific functions (see also "overloaded_function.cpp"
):
+ together the calls to the specific functions (see also identity.cpp
):
</p>
<p>
</p>
@@ -107,6 +107,7 @@
<span class="special">,</span> <span class="keyword">double</span> <span class="special">(</span><span class="keyword">double</span><span class="special">)</span>
<span class="special">></span> <span class="identifier">identity</span><span class="special">(</span><span class="identifier">identity_s</span><span class="special">,</span> <span class="identifier">identity_i</span><span class="special">,</span> <span class="identifier">identity_d</span><span class="special">);</span>
+<span class="comment">// All calls via single `identity` function.</span>
<span class="identifier">BOOST_CHECK</span><span class="special">(</span> <span class="identifier">identity</span><span class="special">(</span><span class="string">"abc"</span><span class="special">)</span> <span class="special">==</span> <span class="string">"abc"</span> <span class="special">);</span>
<span class="identifier">BOOST_CHECK</span><span class="special">(</span> <span class="identifier">identity</span><span class="special">(</span><span class="number">123</span><span class="special">)</span> <span class="special">==</span> <span class="number">123</span> <span class="special">);</span>
<span class="identifier">BOOST_CHECK</span><span class="special">(</span> <span class="identifier">identity</span><span class="special">(</span><span class="number">1.23</span><span class="special">)</span> <span class="special">==</span> <span class="number">1.23</span> <span class="special">);</span>
@@ -122,20 +123,20 @@
</div>
<div class="footnotes">
<br><hr width="100" align="left">
-<div class="footnote"><p><sup>[<a id="ftn.functional_overloaded_function.Introduction.f0" href="#functional_overloaded_function.Introduction.f0" class="para">1</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.boost_functional_overloadedfunction.Introduction.f0" href="#boost_functional_overloadedfunction.Introduction.f0" class="para">1</a>] </sup>
In the examples presented in this documentation, <code class="computeroutput"><span class="identifier">BOOST_CHECK</span></code>
is used instead of <code class="computeroutput"><span class="identifier">assert</span></code>
- because it allows to write regression tests using Boost.Test.
+ because it allows to write regression tests using Boost.Test.
The examples of this documentation are executed as part of the library test
suite to verify that they always compile and run correctly.
</p></div>
</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: January 18, 2012 at 15:25:52 GMT</small></p></td>
+<td align="left"><p><small>Last revised: February 01, 2012 at 00:00:04 GMT</small></p></td>
<td align="right"><div class="copyright-footer"></div></td>
</tr></table>
<hr>
-<div class="spirit-nav"><a accesskey="n" href="functional_overloaded_function/Getting_Started.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a></div>
+<div class="spirit-nav"><a accesskey="n" href="boost_functional_overloadedfunction/Getting_Started.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a></div>
</body>
</html>
Modified: sandbox/local_function/libs/functional/overloaded_function/doc/html/reference.html
==============================================================================
--- sandbox/local_function/libs/functional/overloaded_function/doc/html/reference.html (original)
+++ sandbox/local_function/libs/functional/overloaded_function/doc/html/reference.html 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -6,7 +6,7 @@
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="Chapter 1. Boost.Functional/OverloadedFunction 1.0.0">
<link rel="up" href="index.html" title="Chapter 1. Boost.Functional/OverloadedFunction 1.0.0">
-<link rel="prev" href="functional_overloaded_function/Tutorial.html" title="Tutorial">
+<link rel="prev" href="boost_functional_overloadedfunction/Tutorial.html" title="Tutorial">
<link rel="next" href="boost/overloaded_function.html" title="Class template overloaded_function">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
@@ -20,7 +20,7 @@
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="functional_overloaded_function/Tutorial.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="boost/overloaded_function.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
+<a accesskey="p" href="boost_functional_overloadedfunction/Tutorial.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="boost/overloaded_function.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
@@ -52,15 +52,15 @@
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
-<td align="right"><div class="copyright-footer">Copyright © 2012 Lorenzo Caminiti<p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
+<td align="right"><div class="copyright-footer">Copyright © 2011, 2012 Lorenzo Caminiti<p>
+ Distributed under the Boost Software License, Version 1.0 (see accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="functional_overloaded_function/Tutorial.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="boost/overloaded_function.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
+<a accesskey="p" href="boost_functional_overloadedfunction/Tutorial.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="boost/overloaded_function.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
Modified: sandbox/local_function/libs/functional/overloaded_function/doc/overloaded_function.qbk
==============================================================================
--- sandbox/local_function/libs/functional/overloaded_function/doc/overloaded_function.qbk (original)
+++ sandbox/local_function/libs/functional/overloaded_function/doc/overloaded_function.qbk 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -7,27 +7,25 @@
[library Boost.Functional/OverloadedFunction
[quickbook 1.5]
[version 1.0.0]
- [copyright 2012 Lorenzo Caminiti]
+ [copyright 2011-2012 Lorenzo Caminiti]
[purpose overload functions with one function object]
[license
- Distributed under the Boost Software License, Version 1.0.
- (See accompanying file LICENSE_1_0.txt or copy at
+ Distributed under the Boost Software License, Version 1.0
+ (see accompanying file LICENSE_1_0.txt or copy at
[@http://www.boost.org/LICENSE_1_0.txt])
]
[authors [Caminiti <email>lorcaminiti_at_[hidden]</email>, Lorenzo]]
[category Function Objects and Higher-Order Programming]
- [id functional_overloaded_function]
- [dirname functional_overloaded_function]
]
[def __Introduction__ [link functional_overloaded_function.Introduction Introduction]]
[def __Getting_Started__ [link functional_overloaded_function.Getting_Started Getting Started]]
[def __Tutorial__ [link functional_overloaded_function.Tutorial Tutorial]]
-[def __Boost_Test__ [@http://www.boost.org/doc/libs/release/libs/test/doc/html/index.html Boost.Test]]
-[def __Boost_Function__ [@http://www.boost.org/doc/libs/release/libs/function/doc/html/index.html Boost.Function]]
-[def __Boost_Typeof__ [@http://www.boost.org/doc/libs/release/doc/html/typeof.html Boost.Typeof]]
+[def __Boost_Test__ [@http://www.boost.org/doc/libs/release/libs/test Boost.Test]]
+[def __Boost_Function__ [@http://www.boost.org/doc/libs/release/libs/function Boost.Function]]
+[def __Boost_Typeof__ [@http://www.boost.org/doc/libs/release/libs/typeof Boost.Typeof]]
-[import ../test/overloaded_function.cpp]
+[import ../test/identity.cpp]
This library allows to overload different functions into a single function object.
@@ -35,7 +33,7 @@
Consider the following functions with distinct signatures:
-[test_overloaded_function_declarations]
+[identity_decls]
Instead of calling them using their separate names (here `BOOST_CHECK` is equivalent to `assert`):
[footnote
@@ -43,11 +41,11 @@
The examples of this documentation are executed as part of the library test suite to verify that they always compile and run correctly.
]
-[test_overloaded_function_calls]
+[identity_calls]
-It is possible to use this library to create a single [@http://en.wikipedia.org/wiki/Function_overloading overloaded] function object (or [@http://en.wikipedia.org/wiki/Functor functor]) named `identity` that aggregates together the calls to the specific functions (see also [@../../test/overloaded_function.cpp `"overloaded_function.cpp"`]):
+It is possible to use this library to create a single [@http://en.wikipedia.org/wiki/Function_overloading overloaded] function object (or [@http://en.wikipedia.org/wiki/Functor functor]) named `identity` that aggregates together the calls to the specific functions (see also [@../../test/identity.cpp =identity.cpp=]):
-[test_overloaded_function]
+[identity]
Note how the functions are called via a single overloaded function object `identity` instead of using their different names `identity_s`, `identity_i`, and `identity_d`.
@@ -70,7 +68,7 @@
Programmers can simply instruct the compiler where to find the library header files (`-I` option on GCC, `/I` option on MSVC, etc) and compile code using the library.
The maximum number of functions to overload is given by the [macroref BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX] configuration macro.
-The maximum number of function parameters for each of the specified function types is given by the [macroref BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX] configuration macro.
+The maximum number of function parameters for each of the specified function types is given by the [macroref BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX] configuration macro.
All configuration macros have appropriate default values when they are left undefined by the user.
[endsect]
@@ -85,23 +83,22 @@
Consider the following functions with distinct signatures:
-[test_overloaded_function_declarations]
+[identity_decls]
-This library provides a [classref boost::overloaded_function] class template that creates a single overloaded function object that can be used to call the specified functions instead of using the separate function names (see also [@../../test/overloaded_function.cpp `"overloaded_function.cpp"`]):
+This library header [headerref boost/functional/overloaded_function.hpp] provides a [classref boost::overloaded_function] class template that creates a single overloaded function object that can be used to call the specified functions instead of using the separate function names (see also [@../../test/identity.cpp =identity.cpp=]):
-[test_overloaded_function]
+[identity]
-Note how function types in the following format (this is the format of __Boost_Function__'s preferred syntax):
+Note how function types in the following format are passed as template parameters to [classref boost::overloaded_function] (this is the format of __Boost_Function__'s preferred syntax):
- result_type (argument1_type, argument2_type, ...)
+ ``/result-type/`` (``/argument1-type/``, ``/argument2-type/``, ...)
-are passed as template parameters to the [classref boost::overloaded_function] class template.
-Then the relative function pointers, function references, or monomorphic function objects are passed to the [classref boost::overloaded_function] constructor matching the order of the specified template parameters.
+Then the relative function pointers, function references, or [@http://en.wikipedia.org/wiki/Polymorphism_(computer_science) monomorphic function] objects are passed to the [classref boost::overloaded_function] constructor matching the order of the specified template parameters.
[footnote
-Function pointers are of the form `result_type (*)(argument1_type, ...)` (the C++ compiler is usually able to automatically promote a function name to a function pointer in a context where a function pointer is expected even if the function name is not prefixed by `&`).
-Function references are of the form `result_type (&)(argument1_type, ...)`.
-Function types are of the form `result_type (argument1_type, ...)` (note how they lack of both `*` and `&` when compared to function pointers and function references).
-Finally, monomorphic function objects are instances of classes with a non-template call operator of the form `result_type operator()(argument1_type, ...)`.
+Function pointers are of the form [^['result-type ]]`(*)(`[^['argument1-type]]`, ...)` (the C++ compiler is usually able to automatically promote a function name to a function pointer in a context where a function pointer is expected even if the function name is not prefixed by `&`).
+Function references are of the form [^['result-type ]]`(&)(`[^['argument1-type]]`, ...)`.
+Function types are of the form [^['result-type ]]`(`[^['argument1-type]]`, ...)` (note how they lack of both `*` and `&` when compared to function pointers and function references).
+Finally, monomorphic function objects are instances of classes with a non-template call operator of the form [^['result-type ]]`operator()(`[^['argument1-type]]`, ...)`.
]
In the above example, `identity_s` is passed as function pointer (the function address is automatically taken from the function name by compiler), `identity_i` as function reference, and `identity_d` as function object.
@@ -120,18 +117,18 @@
The function types are automatically deduced from the specified functions and the appropriate [classref boost::overloaded_function] instantiation is returned by [funcref boost::make_overloaded_function].
The [funcref boost::make_overloaded_function] function template can be useful when used together with __Boost_Typeof__'s `BOOST_AUTO` (or C++11 `auto`).
-For example (see also [@../../test/overloaded_function.cpp `"overloaded_function.cpp"`]):
+For example (see also [@../../test/identity.cpp =identity.cpp=]):
-[test_make_overloaded_function]
+[identity_make]
Note how the overloaded function object `identity` has been created specifying only the functions `identity_s`, `identity_i`, `identity_d` and without specifying the function types `const std::string& (const std::string&)`, `int (int)`, and `double (double)` as required instead by [classref boost::overloaded_function].
Therefore, [funcref boost::make_overloaded_function] provides a more concise syntax in this context when compared with [classref boost::overloaded_function].
Another case where [funcref boost::make_overloaded_function] can be useful is when the overloaded function object is passed to a function template which can hide the specific [classref boost::overloaded_function] type using a template parameter.
-For example (see also [@../../test/overloaded_function.cpp `"overloaded_function.cpp"`]):
+For example (see also [@../../test/identity.cpp =identity.cpp=]):
-[test_make_overloaded_function_check]
-[test_make_overloaded_function_call]
+[identity_make_checks]
+[identity_make_call]
[endsect]
@@ -139,7 +136,7 @@
[xinclude reference.xml]
-[section Acknowledgments]
+[section:Acknowledgments Acknowledgments]
Many thanks to Mathias Gaunard for suggesting to implement [classref boost::overloaded_function] and for some sample code.
Modified: sandbox/local_function/libs/functional/overloaded_function/test/Jamfile.v2
==============================================================================
--- sandbox/local_function/libs/functional/overloaded_function/test/Jamfile.v2 (original)
+++ sandbox/local_function/libs/functional/overloaded_function/test/Jamfile.v2 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -1,5 +1,5 @@
-# Copyright (C) 2009-2012 Lorenzo Caminiti
+# Copyright (C) 2011-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)
Modified: sandbox/local_function/libs/functional/overloaded_function/test/identity.cpp
==============================================================================
--- sandbox/local_function/libs/functional/overloaded_function/test/identity.cpp (original)
+++ sandbox/local_function/libs/functional/overloaded_function/test/identity.cpp 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -1,5 +1,5 @@
-// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Copyright (C) 2011-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)
@@ -10,7 +10,7 @@
#include <boost/test/unit_test.hpp>
#include <string>
-//[identity_checks
+//[identity_make_checks
template<typename F>
void check(F identity) {
BOOST_CHECK( identity("abc") == "abc" );
@@ -44,6 +44,7 @@
, double (double)
> identity(identity_s, identity_i, identity_d);
+ // All calls via single `identity` function.
BOOST_CHECK( identity("abc") == "abc" );
BOOST_CHECK( identity(123) == 123 );
BOOST_CHECK( identity(1.23) == 1.23 );
Modified: sandbox/local_function/libs/local_function/doc/acknowledgements.qbk
==============================================================================
--- sandbox/local_function/libs/local_function/doc/acknowledgements.qbk (original)
+++ sandbox/local_function/libs/local_function/doc/acknowledgements.qbk 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -6,8 +6,6 @@
[section:Acknowledgments Acknowledgments]
-_at_todo add thanks from the review
-
This section aims to recognize the contributions of /all/ the different people that participated directly or indirectly to the design and development of this library.
Many thanks to Steven Watanabe and Vicente Botet for suggesting to me to use __Boost_ScopeExit__ binding to [@http://boost.2283326.n4.nabble.com/contract-diff-n1962-tt2671482.html#none emulate local functions].
@@ -26,6 +24,10 @@
Thanks to Steven Watanabe, Vicente Botet, Michael Caisse, Yechezkel Mett, Joel de Guzman, Thomas Heller, et al. for helping with the __Alternatives__ section and with the profiling of the different alternatives.
+Many thanks to the library's [@http://lists.boost.org/boost-announce/2011/12/0340.php Boost review] manager: Jeffrey Lee Hellrung.
+Thanks also to all the people that submitted a (positive and negative) review: Andrzej Krzemienski, Edward Diener, Gregory Crosswhite, John Bytheway, Hartmut Kaiser, Krzysztof Czainski, Nat Lindon, Pierre Morcello, Thomas Heller, and Vicente J. Botet.
+Thanks to everyone else that commented (positively and negatively) on the library during its Boost review.
+
Finally, many thanks to the entire __Boost__ community and [@http://lists.boost.org mailing list] for providing valuable comments about this library and great insights on the C++ programming language.
[endsect]
Modified: sandbox/local_function/libs/local_function/doc/advanced_topics.qbk
==============================================================================
--- sandbox/local_function/libs/local_function/doc/advanced_topics.qbk (original)
+++ sandbox/local_function/libs/local_function/doc/advanced_topics.qbk 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -14,10 +14,10 @@
However, the usual C++ syntax for default parameters that uses the assignment symbol `=` cannot be used.
[footnote
*Rationale.*
-The assignment symbol `=` cannot be used to specify default parameter values because default values are not part of the parameter type so they cannot be handled using template metaprogamming.
+The assignment symbol `=` cannot be used to specify default parameter values because default values are not part of the parameter type so they cannot be handled using template meta-programming.
Default parameter values need to be separated from the rest of the parameter declaration using the preprocessor.
-Specifically, this library needs to use preprocessor mataprogramming to remove default values when constructing the local function type and then to count the number of default values to provide the correct set of call operators for the local functor.
-Therefore, the symbol `=` cannot be used because it cannot be handled by preprocessor metaprogramming (non-alphanumeric symbols cannot be detected by preprocessor metaprogramming because it cannot be concatenated by the preprocessor).
+Specifically, this library needs to use preprocessor meta-programming to remove default values when constructing the local function type and then to count the number of default values to provide the correct set of call operators for the local functor.
+Therefore, the symbol `=` cannot be used because it cannot be handled by preprocessor meta-programming (non-alphanumeric symbols cannot be detected by preprocessor meta-programming because they cannot be concatenated by the preprocessor).
]
The keyword `default` is used instead:
@@ -25,22 +25,22 @@
For example, let's program a local function `add(x, y)` where the second parameter `y` is optional and has a default value of `2` (see also [@../../test/add_default.cpp =add_default.cpp=]):
-[test_add_default]
+[add_default]
-Programmers can define a `WITH_DEFAULT` macro similar to the following if they think it improves readability over the above syntax (see also [@../../test/add_with_default.cpp =add_with_default.cpp=]):
+Programmers can define a `WITH_DEFAULT` macro similar to the following if they think it improves readability over the syntax above (see also [@../../test/add_with_default.cpp =add_with_default.cpp=]):
[footnote
-The authors do not personally find the use of the `WITH_DEFAULT` macro more readable and they prefer to use the `default` "keyword" directly.
-Furthermore, `WITH_DEFAULT` need to be defined differently for compilers without variadic macros `#define WITH_DEFAULT (default)` so it can only be defined by programmers based on the syntax they decide to use.
+The authors do not personally find the use of the `WITH_DEFAULT` macro more readable and they prefer to use the `default` keyword directly.
+Furthermore, `WITH_DEFAULT` needs to be defined differently for compilers without variadic macros `#define WITH_DEFAULT (default)` so it can only be defined by programmers based on the syntax they decide to use.
]
-[test_add_with_default_macro]
-[test_add_with_default]
+[add_with_default_macro]
+[add_with_default]
[endsect]
[section Commas and Symbols in Macros]
-The C++ preprocessor does not allow commas `,` within macro parameters unless they are wrapped by round parenthesis `()`.
+The C++ preprocessor does not allow commas `,` within macro parameters unless they are wrapped by round parenthesis `()` (see the __Boost_Utility_IdentityType__ documentation for details).
Therefore, using commas within the local function parameters and bindings will generate (cryptic) preprocessor errors unless they are wrapped with an extra set of round parenthesis `()` as explained here.
[note
@@ -51,7 +51,7 @@
In addition, local function parameter types cannot start with non-alphanumeric symbols (alphanumeric symbols are `A-Z`, `a-z`, and `0-9`).
[footnote
*Rationale.*
-This limitation derives from the fact that `BOOST_LOCAL_FUNCTION` uses preprocessor token concatenation [^##] to inspect the parameter type token (to see if this token is a parameter or a bound variable) and the C++ preprocessor does not allow to concatenate non-alphanumeric tokens.
+This limitation is because this library uses preprocessor token concatenation [^##] to inspect the macro parameters (to distinguish between function parameters, bound variables, etc) and the C++ preprocessor does not allow to concatenate non-alphanumeric tokens.
]
The library will generate (cryptic) preprocessor errors if a parameter type starts with a non-alphanumeric symbol.
@@ -73,7 +73,7 @@
The preprocessor always interprets unwrapped commas as separating macro parameters.
Thus in this case the comma will indicate to the preprocessor that the first macro parameter is `const std::map<std::tring`, the second macro parameter is `size_t>& m`, etc instead of passing `const std::map<std::string, size_t>& m` as a single macro parameter.
]
-The __Boost_Utility__ macro `BOOST_IDENTITY_TYPE(`/parenthesized-type/`)` from the header =boost/utility/identity_type.hpp= can be used to wrap a type within extra parenthesis `()` so to overcome this issue:
+The __Boost_Utility_IdentityType__ macro `BOOST_IDENTITY_TYPE(`[^['parenthesized-type]]`)` from the header =boost/utility/identity_type.hpp= can be used to wrap a type within extra parenthesis `()` so to overcome the problem:
#include <boost/utility/identity_type.hpp>
@@ -86,22 +86,13 @@
This macro expands to an expression that evaluates (at compile-time) exactly to the specified type.
Note that a total of two set of parenthesis `()` are needed: The parenthesis to invoke the `BOOST_IDENTITY_TYPE(...)` macro plus the parenthesis to wrap the type expression (and therefore any comma `,` that it contains) passed as parameter to the `BOOST_IDENTITY_TYPE((...))` macro.
-[footnote
-*Rationale.*
-Using variadic macros, this extra set of parenthesis could be eliminated requiring only the parenthesis to invoke the `BOOST_IDENTITY_TYPE` macro.
-However, this feature is currently not implemented and the double parenthesis are always needed when invoking this macro.
-]
-Finally, the `BOOST_IDENTITY_TYPE` macro must be prefixed by the `typename` keyword:
-
- typename BOOST_IDENTITY_TYPE(``/parenthesized-type/``)
-
-When used together with the [macroref BOOST_LOCAL_FUNCTION_TPL] macro within templates.
+Finally, the `BOOST_IDENTITY_TYPE` macro must be prefixed by the `typename` keyword `typename BOOST_IDENTITY_TYPE(`[^['parenthesized-type]]`)` when used together with the [macroref BOOST_LOCAL_FUNCTION_TPL] macro within templates.
[note
Often, there might be better ways to overcome this limitation that lead to code which is more readable than the one using the `BOOST_IDENTITY_TYPE` macro.
]
-For example, in this case a `typedef` could have been used in the enclosing scope to obtain the following valid and perhaps more readable code:
+For example, in this case a `typedef` from the enclosing scope could have been used to obtain the following valid and perhaps more readable code:
typedef std::map<std::string, size_t> map_type;
void BOOST_LOCAL_FUNCTION(
@@ -151,7 +142,7 @@
Consider the following complete example (see also [@../../test/macro_commas.cpp =macro_commas.cpp=]):
-[test_macro_commas]
+[macro_commas]
[endsect]
@@ -161,7 +152,7 @@
For example (see also [@../../test/return_assign.cpp =return_assign.cpp=]):
-[test_return_assign]
+[return_assign]
Note that:
@@ -174,7 +165,7 @@
Local functions should always be bound by constant reference `const bind&` to avoid unnecessary copies.
For example, the following local function `inc_sum` binds the local function `inc` so `inc_sum` can call `inc` (see aslo [@../../test/transform.cpp =transform.cpp=]):
-[test_transform]
+[transform]
[endsect]
@@ -183,11 +174,11 @@
It is possible to nest local functions into one another.
For example (see also [@../../test/nesting.cpp =nesting.cpp=]):
-[test_nesting]
+[nesting]
[endsect]
-[section Deducing Bound Types (concepts, etc)]
+[section Accessing Types (concepts, etc)]
This library never requires to explicitly specify the type of bound variables.
From within local functions, programmers can access the type of a bound variable using the following macro:
@@ -195,16 +186,27 @@
BOOST_LOCAL_FUNCTION_TYPEOF(``/bound-variable-name/``)
The [macroref BOOST_LOCAL_FUNCTION_TYPEOF] macro expands to a type expression that evaluates (at compile-time) to the fully qualified type of the bound variable with the specified name.
-This type expression is fully qualified in the sense that it will be constant if the variable is bound by constant `const bind[&]` and it will also be a reference is the variable is bound by reference `[const] bind&` (if needed, programmers can strip away the `const` and `&` qualifiers using `boost::remove_const` and `boost::remove_reference`, see __Boost_TypeTraits__).
+This type expression is fully qualified in the sense that it will be constant if the variable is bound by constant `const bind[&]` and it will also be a reference if the variable is bound by reference `[const] bind&` (if needed, programmers can remove the `const` and `&` qualifiers using `boost::remove_const` and `boost::remove_reference`, see __Boost_TypeTraits__).
The deduced bound type can be used within the body to check concepts, declare local variables, etc.
For example (see also [@../../test/typeof.cpp =typeof.cpp=] and [@../../test/addable.hpp =addable.hpp=]):
-[test_typeof]
+[typeof]
+
+Within templates, [macroref BOOST_LOCAL_FUNCTION_TYPEOF] should not be prefixed by the `typename` keyword but eventual type manipulations need the `typename` prefix as usual (see also [@../../test/typeof_template.cpp =typeof_template.cpp=] and [@../../test/addable.hpp =addable.hpp=]):
-Within templates, [macroref BOOST_LOCAL_FUNCTION_TYPEOF] does not require to be prefixed by the `typename` keyword but eventual type manipulations need the `typename` prefix as usual (see also [@../../test/typeof_template.cpp =typeof_template.cpp=] and [@../../test/addable.hpp =addable.hpp=]):
+[typeof_template]
-[test_typeof_template]
+It is best to use the [macroref BOOST_LOCAL_FUNCTION_TYPEOF] macro instead of using __Boost_Typeof__ so to reduce the number of times that __Boost_Typeof__ is invoked:
+
+# Either the library already internally used __Boost_Typeof__ once, in which case using this macro will not use __Boost_Typeof__ again.
+# Or, the bound variable type is explicitly specified by programmers (see below), in which case using this macro will not use __Boost_Typeof__ at all.
+
+Furthermore, within the local function body it possible to access the result type using `result_type`, the type of the first parameter using `arg1_type`, the type of the second parameter using `arg2_type`, etc.
+[footnote
+*Rationale.*
+The type names `result_type` and `arg`[^['N]]`_type` follow the __Boost_TypeTraits__ naming conventions for function traits.
+]
[endsect]
@@ -220,37 +222,38 @@
bind(``/class-type/``*) this_ // Bind object `this` with explicit type.
const bind(``/class-type/``*) this_ // Bind object `this` by constant with explicit type.
-Note that within the local function body it is always possible to abstract the access to the type of a bound variable using [macroref BOOST_LOCAL_FUNCTION_TYPEOF] (even when the bound variable type is explicitly specified).
+Note that within the local function body it is always possible to abstract the access to the type of a bound variable using [macroref BOOST_LOCAL_FUNCTION_TYPEOF] (even when the bound variable type is explicitly specified in the local function declaration).
-The library also uses __Boost_Typeof__ to determine the local function result type (because this type specified outside the [macroref BOOST_LOCAL_FUNCTION] macro).
-Thus it is also possible to specify the local function result type as one of the [macroref BOOST_LOCAL_FUNCTION] macro parameters prefixed by `return` so the library will not use __Boost_Typeof__ to deduce the result type:
+The library also uses __Boost_Typeof__ to determine the local function result type (because this type is specified outside the [macroref BOOST_LOCAL_FUNCTION] macro).
+Thus it is also possible to specify the local function result type as one of the [macroref BOOST_LOCAL_FUNCTION] macro parameters prefixing it by `return` so the library will not use __Boost_Typeof__ to deduce the result type:
BOOST_LOCAL_FUNCTION_TYPE(return ``[^/result-type/]``, ...)
Note that the result type must be specified only once either before the macro (without the `return` prefix) or as one of the macro parameters (with the `return` prefix).
As usual, the result type can always be `void` to declare a function returning nothing (so `return void` is allowed when the result type is specified as one of the macro parameters).
-The following example specifies the type of all bound variables and of the local function result (see also [@../../test/add_typed.cpp =add_typed.cpp=]):
+The following example specifies all bound variables and result types (see also [@../../test/add_typed.cpp =add_typed.cpp=]):
[footnote
In the examples of this documentation, we specify bound variables, function parameters, and result type in this order because this is the order used by __CPP11_lambda__ functions.
However, the library accepts bound variables, function parameters, and the result type in any order.
]
-[test_add_typed]
+[add_typed]
Unless necessary, it is recommended to not specify the bound variable and result types.
Let the library deduce these types so the local function syntax will be more concise and the local function declaration will not have to change if a bound variable type changes (facilitating maintenance).
[note
-Unfortunately, the current implementation implementation still internally uses __Boost_Typeof__ once to deduce the local function object type (see the __Implementation__ section) even when all bound variable and result types are explicitly specified.
+Unfortunately, even when all bound variables and result types are explicitly specified, the currently library implementation still has to use __Boost_Typeof__ once (to deduce the local function object type, see the __Implementation__ section).
]
+
[endsect]
[section Inlining]
Local functions can be declared inline to increase the chances that the compiler will be able to reduce the run-time of the local function call by inlining the generated assembly code.
-A local function is declared inline by prefixing the local function name passed to the [macroref BOOST_LOCAL_FUNCTION_NAME] macro with the "keyword" `inline`:
+A local function is declared inline by prefixing its name with the keyword `inline`:
``/result-type/`` BOOST_LOCAL_FUNCTION(``/parameters/``) {
... // Body.
@@ -276,14 +279,14 @@
For example, the following local function is declared inline (thus a for-loop needs to be used for portability instead of passing the local function as a template parameter to the `std::for_each` algorithm, see also [@../../test/add_inline.cpp =add_inline.cpp=]):
-[test_add_inline]
+[add_inline]
[endsect]
[section Recursion]
Local functions can be declared [@http://en.wikipedia.org/wiki/Recursion_(computer_science)#Recursive_procedures recursive] so a local function can recursively call itself from its body (as usual with C++ functions).
-A local function is declared recursive by prefixing the local function name passed to [macroref BOOST_LOCAL_FUNCTION_NAME] macro with the "keyword" `recursive` (thus `recursive` is not a valid local function name):
+A local function is declared recursive by prefixing its name with the "keyword" `recursive` (thus `recursive` cannot be used as a local function name):
``/result-type/`` BOOST_LOCAL_FUNCTION(``/parameters/``) {
... // Body.
@@ -291,7 +294,7 @@
For example, the following local function is used to recursively calculate the factorials of all the numbers in the specified vector (see also [@../../test/factorial.cpp =factorial.cpp=]):
-[test_factorial]
+[factorial]
Compilers have not been observed to be able to inline recursive local function calls (not even when the recursive local function is also declared inline as in `BOOST_LOCAL_FUNCTION_NAME(inline recursive factorial)`).
@@ -301,7 +304,7 @@
[footnote
*Rationale.*
This limitation comes from the fact that the global functor used to pass the local function as a template parameter (and eventually returned outside the declarations scope) does not know the local function name so the local function name used for recursive call cannot be set in the global functor.
-This limitation together with preventing the possibility for inlining are the reasons why local functions do not allow for recursion unless programmers explicitly declare them `recursive`.
+This limitation together with preventing the possibility for inlining are the reasons why local functions are not recursive unless programmers explicitly declare them `recursive`.
]
This is not a limitation with respect to __CPP11_lambda__ functions because lambdas can never call themselves recursively (in other words, there is no recursive lambda function that can successfully be called outside its declaration scope because there is no recursive lambda function at all).
]
@@ -310,11 +313,11 @@
[section Overloading]
-It is possible to overload local functions using the `boost::overloaded_function` functor of __Boost_FunctionalOverloadedFunction__ from the header =boost/functional/overloaded_function.hpp= (see the __Boost_FunctionalOverloadedFunction__ documentation for details).
+It is possible to overload local functions using the `boost::overloaded_function` functor of __Boost_Functional_OverloadedFunction__ from the header =boost/functional/overloaded_function.hpp= (see the __Boost_Functional_OverloadedFunction__ documentation for details).
In the following example, the overloaded function object `add` can be called with signatures from either the local function `add_s`, or the local function `add_d`, or the local function `add_d` with its extra default parameter, or the function pointer `add_i` (see also [@../../test/overload.cpp =overload.cpp=]):
-[test_overload]
+[overload]
[endsect]
@@ -329,7 +332,7 @@
For example (see also [@../../test/add_except.cpp =add_except.cpp=]):
-[test_add_except]
+[add_except]
[endsect]
@@ -351,7 +354,7 @@
For example (see also [@../../test/add_classifiers.cpp =add_classifiers.cpp=]):
-[test_add_classifiers]
+[add_classifiers]
[endsect]
@@ -363,15 +366,15 @@
[
[ C++ Function Feature ]
[ Local Function Support ]
- [ Reason ]
+ [ Comment ]
]
[
[ `export` ]
[ No ]
- [ This is not supported because local functions cannot be templates (plus most C++ compilers do not implement `export`). ]
+ [ This is not supported because local functions cannot be templates (plus most C++ compilers do not implement `export` at all). ]
]
[
- [ `template<`/template-parameter-list/`>` ]
+ [ `template<`[^['template-parameter-list]]`>` ]
[ No ]
[ This is not supported because local functions are implemented using local classes and __CPP03__ local classes cannot be templates. ]
]
@@ -383,7 +386,7 @@
[
[ `inline` ]
[ Yes ]
- [ Local functions can be specified `inline` to improve the chances that __CPP03__ standard compilers can optimize the local function call run-time (but `inline` local functions cannot be passes as template parameters on __CPP03__ standard compilers). ]
+ [ Local functions can be specified `inline` to improve the chances that __CPP03__ standard compilers can optimize the local function call run-time (but `inline` local functions cannot be passed as template parameters on __CPP03__ standard compilers, see the __Advanced_Topics__ section). ]
]
[
[ `extern` ]
@@ -439,12 +442,12 @@
Naming a local function `operator...` will generate a compile-time error.
[footnote
*Rationale.*
-This is the because a local function name must be a valid local variable name (the local variable to hold the local functor) and operators cannot be used as local variable names.
+This is the because a local function name must be a valid local variable name (the local variable used to hold the local functor) and operators cannot be used as local variable names.
]
For example, the following code will not compile:
-[test_operator_err]
+[operator_err]
[h5 Goto]
@@ -452,7 +455,7 @@
For example, the following will not compile:
-[test_goto_err]
+[goto_err]
[endsect]
Modified: sandbox/local_function/libs/local_function/doc/alternatives.qbk
==============================================================================
--- sandbox/local_function/libs/local_function/doc/alternatives.qbk (original)
+++ sandbox/local_function/libs/local_function/doc/alternatives.qbk 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -6,7 +6,7 @@
[section:Alternatives Annex: Alternatives]
-This section compares the features offered by this library with similar features offered by other libraries and by the new __CPP11__ standard.
+This section compares the features offered by this library with similar features offered by C++ and by other libraries.
[h5 Features]
@@ -33,13 +33,13 @@
[
[ ['Can be defined using C++ statement syntax] ]
[ Yes.
-Plus eventual compiler errors follow the usual format of C++ statement errors. ]
+Plus eventual compiler errors and debugging follow the usual format of C++ statement errors. ]
[ Yes.
-Plus eventual compiler errors follow the usual format of C++ statement errors. ]
+Plus eventual compiler errors and debugging follow the usual format of C++ statement errors. ]
[ Yes.
-Plus eventual compiler errors follow the usual format of C++ statement errors. ]
+Plus eventual compiler errors and debugging follow the usual format of C++ statement errors. ]
[ Yes.
-Plus eventual compiler errors follow the usual format of C++ statement errors. ]
+Plus eventual compiler errors and debugging follow the usual format of C++ statement errors. ]
[ No (it uses C++ __expression_template__ syntax). ]
]
[
@@ -67,10 +67,11 @@
The variable names are repeated in the function declaration (plus there is a short-hand syntax to bind all variables in scope at once) so they can be bound by constant value and by reference (the object `this` can also be bound).
However, variables cannot be bound by constant references and non-constant value (see below). ]
[ No.
-Programmers must manually manage functor member variables and explicitly specify their types to access variables in scope. ]
+Programmers must manually program functor data members and explicitly specify their types to access variables in scope. ]
[ No.
-Programmers must manually manage functor member variables and explicitly specify their types to access variables in scope. ]
- [ Yes (variables in scope are accessible as usual within expressions) plus `boost::phoenix::let` can be used to bind variables by constant reference. ]
+Programmers must manually program functor data members and explicitly specify their types to access variables in scope. ]
+ [ Yes.
+Variables in scope are accessible as usual within expressions (plus `boost::phoenix::let` can be used to bind variables by constant reference). ]
]
[
[ ['[@http://en.wikipedia.org/wiki/Type_polymorphism#Parametric_polymorphism Polymorphic] in the unbound parameter types] ]
@@ -92,12 +93,13 @@
* __CPP11_lambda__ functions do not allow to bind variables in scope by constant reference or by non-constant value.
Because a variable cannot be bound by constant reference, __CPP11_lambda__ functions can bind a variable by constant only if the variable is `CopyConstructible` and the binding requires a (potentially expensive) extra copy operation.
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.cpp =noncopyable_lambda.cpp=] and [@../../example/noncopyable_local_function.cpp =noncopyable_local_function.cpp=]):
+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=]):
[table
[ [C++11 Lambda] [Boost.LocalFunction] ]
- [ [[noncopyable_lambda]] [[noncopyable_local_function]] ]
+ [ [[noncopyable_lambda_err]] [[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=]):
@@ -107,7 +109,7 @@
[ [[expensive_copy_lambda]] [[expensive_copy_local_function]] ]
]
-Note that 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).
+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.
[*Local Functor]
@@ -116,7 +118,7 @@
[table
[ [Local Functor] [Boost.LocalFunction] ]
- [ [[add_local_functor]] [[test_add]] ]
+ [ [[add_local_functor]] [[add]] ]
]
[*Global Functor]
@@ -125,7 +127,7 @@
[table
[ [Global Functor] [Boost.LocalFunction] ]
- [ [[add_global_functor]] [[test_add]] ]
+ [ [[add_global_functor]] [[add]] ]
]
However, note that global functors do not allow to define the function locally so they are not a real alternative implementation of local functions.
@@ -136,10 +138,10 @@
[table
[ [Boost.Phoenix] [Boost.LocalFunction] ]
- [ [[add_phoenix]] [[test_add]] ]
+ [ [[add_phoenix]] [[add]] ]
]
-The comparison in this section does not include the __Boost_Lambda__ library because it is obsolete and it was replaced replaced by __Boost_Phoenix__.
+The comparison in this section does not include the __Boost_Lambda__ library because that library is obsolete and it was replaced by __Boost_Phoenix__.
The __Boost_Phoenix__ library version 3.0 is used for this comparison.
[h5 Performances]
@@ -147,9 +149,10 @@
The following tables compare run-times, compile-times, and binary sizes for the different alternatives presented here for local functions.
Overall, this library has compile-times and generates binary sizes similar to the ones of the other approaches.
-This library run-times on __CPP03__ compliant compilers were measured to be larger than other approaches when compiler optimization is enabled (using `bjam release ...`).
-However, on compilers that allow to pass local types as template parameters (e.g., MSVC 8.0 or GCC 4.5.3 with __CPP11__ features enabled [^-std=c++0x], see also __N2657__) this library automatically generates optimized code that runs as fast as the fastest of the other approaches (see __Boost_LocalFunction__ below).
-When this library local function is specified `inline` (see __Boost_LocalFunction__ Inline below and the __Advanced_Topics__ section) its run-times are always comparable to both the Local Functor and Global Functor approaches (but in this case the local function cannot be portably passed as template parameter, see __N2657__, so `std::for_each` is replaced by a for-loop).
+This library run-times on __CPP03__ compilers were measured to be larger than other approaches when compiler optimization is enabled (using `bjam release ...`).
+However, on compilers that allow to pass local types as template parameters (e.g., MSVC 8.0 or GCC 4.5.3 with __CPP11__ features enabled [^-std=c++0x], see also __N2657__) this library automatically generates optimized code that runs as fast as the fastest of the other approaches (see the "Boost.LocalFunction" approach below).
+When this library local function is specified `inline` (see the "Boost.LocalFunction Inline" approach below and the __Advanced_Topics__ section) its run-times are always comparable to both the "Local Functor" and "Global Functor" approaches.
+However, in these cases the local function cannot be portably passed as template parameter (see __N2657__) so `std::for_each` is replaced by a for-loop (on MSVC the for-loop, and not the local function in fact the same applies to local functors, was measured to have worst performances than using `std::for_each`).
Finally, this library run-times are always among the fastest when no compiler optimization is enabled (using `bjam debug ...`).
[note
@@ -159,7 +162,7 @@
This run-time performance cost is not present on compilers that allow to pass local types as template parameters (e.g., MSVC 8.0 or GCC 4.5.3 with __CPP11__ features enabled [^-std=c++0x]) because this library does not have to use the extra function pointer to implement the local function call (it directly passes the local class type as template parameter).
]
-This run-time performance cost on __CPP03__ compliant compilers might or might not be an issue depending on the performance requirements of specific applications.
+This run-time performance cost on __CPP03__ compilers might or might not be an issue depending on the performance requirements of specific applications.
For example, an application might already be using a number of indirect function calls (function pointers, virtual functions, etc) for which the overhead added by using the one extra function pointer required by the local function call might not be noticeable within the overall program run-time.
Finally, note that only a very simple local function body with just a single instruction was used for the anaylsis presented here (see the source files below).
@@ -168,9 +171,10 @@
The following commands were executed from the library example directory to measure compile-time, binary size, and run-time respectively:
[pre
-> python chrono.py bjam {release|debug} <PROGRAM> # compile-time
-> size <PROGRAM> # binary size (Linux and Gygwin)
-> <PROGRAM> # run-time
+> touch <FILE_NAME>.cpp # force recompilation
+> python chrono.py bjam {release|debug} <FILE_NAME> # compile-time
+> size <FILE_NAME> # binary size
+> ./<FILE_NAME> # run-time
]
The local function was called =1e8= times to add together all the elements of a vector and the run-time was measured using __Boost_Chrono__ averaging over =10= executions of the vector summation (see the source files below).
@@ -179,7 +183,7 @@
[
[Legend]
[Approach]
- [File]
+ [Source File]
]
[
[[$../../example/profile_legend_local_function.png]]
@@ -193,7 +197,11 @@
]
[
[[$../../example/profile_legend_lambda.png]]
- [__CPP11__ Lambda Function]
+ [__CPP11__ Lambda Function
+[footnote
+Measurements available only for __CPP11__ compilers.
+]
+ ]
[[@../../example/profile_lambda.cpp =profile_lambda.cpp=]]
]
[
Modified: sandbox/local_function/libs/local_function/doc/bibliography.qbk
==============================================================================
--- sandbox/local_function/libs/local_function/doc/bibliography.qbk (original)
+++ sandbox/local_function/libs/local_function/doc/bibliography.qbk 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -8,7 +8,7 @@
This section lists all the bibliographic references cited by this documentation.
-_at_todo complete this
+__N1613__ Thorsten Ottosen. /Proposal to add Design by Contract to C++./ The C++ Standards Committee, document no. N1613=04-0053, 2004.
__N2511__ Alisdair Meredith. /Named Lambdas and Local Functions./ The C++ Standards Committee, document no. N2511=08-0021, 2008.
Modified: sandbox/local_function/libs/local_function/doc/examples.qbk
==============================================================================
--- sandbox/local_function/libs/local_function/doc/examples.qbk (original)
+++ sandbox/local_function/libs/local_function/doc/examples.qbk 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -6,7 +6,7 @@
[section:Examples Examples]
-This sections lists some examples that use this library features.
+This section lists some examples that use this library.
[section GCC Lambdas (Without C++11)]
@@ -20,7 +20,7 @@
[table
[ [With Local Functions (GCC only)] [C++11 Lambdas] ]
- [ [[example_gcc_lambda]] [[example_gcc_lambda_cpp11]] ]
+ [ [[gcc_lambda]] [[gcc_lambda_cpp11]] ]
]
Where the macros are defined in [@../../example/gcc_lambda.hpp =gcc_lambda.hpp=].
@@ -29,13 +29,13 @@
The macros automatically detect if the compiler supports __CPP11_lambda__ functions in which case the implementation uses native lambdas instead of local functions in statement expressions.
However, __CPP11_lambda__ functions do not support constant binding so it is best to only use `const bind variable` (same as __CPP11_lambda__ `=variable`) and `bind& variable` (same as __CPP11_lambda__ `&variable`) because these have the exact same semantic between the local function and native lambda implementation.
Unfortunately, the __CPP11_lambda__ short-hand binds `&` and `=` (which automatically bind all variables in scope either by reference or value) are not supported by the macros because they are not supported by the local function implementation.
-Finally, the result type `return `[^/result-type/] is optional and it is assumed `void` when it is not specified (same as with __CPP11_lambda__ functions).
+Finally, the result type `return `[^['result-type]] is optional and it is assumed `void` when it is not specified (same as with __CPP11_lambda__ functions).
[endsect]
[section Constant Blocks]
-It is possible to use local functions to check assertions between variables that are made constant within the asserted expression.
+It is possible to use local functions to check assertions between variables that are made constant within the asserted expressions.
This is advantageous because assertions are not supposed to change the state of the program and ideally the compiler will not compile assertions that modify variables.
For example, consider the following assertion where by mistake we programmed `operator=` instead of `operator==`:
@@ -44,12 +44,12 @@
assert(x = y); // Mistakenly `=` instead of `==`.
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 introduced 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.cpp =const_block.cpp=]):
+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=]):
[table
- [ [With Local Functions] [N1613 Constant Block] ]
- [ [[example_const_block]] [``
+ [ [With Local Functions] [N1613 Const-Blocks] ]
+ [ [[const_block]] [``
int x = 1, y = 2;
const { // Constant block.
assert(x = y); // Compiler error.
@@ -60,10 +60,10 @@
Where the macros are defined in [@../../example/const_block.hpp =const_block.hpp=].
The constant block macros are implemented using a local function which binds by constant reference `const bind&` all the specified variables (so the variables are constant within the code block but they do not need to be `CopyConstructible` and no extra copy is performed).
-The local function executes the `assert` instruction its body which is called immediately after it is defined.
+The local function executes the `assert` instruction in its body which is called immediately after it is defined.
More in general, constant blocks can be used to evaluate any instruction (not just assertions) within a block were all specified variables are constant.
-Unfortunately, constant blocks cannot be implemented with __CPP11_lambda__ functions because these do not support constant binding (of course it is always possible to introduce extra constant variables `const int& const_x = x;` and use these variables in the assertion).
+Unfortunately, constant blocks cannot be implemented with __CPP11_lambda__ functions because these do not support constant binding (of course it is always possible to introduce extra constant variables `const int& const_x = x`, etc and use these variables in the assertion).
Variables bound by value using __CPP11_lambda__ functions (`variable`, `=variable`, and `=`) are constant but they are required to be `CopyConstructible` and they introduce potentially expensive copy operations.
[footnote
Ideally, __CPP11_lambda__ functions would allow to bind variables also using `const& variable` (constant reference) and `const&` (all variables by constant reference).
@@ -84,21 +84,23 @@
[table
[ [With Local Functions] [Boost.ScopeExit] ]
- [ [[example_scope_exit]] [``
+ [ [[scope_exit]] [
+[pre
person& p = persons_.back();
person::evolution_t checkpoint = p.evolution_;
BOOST_SCOPE_EXIT(checkpoint, &p, this_) { // Or extra variable `const_p`.
if (checkpoint == p.evolution_) this_->persons_.pop_back();
} BOOST_SCOPE_EXIT_END
- ``] ]
+]
+ ] ]
]
Where the macros are defined in [@../../example/scope_exit.hpp =scope_exit.hpp=].
The scope exit macros are implemented by passing a local function when constructing an object of the following class:
-[example_scope_exit_object]
+[scope_exit_class]
A local variable within the enclosing scope is used to hold the object so the destructor will be invoked at the exit of the enclosing scope and it will in turn call the local function executing the scope exit instructions.
The scope exit local function has no parameter and `void` result type but it supports binding and constant binding.
@@ -108,11 +110,11 @@
[section Boost.Phoenix Functions]
Local functions can be used to create __Boost_Phoenix__ functions.
-For example (see also [@../../example/boost_phoenix_local_factorial.cpp =boost_phoenix_local_factorial.cpp=] and [@../../example/boost_phoenix_factorial.cpp =boost_phoenix_factorial.cpp=]):
+For example (see also [@../../example/phoenix_factorial_local.cpp =phoenix_factorial_local.cpp=] and [@../../example/phoenix_factorial.cpp =phoenix_factorial.cpp=]):
[table
[ [Local Functions] [Global Functor] ]
- [ [[example_boost_phoenix_local_factorial]] [[example_boost_phoenix_factorial]] ]
+ [ [[phoenix_factorial_local]] [[phoenix_factorial]] ]
]
This is presented here mainly as a curiosity because __Boost_Phoenix__ functions created from local functions have the important limitation that they cannot be polymorphic.
@@ -126,7 +128,7 @@
[section Closures]
-A few more examples on how to return local functions to the calling scope (and the relative precautions to take) mainly adapted from examples of [@http://en.wikipedia.org/wiki/Closure_(computer_science) 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).
[table
[ [Files] ]
Modified: sandbox/local_function/libs/local_function/doc/getting_started.qbk
==============================================================================
--- sandbox/local_function/libs/local_function/doc/getting_started.qbk (original)
+++ sandbox/local_function/libs/local_function/doc/getting_started.qbk 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -27,7 +27,7 @@
[section Compilers and Platforms]
-The implementation of this library uses preprocessor and template metaprogramming (as supported by __Boost_Preprocessor__ and __Boost_MPL__), templates with partial specializations and function pointers (similarly to __Boost_Function__).
+The implementation of this library uses preprocessor and template meta-programming (as supported by __Boost_Preprocessor__ and __Boost_MPL__), templates with partial specializations and function pointers (similarly to __Boost_Function__).
As a consequence, this library is fairly demanding on compilers' compliance with the __CPP03__ standard.
At present, this library has been successfully compiled and tested on the following compilers and platforms:
Modified: sandbox/local_function/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION.html
==============================================================================
--- sandbox/local_function/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION.html (original)
+++ sandbox/local_function/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION.html 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_FUNCTION(declarations)</pre></div>
<div class="refsect1">
-<a name="id829980"></a><h2>Description</h2>
+<a name="id839711"></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>
@@ -71,25 +71,26 @@
<span class="keyword">return</span> <span class="identifier">function_result_type</span>
</pre> On compilers that do not support variadic macros, <code class="computeroutput">declaration_tuple</code> cannot be used: <pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"> <span class="identifier">declarations</span><span class="special">:</span>
<span class="keyword">void</span> <span class="special">|</span> <span class="identifier">declaration_sequence</span>
-</pre>(Lexical conventions: <code class="computeroutput">token1 | token2</code> means either <code class="computeroutput">token1</code> or <code class="computeroutput">token2</code>; <code class="computeroutput">[token]</code> means either <code class="computeroutput">token</code> or nothing; <code class="computeroutput">{expression}</code> means the token resulting from the expression.) </td>
+</pre>Lexical conventions: <code class="computeroutput">token1 | token2</code> means either <code class="computeroutput">token1</code> or <code class="computeroutput">token2</code>; <code class="computeroutput">[token]</code> means either <code class="computeroutput">token</code> or nothing; <code class="computeroutput">{expression}</code> means the token resulting from the expression. </td>
</tr></tbody>
</table></div>
<p>
</p>
<p>Note that on compilers that support variadic macros, commas can be used to separate the declarations resembling more closely the usual C++ function declaration syntax. This is the preferred syntax. However, for portability, on all C++ compilers (with and without variadic macros) the same library macros also accept parameter declarations specified as a Boost.Preprocessor sequence separated by round parenthesis <code class="computeroutput">()</code>.</p>
-<p>When binding the object <code class="computeroutput">this</code>, the special symbol <code class="computeroutput">this_</code> needs to be used instead of <code class="computeroutput">this</code> as the name of the variable to bind and also within the local function body to access the object. (Mistakenly using <code class="computeroutput">this</code> instead of <code class="computeroutput">this_</code> might not always result in a compiler error and will in general lead to undefined behaviour.)</p>
+<p>When binding the object <code class="computeroutput">this</code>, the special symbol <code class="computeroutput">this_</code> needs to be used instead of <code class="computeroutput">this</code> as the name of the variable to bind and also within the local function body to access the object. (Mistakenly using <code class="computeroutput">this</code> instead of <code class="computeroutput">this_</code> might not always result in a compiler error and will in general result in undefined behaviour.)</p>
<p>The result type must either be specified just before the macro or within the macro declarations prefixed by <code class="computeroutput">return</code> (but not in both places).</p>
+<p>Within the local function body it possible to access the result type using <code class="computeroutput">result_type</code>, the type of the first parameter using <code class="computeroutput">arg1_type</code>, the type of the second parameter using <code class="computeroutput">arg2_type</code>, etc. The bound variable types can be accessed using <code class="computeroutput"><a class="link" href="BOOST_LOCAL_FUNCTION_TYPEOF.html" title="Macro BOOST_LOCAL_FUNCTION_TYPEOF">BOOST_LOCAL_FUNCTION_TYPEOF</a></code>.</p>
<p>The maximum number of local function parameters (excluding bound variables) is specified by the configuration macro <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>. The maximum number of bound variables is specified by the configuration macro <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>Note:</strong></span> Local functions are functors so they can be assigned to other functors like <code class="computeroutput">boost::function</code> (see Boost.Function).</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_localfunction/Tutorial.html" title="Tutorial">Tutorial</a> section, <a class="link" href="boost_localfunction/Advanced_Topics.html" title="Advanced Topics"> Advanced Topics</a> section, <code class="computeroutput"><a class="link" href="BOOST_LOCAL_FUNCTION_TPL.html" title="Macro BOOST_LOCAL_FUNCTION_TPL">BOOST_LOCAL_FUNCTION_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_CONFIG_ARITY_MAX.html" title="Macro BOOST_LOCAL_FUNCTION_CONFIG_ARITY_MAX">BOOST_LOCAL_FUNCTION_CONFIG_ARITY_MAX</a></code>, <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>Note:</strong></span> This macro cannot be portably used multiple times on the same line (because on GCC and other compilers, 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_localfunction/Tutorial.html" title="Tutorial">Tutorial</a> section, <a class="link" href="boost_localfunction/Advanced_Topics.html" title="Advanced Topics"> Advanced Topics</a> section, <code class="computeroutput"><a class="link" href="BOOST_LOCAL_FUNCTION_TPL.html" title="Macro BOOST_LOCAL_FUNCTION_TPL">BOOST_LOCAL_FUNCTION_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_TYPEOF.html" title="Macro BOOST_LOCAL_FUNCTION_TYPEOF">BOOST_LOCAL_FUNCTION_TYPEOF</a></code>, <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>, <code class="computeroutput"><a class="link" href="BOOST_LOCAL_FUNC
TION_CONFIG_BIND_MAX.html" title="Macro BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX">BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX</a></code>. </p>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2009-2012 Lorenzo
Caminiti<p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
+ 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)
</p>
</div></td>
Modified: sandbox/local_function/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_CONFIG_ARITY_MAX.html
==============================================================================
--- sandbox/local_function/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_CONFIG_ARITY_MAX.html (original)
+++ sandbox/local_function/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_CONFIG_ARITY_MAX.html 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_FUNCTION_CONFIG_ARITY_MAX</pre></div>
<div class="refsect1">
-<a name="id832415"></a><h2>Description</h2>
+<a name="id842188"></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>
@@ -43,7 +43,7 @@
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2009-2012 Lorenzo
Caminiti<p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
+ 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)
</p>
</div></td>
Modified: sandbox/local_function/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX.html
==============================================================================
--- sandbox/local_function/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX.html (original)
+++ sandbox/local_function/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX.html 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX</pre></div>
<div class="refsect1">
-<a name="id832489"></a><h2>Description</h2>
+<a name="id842263"></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>
@@ -43,7 +43,7 @@
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2009-2012 Lorenzo
Caminiti<p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
+ 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)
</p>
</div></td>
Modified: sandbox/local_function/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_NAME.html
==============================================================================
--- sandbox/local_function/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_NAME.html (original)
+++ sandbox/local_function/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_NAME.html 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_FUNCTION_NAME(qualified_function_name)</pre></div>
<div class="refsect1">
-<a name="id831905"></a><h2>Description</h2>
+<a name="id841666"></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>
@@ -53,22 +53,22 @@
<td><span class="bold"><strong><code class="computeroutput">qualified_function_name</code></strong></span></td>
<td>The name of the local function optionally qualified as follow: <pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="identifier">qualified_function_name</span><span class="special">:</span>
<span class="special">[</span><span class="keyword">inline</span><span class="special">]</span> <span class="special">[</span><span class="identifier">recursive</span><span class="special">]</span> <span class="identifier">name</span>
-</pre> (Lexical conventions: <code class="computeroutput">token1 | token2</code> means either <code class="computeroutput">token1</code> or <code class="computeroutput">token2</code>; <code class="computeroutput">[token]</code> means either <code class="computeroutput">token</code> or nothing; <code class="computeroutput">{expression}</code> means the token resulting from the expression.) </td>
+</pre> Lexical conventions: <code class="computeroutput">token1 | token2</code> means either <code class="computeroutput">token1</code> or <code class="computeroutput">token2</code>; <code class="computeroutput">[token]</code> means either <code class="computeroutput">token</code> or nothing; <code class="computeroutput">{expression}</code> means the token resulting from the expression. </td>
</tr></tbody>
</table></div>
<p>
</p>
-<p>The local function name can be qualified by prefixing it with the "keyword" <code class="computeroutput">inline</code> (see the <a class="link" href="boost_localfunction/Advanced_Topics.html" title="Advanced Topics"> Advanced Topics</a> section): <code class="computeroutput">BOOST_LOCAL_FUNCTION_NAME(inline name)</code>. This increases the chances that the compiler will be able to inline the local function calls (thus reducing run-time). However, inlined local functions cannot be passed as template parameters (e.g., to <code class="computeroutput">std::for_each</code>) or assigned to other functors (e.g., to <code class="computeroutput">boost::function</code>). That is true on C++03 compilers but inlined local functions can instead be passed as template parameters on C++11 compilers. On C++11 compilers, there is no need to declare a local function lined because this library will automatically use C++11 specific features to inline the local function while always allowing to pass it as a template paramete
r.</p>
-<p>The local function name can also be qualified by prefixing it with the "keyword" <code class="computeroutput">recursive</code> (see the <a class="link" href="boost_localfunction/Advanced_Topics.html" title="Advanced Topics"> Advanced Topics</a> section): <code class="computeroutput">BOOST_LOCAL_FUNCTION_NAME(recursive name)</code>. This allows the local function to recursively call itself from its body (as usual in C++). However, compilers have not been observed to be able to inline recursive local function calls (not even when the recursive local function is also declared inline: <code class="computeroutput">BOOST_LOCAL_FUNCTION(inline recursive name)</code>).</p>
-<p><span class="bold"><strong>Note:</strong></span> The local function name cannot be the name of an operator <code class="computeroutput">operator...</code> and it cannot be the same name of another local function declared within the same enclosing scope (the <code class="computeroutput">boost::overloaded_function</code> functor can be used to overload local functions, see Boost.Functional/OverloadedFunction and the <a class="link" href="boost_localfunction/Advanced_Topics.html" title="Advanced Topics"> Advanced Topics</a> section).</p>
-<p><span class="bold"><strong>See:</strong></span> <code class="computeroutput"><a class="link" href="BOOST_LOCAL_FUNCTION.html" title="Macro BOOST_LOCAL_FUNCTION">BOOST_LOCAL_FUNCTION</a></code>, <a class="link" href="boost_localfunction/Tutorial.html" title="Tutorial">Tutorial</a> section, <a class="link" href="boost_localfunction/Advanced_Topics.html" title="Advanced Topics"> Advanced Topics</a> section. </p>
+<p>The local function name can be qualified by prefixing it with the keyword <code class="computeroutput">inline</code> (see the <a class="link" href="boost_localfunction/Advanced_Topics.html" title="Advanced Topics"> Advanced Topics</a> section): <code class="computeroutput">BOOST_LOCAL_FUNCTION_NAME(inline name)</code>. This increases the chances that the compiler will be able to inline the local function calls (thus reducing run-time). However, inlined local functions cannot be passed as template parameters (e.g., to <code class="computeroutput">std::for_each</code>) or assigned to other functors (e.g., to <code class="computeroutput">boost::function</code>). That is true on C++03 compilers but inlined local functions can instead be passed as template parameters on C++11 compilers. On C++11 compilers, there is no need to declare a local function lined because this library will automatically use C++11 specific features to inline the local function while always allowing to pass it as a template parameter.
</p>
+<p>The local function name can also be qualified by prefixing it with the "keyword" <code class="computeroutput">recursive</code> (see the <a class="link" href="boost_localfunction/Advanced_Topics.html" title="Advanced Topics"> Advanced Topics</a> section): <code class="computeroutput">BOOST_LOCAL_FUNCTION_NAME(recursive name)</code>. This allows the local function to recursively call itself from its body (as usual in C++). However, compilers have not been observed to be able to inline recursive local function calls (not even when the recursive local function is also declared inline: <code class="computeroutput">BOOST_LOCAL_FUNCTION(inline recursive name)</code>). Furthermore, recursive local functions should only be called within their declaration scope (otherwise the result is undefined behaviour).</p>
+<p><span class="bold"><strong>Note:</strong></span> The local function name cannot be the name of an operator <code class="computeroutput">operator...</code> and it cannot be the same name of another local function declared within the same enclosing scope (but <code class="computeroutput">boost::overloaded_function</code> can be used to overload local functions, see Boost.Functional/OverloadedFunction and the <a class="link" href="boost_localfunction/Advanced_Topics.html" title="Advanced Topics"> Advanced Topics</a> section).</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/Advanced_Topics.html" title="Advanced Topics"> Advanced Topics</a> section, <code class="computeroutput"><a class="link" href="BOOST_LOCAL_FUNCTION.html" title="Macro BOOST_LOCAL_FUNCTION">BOOST_LOCAL_FUNCTION</a></code>. </p>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2009-2012 Lorenzo
Caminiti<p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
+ 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)
</p>
</div></td>
Modified: sandbox/local_function/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_TPL.html
==============================================================================
--- sandbox/local_function/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_TPL.html (original)
+++ sandbox/local_function/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_TPL.html 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_FUNCTION_TPL(declarations)</pre></div>
<div class="refsect1">
-<a name="id831727"></a><h2>Description</h2>
+<a name="id841489"></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>
@@ -51,7 +51,7 @@
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2009-2012 Lorenzo
Caminiti<p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
+ 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)
</p>
</div></td>
Modified: sandbox/local_function/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_TYPEOF.html
==============================================================================
--- sandbox/local_function/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_TYPEOF.html (original)
+++ sandbox/local_function/libs/local_function/doc/html/BOOST_LOCAL_FUNCTION_TYPEOF.html 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -33,8 +33,8 @@
</span>BOOST_LOCAL_FUNCTION_TYPEOF(bound_variable_name)</pre></div>
<div class="refsect1">
-<a name="id832214"></a><h2>Description</h2>
-<p>The type returned by the macro is fully qualified in that it contains the extra constant and reference qualifiers when the specified variable was bound by constant and by reference.</p>
+<a name="id841976"></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">
<colgroup>
@@ -48,7 +48,7 @@
</table></div>
<p>
</p>
-<p>For example, if a variable named <code class="computeroutput">t</code> of type <code class="computeroutput">T</code> is: </p>
+<p>The type returned by the macro is fully qualified in that it contains the extra constant and reference qualifiers when the specified variable is bound by constant and by reference. For example, if a variable named <code class="computeroutput">t</code> of type <code class="computeroutput">T</code> is: </p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>Bound by value using <code class="computeroutput">bind t</code> then <code class="computeroutput">BOOST_LOCAL_FUNCTION_TYPEOF(t)</code> is <code class="computeroutput">T</code>. </p></li>
<li class="listitem"><p>Bound by constant value using <code class="computeroutput">const bind t</code> then <code class="computeroutput">BOOST_LOCAL_FUNCTION_TYPEOF(t)</code> is <code class="computeroutput">const T</code>. </p></li>
@@ -56,15 +56,16 @@
<li class="listitem"><p>Bound by constant reference using <code class="computeroutput">const bind& t</code> then <code class="computeroutput">BOOST_LOCAL_FUNCTION_TYPEOF(t)</code> is <code class="computeroutput">const T&</code>.</p></li>
</ul></div>
<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 <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>See:</strong></span> <code class="computeroutput"><a class="link" href="BOOST_LOCAL_FUNCTION.html" title="Macro BOOST_LOCAL_FUNCTION">BOOST_LOCAL_FUNCTION</a></code>, <a class="link" href="boost_localfunction/Advanced_Topics.html" title="Advanced Topics"> Advanced Topics</a> section. </p>
+This macro must be prefixed by <code class="computeroutput">typename</code> when used in a type dependant context.</p>
+<p>It is best to use this macro instead of Boost.Typeof so to reduce the number of times Boost.Typeof is used to deduce types (see the <a class="link" href="boost_localfunction/Advanced_Topics.html" title="Advanced Topics"> Advanced Topics</a> section).</p>
+<p><span class="bold"><strong>See:</strong></span> <a class="link" href="boost_localfunction/Advanced_Topics.html" title="Advanced Topics"> Advanced Topics</a> section, <code class="computeroutput"><a class="link" href="BOOST_LOCAL_FUNCTION.html" title="Macro BOOST_LOCAL_FUNCTION">BOOST_LOCAL_FUNCTION</a></code>. </p>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2009-2012 Lorenzo
Caminiti<p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
+ 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)
</p>
</div></td>
Modified: sandbox/local_function/libs/local_function/doc/html/boost_localfunction/Acknowledgments.html
==============================================================================
--- sandbox/local_function/libs/local_function/doc/html/boost_localfunction/Acknowledgments.html (original)
+++ sandbox/local_function/libs/local_function/doc/html/boost_localfunction/Acknowledgments.html 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -26,19 +26,16 @@
<a name="boost_localfunction.Acknowledgments"></a><a class="link" href="Acknowledgments.html" title="Acknowledgments">Acknowledgments</a>
</h2></div></div></div>
<p>
- @todo add thanks from the review
- </p>
-<p>
This section aims to recognize the contributions of <span class="emphasis"><em>all</em></span>
the different people that participated directly or indirectly to the design
and development of this library.
</p>
<p>
Many thanks to Steven Watanabe and Vicente Botet for suggesting to me to use
- Boost.ScopeExit
+ Boost.ScopeExit
binding to <a href="http://boost.2283326.n4.nabble.com/contract-diff-n1962-tt2671482.html#none" target="_top">emulate
local functions</a>. Many thanks to Alexander Nasonov for clarifying how
- Boost.ScopeExit
+ Boost.ScopeExit
binding could be used to implement local functions and for some <a href="http://thread.gmane.org/gmane.comp.lib.boost.devel/168612" target="_top">early
work</a> in this direction.
</p>
@@ -53,7 +50,7 @@
</p>
<p>
Thanks to Pierre Morcello for sharing some code that experimented with implementing
- local functions using Boost.ScopeExit
+ local functions using Boost.ScopeExit
binding (even if this library is not based on such a code).
</p>
<p>
@@ -74,6 +71,15 @@
section and with the profiling of the different alternatives.
</p>
<p>
+ Many thanks to the library's <a href="http://lists.boost.org/boost-announce/2011/12/0340.php" target="_top">Boost
+ review</a> manager: Jeffrey Lee Hellrung. Thanks also to all the people
+ that submitted a (positive and negative) review: Andrzej Krzemienski, Edward
+ Diener, Gregory Crosswhite, John Bytheway, Hartmut Kaiser, Krzysztof Czainski,
+ Nat Lindon, Pierre Morcello, Thomas Heller, and Vicente J. Botet. Thanks to
+ everyone else that commented (positively and negatively) on the library during
+ its Boost review.
+ </p>
+<p>
Finally, many thanks to the entire Boost
community and mailing list for
providing valuable comments about this library and great insights on the C++
@@ -84,7 +90,7 @@
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2009-2012 Lorenzo
Caminiti<p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
+ 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)
</p>
</div></td>
Modified: sandbox/local_function/libs/local_function/doc/html/boost_localfunction/Advanced_Topics.html
==============================================================================
--- sandbox/local_function/libs/local_function/doc/html/boost_localfunction/Advanced_Topics.html (original)
+++ sandbox/local_function/libs/local_function/doc/html/boost_localfunction/Advanced_Topics.html 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -34,8 +34,8 @@
<dt><span class="section"><a href="Advanced_Topics.html#boost_localfunction.Advanced_Topics.assigning_and_returning">Assigning
and Returning</a></span></dt>
<dt><span class="section">Nesting</span></dt>
-<dt><span class="section"><a href="Advanced_Topics.html#boost_localfunction.Advanced_Topics.deducing_bound_types__concepts__etc_">Deducing
- Bound Types (concepts, etc)</a></span></dt>
+<dt><span class="section"><a href="Advanced_Topics.html#boost_localfunction.Advanced_Topics.accessing_types__concepts__etc_">Accessing
+ Types (concepts, etc)</a></span></dt>
<dt><span class="section"><a href="Advanced_Topics.html#boost_localfunction.Advanced_Topics.specifying_types">Specifying
Types</a></span></dt>
<dt><span class="section">Inlining</span></dt>
@@ -86,7 +86,7 @@
<p>
Programmers can define a <code class="computeroutput"><span class="identifier">WITH_DEFAULT</span></code>
macro similar to the following if they think it improves readability over
- the above syntax (see also add_with_default.cpp
):
+ the syntax above (see also add_with_default.cpp
):
<sup>[<a name="boost_localfunction.Advanced_Topics.default_parameters.f1" href="#ftn.boost_localfunction.Advanced_Topics.default_parameters.f1" class="footnote">18</a>]</sup>
</p>
<p>
@@ -113,9 +113,11 @@
</h3></div></div></div>
<p>
The C++ preprocessor does not allow commas <code class="computeroutput"><span class="special">,</span></code>
- within macro parameters unless they are wrapped by round parenthesis <code class="computeroutput"><span class="special">()</span></code>. Therefore, using commas within the local
- function parameters and bindings will generate (cryptic) preprocessor errors
- unless they are wrapped with an extra set of round parenthesis <code class="computeroutput"><span class="special">()</span></code> as explained here.
+ within macro parameters unless they are wrapped by round parenthesis <code class="computeroutput"><span class="special">()</span></code> (see the Boost.Utility/IdentityType
+ documentation for details). Therefore, using commas within the local function
+ parameters and bindings will generate (cryptic) preprocessor errors unless
+ they are wrapped with an extra set of round parenthesis <code class="computeroutput"><span class="special">()</span></code>
+ as explained here.
</p>
<div class="note"><table border="0" summary="Note">
<tr>
@@ -156,10 +158,10 @@
<span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">,</span> <span class="identifier">size_t</span><span class="special">>&</span></code> contains a comma <code class="computeroutput"><span class="special">,</span></code>
after the first template parameter <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span></code>.
This comma is not wrapped by any round parenthesis <code class="computeroutput"><span class="special">()</span></code>
- thus it will cause a preprocessor error. <sup>[<a name="boost_localfunction.Advanced_Topics.commas_and_symbols_in_macros.f1" href="#ftn.boost_localfunction.Advanced_Topics.commas_and_symbols_in_macros.f1" class="footnote">20</a>]</sup> The Boost.Utility
- macro <code class="computeroutput"><span class="identifier">BOOST_IDENTITY_TYPE</span><span class="special">(</span></code><span class="emphasis"><em>parenthesized-type</em></span><code class="computeroutput"><span class="special">)</span></code> from the header <code class="literal">boost/utility/identity_type.hpp</code>
+ thus it will cause a preprocessor error. <sup>[<a name="boost_localfunction.Advanced_Topics.commas_and_symbols_in_macros.f1" href="#ftn.boost_localfunction.Advanced_Topics.commas_and_symbols_in_macros.f1" class="footnote">20</a>]</sup> The Boost.Utility/IdentityType
+ macro <code class="computeroutput"><span class="identifier">BOOST_IDENTITY_TYPE</span><span class="special">(</span></code><code class="literal"><span class="emphasis"><em>parenthesized-type</em></span></code><code class="computeroutput"><span class="special">)</span></code> from the header <code class="literal">boost/utility/identity_type.hpp</code>
can be used to wrap a type within extra parenthesis <code class="computeroutput"><span class="special">()</span></code>
- so to overcome this issue:
+ so to overcome the problem:
</p>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">utility</span><span class="special">/</span><span class="identifier">identity_type</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
@@ -176,14 +178,8 @@
<code class="computeroutput"><span class="identifier">BOOST_IDENTITY_TYPE</span><span class="special">(...)</span></code>
macro plus the parenthesis to wrap the type expression (and therefore any
comma <code class="computeroutput"><span class="special">,</span></code> that it contains) passed
- as parameter to the <code class="computeroutput"><span class="identifier">BOOST_IDENTITY_TYPE</span><span class="special">((...))</span></code> macro. <sup>[<a name="boost_localfunction.Advanced_Topics.commas_and_symbols_in_macros.f2" href="#ftn.boost_localfunction.Advanced_Topics.commas_and_symbols_in_macros.f2" class="footnote">21</a>]</sup> Finally, the <code class="computeroutput"><span class="identifier">BOOST_IDENTITY_TYPE</span></code>
- macro must be prefixed by the <code class="computeroutput"><span class="keyword">typename</span></code>
- keyword:
- </p>
-<pre class="programlisting"><span class="keyword">typename</span> <span class="identifier">BOOST_IDENTITY_TYPE</span><span class="special">(</span><span class="emphasis"><em>parenthesized-type</em></span><span class="special">)</span>
-</pre>
-<p>
- When used together with the <code class="computeroutput"><a class="link" href="../BOOST_LOCAL_FUNCTION_TPL.html" title="Macro BOOST_LOCAL_FUNCTION_TPL">BOOST_LOCAL_FUNCTION_TPL</a></code>
+ as parameter to the <code class="computeroutput"><span class="identifier">BOOST_IDENTITY_TYPE</span><span class="special">((...))</span></code> macro. Finally, the <code class="computeroutput"><span class="identifier">BOOST_IDENTITY_TYPE</span></code> macro must be prefixed
+ by the <code class="computeroutput"><span class="keyword">typename</span></code> keyword <code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">BOOST_IDENTITY_TYPE</span><span class="special">(</span></code><code class="literal"><span class="emphasis"><em>parenthesized-type</em></span></code><code class="computeroutput"><span class="special">)</span></code> when used together with the <code class="computeroutput"><a class="link" href="../BOOST_LOCAL_FUNCTION_TPL.html" title="Macro BOOST_LOCAL_FUNCTION_TPL">BOOST_LOCAL_FUNCTION_TPL</a></code>
macro within templates.
</p>
<div class="note"><table border="0" summary="Note">
@@ -199,7 +195,7 @@
</table></div>
<p>
For example, in this case a <code class="computeroutput"><span class="keyword">typedef</span></code>
- could have been used in the enclosing scope to obtain the following valid
+ from the enclosing scope could have been used to obtain the following valid
and perhaps more readable code:
</p>
<pre class="programlisting"><span class="keyword">typedef</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">,</span> <span class="identifier">size_t</span><span class="special">></span> <span class="identifier">map_type</span><span class="special">;</span>
@@ -296,7 +292,7 @@
</h3></div></div></div>
<p>
Local functions are function objects so it is possible to assign them to
- other functors like Boost.Function
+ other functors like Boost.Function
<code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span></code> in order to store the local function
into a variable, pass it as a parameter to another function, or return it
from the enclosing function.
@@ -410,8 +406,8 @@
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
-<a name="boost_localfunction.Advanced_Topics.deducing_bound_types__concepts__etc_"></a><a class="link" href="Advanced_Topics.html#boost_localfunction.Advanced_Topics.deducing_bound_types__concepts__etc_" title="Deducing Bound Types (concepts, etc)">Deducing
- Bound Types (concepts, etc)</a>
+<a name="boost_localfunction.Advanced_Topics.accessing_types__concepts__etc_"></a><a class="link" href="Advanced_Topics.html#boost_localfunction.Advanced_Topics.accessing_types__concepts__etc_" title="Accessing Types (concepts, etc)">Accessing
+ Types (concepts, etc)</a>
</h3></div></div></div>
<p>
This library never requires to explicitly specify the type of bound variables.
@@ -427,12 +423,12 @@
type expression is fully qualified in the sense that it will be constant
if the variable is bound by constant <code class="computeroutput"><span class="keyword">const</span>
<span class="identifier">bind</span><span class="special">[&]</span></code>
- and it will also be a reference is the variable is bound by reference <code class="computeroutput"><span class="special">[</span><span class="keyword">const</span><span class="special">]</span>
+ and it will also be a reference if the variable is bound by reference <code class="computeroutput"><span class="special">[</span><span class="keyword">const</span><span class="special">]</span>
<span class="identifier">bind</span><span class="special">&</span></code>
- (if needed, programmers can strip away the <code class="computeroutput"><span class="keyword">const</span></code>
+ (if needed, programmers can remove the <code class="computeroutput"><span class="keyword">const</span></code>
and <code class="computeroutput"><span class="special">&</span></code> qualifiers using
<code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">remove_const</span></code> and <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">remove_reference</span></code>,
- see Boost.TypeTraits).
+ see Boost.TypeTraits).
</p>
<p>
The deduced bound type can be used within the body to check concepts, declare
@@ -459,7 +455,7 @@
</p>
<p>
Within templates, <code class="computeroutput"><a class="link" href="../BOOST_LOCAL_FUNCTION_TYPEOF.html" title="Macro BOOST_LOCAL_FUNCTION_TYPEOF">BOOST_LOCAL_FUNCTION_TYPEOF</a></code>
- does not require to be prefixed by the <code class="computeroutput"><span class="keyword">typename</span></code>
+ should not be prefixed by the <code class="computeroutput"><span class="keyword">typename</span></code>
keyword but eventual type manipulations need the <code class="computeroutput"><span class="keyword">typename</span></code>
prefix as usual (see also typeof_template.cpp
and addable.hpp
):
@@ -483,6 +479,31 @@
</pre>
<p>
</p>
+<p>
+ It is best to use the <code class="computeroutput"><a class="link" href="../BOOST_LOCAL_FUNCTION_TYPEOF.html" title="Macro BOOST_LOCAL_FUNCTION_TYPEOF">BOOST_LOCAL_FUNCTION_TYPEOF</a></code>
+ macro instead of using Boost.Typeof
+ so to reduce the number of times that Boost.Typeof
+ is invoked:
+ </p>
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem">
+ Either the library already internally used Boost.Typeof
+ once, in which case using this macro will not use Boost.Typeof
+ again.
+ </li>
+<li class="listitem">
+ Or, the bound variable type is explicitly specified by programmers (see
+ below), in which case using this macro will not use Boost.Typeof
+ at all.
+ </li>
+</ol></div>
+<p>
+ Furthermore, within the local function body it possible to access the result
+ type using <code class="computeroutput"><span class="identifier">result_type</span></code>, the
+ type of the first parameter using <code class="computeroutput"><span class="identifier">arg1_type</span></code>,
+ the type of the second parameter using <code class="computeroutput"><span class="identifier">arg2_type</span></code>,
+ etc. <sup>[<a name="boost_localfunction.Advanced_Topics.accessing_types__concepts__etc_.f0" href="#ftn.boost_localfunction.Advanced_Topics.accessing_types__concepts__etc_.f0" class="footnote">21</a>]</sup>
+ </p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
@@ -491,7 +512,7 @@
</h3></div></div></div>
<p>
While not required, it is possible to explicitly specify the type of a bound
- variable so the library will not internally use Boost.Typeof
+ variable so the library will not internally use Boost.Typeof
to automatically deduce such a type. When specified, the bound variable type
must follow the <code class="computeroutput"><span class="identifier">bind</span></code> "keyword"
and it must be wrapped within round parenthesis <code class="computeroutput"><span class="special">()</span></code>:
@@ -506,16 +527,17 @@
<p>
Note that within the local function body it is always possible to abstract
the access to the type of a bound variable using <code class="computeroutput"><a class="link" href="../BOOST_LOCAL_FUNCTION_TYPEOF.html" title="Macro BOOST_LOCAL_FUNCTION_TYPEOF">BOOST_LOCAL_FUNCTION_TYPEOF</a></code>
- (even when the bound variable type is explicitly specified).
+ (even when the bound variable type is explicitly specified in the local function
+ declaration).
</p>
<p>
- The library also uses Boost.Typeof
- to determine the local function result type (because this type specified
+ The library also uses Boost.Typeof
+ to determine the local function result type (because this type is specified
outside the <code class="computeroutput"><a class="link" href="../BOOST_LOCAL_FUNCTION.html" title="Macro BOOST_LOCAL_FUNCTION">BOOST_LOCAL_FUNCTION</a></code>
macro). Thus it is also possible to specify the local function result type
as one of the <code class="computeroutput"><a class="link" href="../BOOST_LOCAL_FUNCTION.html" title="Macro BOOST_LOCAL_FUNCTION">BOOST_LOCAL_FUNCTION</a></code>
- macro parameters prefixed by <code class="computeroutput"><span class="keyword">return</span></code>
- so the library will not use Boost.Typeof
+ macro parameters prefixing it by <code class="computeroutput"><span class="keyword">return</span></code>
+ so the library will not use Boost.Typeof
to deduce the result type:
</p>
<pre class="programlisting"><span class="identifier">BOOST_LOCAL_FUNCTION_TYPE</span><span class="special">(</span><span class="keyword">return</span> <code class="literal"><span class="emphasis"><em>result-type</em></span></code><span class="special">,</span> <span class="special">...)</span>
@@ -530,8 +552,8 @@
is specified as one of the macro parameters).
</p>
<p>
- The following example specifies the type of all bound variables and of the
- local function result (see also add_typed.cpp
):
+ The following example specifies all bound variables and result types (see
+ also add_typed.cpp
):
<sup>[<a name="boost_localfunction.Advanced_Topics.specifying_types.f0" href="#ftn.boost_localfunction.Advanced_Topics.specifying_types.f0" class="footnote">22</a>]</sup>
</p>
<p>
@@ -567,10 +589,10 @@
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>
- Unfortunately, the current implementation implementation still internally
- uses Boost.Typeof
- once to deduce the local function object type (see the <a class="link" href="Implementation.html" title="Annex: Implementation">Implementation</a>
- section) even when all bound variable and result types are explicitly specified.
+ Unfortunately, even when all bound variables and result types are explicitly
+ specified, the currently library implementation still has to use Boost.Typeof
+ once (to deduce the local function object type, see the <a class="link" href="Implementation.html" title="Annex: Implementation">Implementation</a>
+ section).
</p></td></tr>
</table></div>
</div>
@@ -582,8 +604,7 @@
Local functions can be declared inline to increase the chances that the compiler
will be able to reduce the run-time of the local function call by inlining
the generated assembly code. A local function is declared inline by prefixing
- the local function name passed to the <code class="computeroutput"><a class="link" href="../BOOST_LOCAL_FUNCTION_NAME.html" title="Macro BOOST_LOCAL_FUNCTION_NAME">BOOST_LOCAL_FUNCTION_NAME</a></code>
- macro with the "keyword" <code class="computeroutput"><span class="keyword">inline</span></code>:
+ its name with the keyword <code class="computeroutput"><span class="keyword">inline</span></code>:
</p>
<pre class="programlisting"><span class="emphasis"><em>result-type</em></span> <span class="identifier">BOOST_LOCAL_FUNCTION</span><span class="special">(</span><span class="emphasis"><em>parameters</em></span><span class="special">)</span> <span class="special">{</span>
<span class="special">...</span> <span class="comment">// Body.</span>
@@ -656,11 +677,10 @@
<p>
Local functions can be declared recursive
so a local function can recursively call itself from its body (as usual with
- C++ functions). A local function is declared recursive by prefixing the local
- function name passed to <code class="computeroutput"><a class="link" href="../BOOST_LOCAL_FUNCTION_NAME.html" title="Macro BOOST_LOCAL_FUNCTION_NAME">BOOST_LOCAL_FUNCTION_NAME</a></code>
- macro with the "keyword" <code class="computeroutput"><span class="identifier">recursive</span></code>
- (thus <code class="computeroutput"><span class="identifier">recursive</span></code> is not a
- valid local function name):
+ C++ functions). A local function is declared recursive by prefixing its name
+ with the "keyword" <code class="computeroutput"><span class="identifier">recursive</span></code>
+ (thus <code class="computeroutput"><span class="identifier">recursive</span></code> cannot be
+ used as a local function name):
</p>
<pre class="programlisting"><span class="emphasis"><em>result-type</em></span> <span class="identifier">BOOST_LOCAL_FUNCTION</span><span class="special">(</span><span class="emphasis"><em>parameters</em></span><span class="special">)</span> <span class="special">{</span>
<span class="special">...</span> <span class="comment">// Body.</span>
@@ -683,7 +703,7 @@
<span class="keyword">if</span><span class="special">(</span><span class="identifier">num</span> <span class="special"><=</span> <span class="number">0</span><span class="special">)</span> <span class="identifier">result</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span>
<span class="keyword">else</span> <span class="identifier">result</span> <span class="special">=</span> <span class="identifier">num</span> <span class="special">*</span> <span class="identifier">factorial</span><span class="special">(</span><span class="identifier">num</span> <span class="special">-</span> <span class="number">1</span><span class="special">,</span> <span class="keyword">true</span><span class="special">);</span> <span class="comment">// Recursive call.</span>
- <span class="keyword">if</span> <span class="special">(!</span><span class="identifier">recursion</span><span class="special">)</span> <span class="identifier">this_</span><span class="special">-></span><span class="identifier">results</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">result</span><span class="special">);</span>
+ <span class="keyword">if</span><span class="special">(!</span><span class="identifier">recursion</span><span class="special">)</span> <span class="identifier">this_</span><span class="special">-></span><span class="identifier">results</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">result</span><span class="special">);</span>
<span class="keyword">return</span> <span class="identifier">result</span><span class="special">;</span>
<span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">recursive</span> <span class="identifier">factorial</span><span class="special">)</span> <span class="comment">// Recursive.</span>
@@ -722,9 +742,9 @@
</h3></div></div></div>
<p>
It is possible to overload local functions using the <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">overloaded_function</span></code>
- functor of Boost.Functional/OverloadedFunction
+ functor of Boost.Functional/OverloadedFunction
from the header <code class="literal">boost/functional/overloaded_function.hpp</code>
- (see the Boost.Functional/OverloadedFunction
+ (see the Boost.Functional/OverloadedFunction
documentation for details).
</p>
<p>
@@ -831,7 +851,7 @@
</p>
<p>
</p>
-<pre class="programlisting"><span class="keyword">int</span> <span class="identifier">BOOST_LOCAL_FUNCTION</span><span class="special">(</span><span class="keyword">auto</span> <span class="keyword">int</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">register</span> <span class="keyword">int</span> <span class="identifier">y</span><span class="special">)</span> <span class="special">{</span> <span class="comment">// Classifers.</span>
+<pre class="programlisting"><span class="keyword">int</span> <span class="identifier">BOOST_LOCAL_FUNCTION</span><span class="special">(</span><span class="keyword">auto</span> <span class="keyword">int</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">register</span> <span class="keyword">int</span> <span class="identifier">y</span><span class="special">)</span> <span class="special">{</span> <span class="comment">// Classifiers.</span>
<span class="keyword">return</span> <span class="identifier">x</span> <span class="special">+</span> <span class="identifier">y</span><span class="special">;</span>
<span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">add</span><span class="special">)</span>
</pre>
@@ -866,7 +886,7 @@
</th>
<th>
<p>
- Reason
+ Comment
</p>
</th>
</tr></thead>
@@ -885,14 +905,15 @@
<td>
<p>
This is not supported because local functions cannot be templates
- (plus most C++ compilers do not implement <code class="computeroutput"><span class="keyword">export</span></code>).
+ (plus most C++ compilers do not implement <code class="computeroutput"><span class="keyword">export</span></code>
+ at all).
</p>
</td>
</tr>
<tr>
<td>
<p>
- <code class="computeroutput"><span class="keyword">template</span><span class="special"><</span></code><span class="emphasis"><em>template-parameter-list</em></span><code class="computeroutput"><span class="special">></span></code>
+ <code class="computeroutput"><span class="keyword">template</span><span class="special"><</span></code><code class="literal"><span class="emphasis"><em>template-parameter-list</em></span></code><code class="computeroutput"><span class="special">></span></code>
</p>
</td>
<td>
@@ -942,8 +963,9 @@
to improve the chances that C++03
standard compilers can optimize the local function call run-time
(but <code class="computeroutput"><span class="keyword">inline</span></code> local
- functions cannot be passes as template parameters on C++03
- standard compilers).
+ functions cannot be passed as template parameters on C++03
+ standard compilers, see the <a class="link" href="Advanced_Topics.html" title="Advanced Topics">Advanced
+ Topics</a> section).
</p>
</td>
</tr>
@@ -1150,7 +1172,7 @@
<p>
</p>
<pre class="programlisting"><span class="keyword">int</span> <span class="identifier">error</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">y</span><span class="special">)</span> <span class="special">{</span>
- <span class="keyword">bool</span> <span class="identifier">BOOST_LOCAL_FUNCTION</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">x</span><span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">int</span> <span class="identifier">BOOST_LOCAL_FUNCTION</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">x</span><span class="special">)</span> <span class="special">{</span>
<span class="keyword">if</span><span class="special">(</span><span class="identifier">x</span> <span class="special"><=</span> <span class="number">0</span><span class="special">)</span> <span class="keyword">goto</span> <span class="identifier">failure</span><span class="special">;</span> <span class="comment">// Error: Cannot jump to enclosing scope.</span>
<span class="keyword">else</span> <span class="keyword">goto</span> <span class="identifier">success</span><span class="special">;</span> <span class="comment">// OK: Can jump within local function.</span>
@@ -1171,31 +1193,31 @@
<div class="footnote"><p><sup>[<a id="ftn.boost_localfunction.Advanced_Topics.default_parameters.f0" href="#boost_localfunction.Advanced_Topics.default_parameters.f0" class="para">17</a>] </sup>
<span class="bold"><strong>Rationale.</strong></span> The assignment symbol <code class="computeroutput"><span class="special">=</span></code> cannot be used to specify default parameter
values because default values are not part of the parameter type so they
- cannot be handled using template metaprogamming. Default parameter values
+ cannot be handled using template meta-programming. Default parameter values
need to be separated from the rest of the parameter declaration using the
- preprocessor. Specifically, this library needs to use preprocessor mataprogramming
+ preprocessor. Specifically, this library needs to use preprocessor meta-programming
to remove default values when constructing the local function type and
then to count the number of default values to provide the correct set of
call operators for the local functor. Therefore, the symbol <code class="computeroutput"><span class="special">=</span></code> cannot be used because it cannot be handled
- by preprocessor metaprogramming (non-alphanumeric symbols cannot be detected
- by preprocessor metaprogramming because it cannot be concatenated by the
- preprocessor).
+ by preprocessor meta-programming (non-alphanumeric symbols cannot be detected
+ by preprocessor meta-programming because they cannot be concatenated by
+ the preprocessor).
</p></div>
<div class="footnote"><p><sup>[<a id="ftn.boost_localfunction.Advanced_Topics.default_parameters.f1" href="#boost_localfunction.Advanced_Topics.default_parameters.f1" class="para">18</a>] </sup>
The authors do not personally find the use of the <code class="computeroutput"><span class="identifier">WITH_DEFAULT</span></code>
macro more readable and they prefer to use the <code class="computeroutput"><span class="keyword">default</span></code>
- "keyword" directly. Furthermore, <code class="computeroutput"><span class="identifier">WITH_DEFAULT</span></code>
- need to be defined differently for compilers without variadic macros <code class="computeroutput"><span class="preprocessor">#define</span> <span class="identifier">WITH_DEFAULT</span>
+ keyword directly. Furthermore, <code class="computeroutput"><span class="identifier">WITH_DEFAULT</span></code>
+ needs to be defined differently for compilers without variadic macros
+ <code class="computeroutput"><span class="preprocessor">#define</span> <span class="identifier">WITH_DEFAULT</span>
<span class="special">(</span><span class="keyword">default</span><span class="special">)</span></code> so it can only be defined by programmers
based on the syntax they decide to use.
</p></div>
<div class="footnote"><p><sup>[<a id="ftn.boost_localfunction.Advanced_Topics.commas_and_symbols_in_macros.f0" href="#boost_localfunction.Advanced_Topics.commas_and_symbols_in_macros.f0" class="para">19</a>] </sup>
- <span class="bold"><strong>Rationale.</strong></span> This limitation derives from
- the fact that <code class="computeroutput"><span class="identifier">BOOST_LOCAL_FUNCTION</span></code>
- uses preprocessor token concatenation <code class="literal">##</code> to inspect
- the parameter type token (to see if this token is a parameter or a bound
- variable) and the C++ preprocessor does not allow to concatenate non-alphanumeric
- tokens.
+ <span class="bold"><strong>Rationale.</strong></span> This limitation is because
+ this library uses preprocessor token concatenation <code class="literal">##</code>
+ to inspect the macro parameters (to distinguish between function parameters,
+ bound variables, etc) and the C++ preprocessor does not allow to concatenate
+ non-alphanumeric tokens.
</p></div>
<div class="footnote"><p><sup>[<a id="ftn.boost_localfunction.Advanced_Topics.commas_and_symbols_in_macros.f1" href="#boost_localfunction.Advanced_Topics.commas_and_symbols_in_macros.f1" class="para">20</a>] </sup>
The preprocessor always interprets unwrapped commas as separating macro
@@ -1206,12 +1228,9 @@
<span class="identifier">m</span></code>, etc instead of passing <code class="computeroutput"><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">,</span> <span class="identifier">size_t</span><span class="special">>&</span> <span class="identifier">m</span></code>
as a single macro parameter.
</p></div>
-<div class="footnote"><p><sup>[<a id="ftn.boost_localfunction.Advanced_Topics.commas_and_symbols_in_macros.f2" href="#boost_localfunction.Advanced_Topics.commas_and_symbols_in_macros.f2" class="para">21</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"><span class="identifier">BOOST_IDENTITY_TYPE</span></code>
- macro. However, this feature is currently not implemented and the double
- parenthesis are always needed when invoking this macro.
+<div class="footnote"><p><sup>[<a id="ftn.boost_localfunction.Advanced_Topics.accessing_types__concepts__etc_.f0" href="#boost_localfunction.Advanced_Topics.accessing_types__concepts__etc_.f0" class="para">21</a>] </sup>
+ <span class="bold"><strong>Rationale.</strong></span> The type names <code class="computeroutput"><span class="identifier">result_type</span></code> and <code class="computeroutput"><span class="identifier">arg</span></code><code class="literal"><span class="emphasis"><em>N</em></span></code><code class="computeroutput"><span class="identifier">_type</span></code> follow the Boost.TypeTraits
+ naming conventions for function traits.
</p></div>
<div class="footnote"><p><sup>[<a id="ftn.boost_localfunction.Advanced_Topics.specifying_types.f0" href="#boost_localfunction.Advanced_Topics.specifying_types.f0" class="para">22</a>] </sup>
In the examples of this documentation, we specify bound variables, function
@@ -1243,8 +1262,8 @@
scope) does not know the local function name so the local function name
used for recursive call cannot be set in the global functor. This limitation
together with preventing the possibility for inlining are the reasons
- why local functions do not allow for recursion unless programmers explicitly
- declare them <code class="computeroutput"><span class="identifier">recursive</span></code>.
+ why local functions are not recursive unless programmers explicitly declare
+ them <code class="computeroutput"><span class="identifier">recursive</span></code>.
</p></div>
<div class="footnote"><p><sup>[<a id="ftn.boost_localfunction.Advanced_Topics.storage_classifiers___auto__and__register__.f0" href="#boost_localfunction.Advanced_Topics.storage_classifiers___auto__and__register__.f0" class="para">25</a>] </sup>
The <code class="computeroutput"><span class="keyword">auto</span></code> storage classifier
@@ -1258,8 +1277,8 @@
</p></div>
<div class="footnote"><p><sup>[<a id="ftn.boost_localfunction.Advanced_Topics.limitations__operators__etc_.f1" href="#boost_localfunction.Advanced_Topics.limitations__operators__etc_.f1" class="para">26</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) and operators cannot be used as local variable
+ 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.
</p></div>
</div>
@@ -1268,7 +1287,7 @@
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2009-2012 Lorenzo
Caminiti<p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
+ 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)
</p>
</div></td>
Modified: sandbox/local_function/libs/local_function/doc/html/boost_localfunction/Alternatives.html
==============================================================================
--- sandbox/local_function/libs/local_function/doc/html/boost_localfunction/Alternatives.html (original)
+++ sandbox/local_function/libs/local_function/doc/html/boost_localfunction/Alternatives.html 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -28,8 +28,7 @@
</h2></div></div></div>
<p>
This section compares the features offered by this library with similar features
- offered by other libraries and by the new C++11
- standard.
+ offered by C++ and by other libraries.
</p>
<h6>
<a name="boost_localfunction.Alternatives.h0"></a>
@@ -121,26 +120,26 @@
</td>
<td>
<p>
- Yes. Plus eventual compiler errors follow the usual format of C++
- statement errors.
+ Yes. Plus eventual compiler errors and debugging follow the usual
+ format of C++ statement errors.
</p>
</td>
<td>
<p>
- Yes. Plus eventual compiler errors follow the usual format of C++
- statement errors.
+ Yes. Plus eventual compiler errors and debugging follow the usual
+ format of C++ statement errors.
</p>
</td>
<td>
<p>
- Yes. Plus eventual compiler errors follow the usual format of C++
- statement errors.
+ Yes. Plus eventual compiler errors and debugging follow the usual
+ format of C++ statement errors.
</p>
</td>
<td>
<p>
- Yes. Plus eventual compiler errors follow the usual format of C++
- statement errors.
+ Yes. Plus eventual compiler errors and debugging follow the usual
+ format of C++ statement errors.
</p>
</td>
<td>
@@ -247,21 +246,21 @@
</td>
<td>
<p>
- No. Programmers must manually manage functor member variables and
- explicitly specify their types to access variables in scope.
+ No. Programmers must manually program functor data members and explicitly
+ specify their types to access variables in scope.
</p>
</td>
<td>
<p>
- No. Programmers must manually manage functor member variables and
- explicitly specify their types to access variables in scope.
+ No. Programmers must manually program functor data members and explicitly
+ specify their types to access variables in scope.
</p>
</td>
<td>
<p>
- Yes (variables in scope are accessible as usual within expressions)
- plus <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">phoenix</span><span class="special">::</span><span class="identifier">let</span></code> can be used to bind variables
- by constant reference.
+ Yes. Variables in scope are accessible as usual within expressions
+ (plus <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">phoenix</span><span class="special">::</span><span class="identifier">let</span></code> can be used to bind variables
+ by constant reference).
</p>
</td>
</tr>
@@ -334,11 +333,14 @@
is <code class="computeroutput"><span class="identifier">CopyConstructible</span></code> and
the binding requires a (potentially expensive) extra copy operation. Both
constant reference and non-constant value binding are instead supported
- by this library.
+ by this library. However, <a href="http://en.wikipedia.org/wiki/C%2B%2B0x#Lambda_functions_and_expressions" target="_top">C++11
+ lambda</a> functions provide a short-hand syntax to bind all variables
+ in scope at once (<code class="computeroutput"><span class="special">&</span></code> or
+ <code class="computeroutput"><span class="special">=</span></code>).
</li>
</ul></div>
<p>
- For example, for non-copyable objects (see also noncopyable_lambda.cpp
+ For example, for non-copyable objects (see also noncopyable_lambda_err.cpp
and noncopyable_local_function.cpp
):
</p>
<div class="informaltable"><table class="table">
@@ -393,7 +395,7 @@
<span class="identifier">n</span> <span class="identifier">x</span><span class="special">(-</span><span class="number">1</span><span class="special">);</span>
<span class="keyword">void</span> <span class="identifier">BOOST_LOCAL_FUNCTION</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">bind</span><span class="special">&</span> <span class="identifier">x</span><span class="special">)</span> <span class="special">{</span> <span class="comment">// OK: No copy</span>
- <span class="identifier">assert</span><span class="special">(</span> <span class="identifier">x</span> <span class="special">==</span> <span class="special">-</span><span class="number">1</span> <span class="special">);</span> <span class="comment">// and constant.</span>
+ <span class="identifier">assert</span><span class="special">(</span> <span class="identifier">x</span><span class="special">.</span><span class="identifier">i</span> <span class="special">==</span> <span class="special">-</span><span class="number">1</span> <span class="special">);</span> <span class="comment">// and constant.</span>
<span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">f</span><span class="special">)</span>
<span class="identifier">f</span><span class="special">();</span>
@@ -480,13 +482,12 @@
</tr></tbody>
</table></div>
<p>
- Note that 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
+ 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">&</span> <span class="identifier">const_x</span> <span class="special">=</span> <span class="identifier">x</span><span class="special">;</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>
+ <code class="computeroutput"><span class="keyword">const</span> <span class="identifier">n</span><span class="special">&</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>
section) it might be preferable to maintain the same variable name <code class="computeroutput"><span class="identifier">x</span></code> within the function body.
@@ -531,7 +532,7 @@
<span class="special">}</span>
<span class="keyword">private</span><span class="special">:</span> <span class="comment">// Unfortunately, cannot bind so repeat variable types.</span>
<span class="keyword">int</span><span class="special">&</span> <span class="identifier">sum</span><span class="special">;</span> <span class="comment">// Access `sum` by reference.</span>
- <span class="keyword">const</span> <span class="keyword">int</span><span class="special">&</span> <span class="identifier">factor</span><span class="special">;</span> <span class="comment">// Make `factor` constant.</span>
+ <span class="keyword">const</span> <span class="keyword">int</span> <span class="identifier">factor</span><span class="special">;</span> <span class="comment">// Make `factor` constant.</span>
<span class="special">}</span> <span class="identifier">add</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">add</span><span class="special">(</span><span class="number">1</span><span class="special">);</span>
@@ -596,7 +597,7 @@
<td>
<p>
</p>
-<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="comment">// Unfortunately, cannot be defined locally (so not real alternative).</span>
+<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="comment">// Unfortunately, cannot be defined locally (so not a real alternative).</span>
<span class="keyword">struct</span> <span class="identifier">global_add</span> <span class="special">{</span> <span class="comment">// Unfortunately, boilerplate code to program the class.</span>
<span class="identifier">global_add</span><span class="special">(</span><span class="keyword">int</span><span class="special">&</span> <span class="identifier">_sum</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">_factor</span><span class="special">):</span> <span class="identifier">sum</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">_factor</span><span class="special">)</span> <span class="special">{}</span>
@@ -605,10 +606,10 @@
<span class="special">}</span>
<span class="keyword">private</span><span class="special">:</span> <span class="comment">// Unfortunately, cannot bind so repeat variable types.</span>
<span class="keyword">int</span><span class="special">&</span> <span class="identifier">sum</span><span class="special">;</span> <span class="comment">// Access `sum` by reference.</span>
- <span class="keyword">const</span> <span class="keyword">int</span><span class="special">&</span> <span class="identifier">factor</span><span class="special">;</span> <span class="comment">// Make `factor` constant.</span>
+ <span class="keyword">const</span> <span class="keyword">int</span> <span class="identifier">factor</span><span class="special">;</span> <span class="comment">// Make `factor` constant.</span>
<span class="special">};</span>
-<span class="identifier">BOOST_AUTO_TEST_CASE</span><span class="special">(</span> <span class="identifier">add_global_functor</span> <span class="special">)</span> <span class="special">{</span>
+<span class="identifier">BOOST_AUTO_TEST_CASE</span><span class="special">(</span> <span class="identifier">test_add_global_functor</span> <span class="special">)</span> <span class="special">{</span>
<span class="keyword">int</span> <span class="identifier">sum</span> <span class="special">=</span> <span class="number">0</span><span class="special">,</span> <span class="identifier">factor</span> <span class="special">=</span> <span class="number">10</span><span class="special">;</span>
<span class="identifier">global_add</span> <span class="identifier">add</span><span class="special">(</span><span class="identifier">sum</span><span class="special">,</span> <span class="identifier">factor</span><span class="special">);</span>
@@ -653,7 +654,7 @@
<span class="bold"><strong>Boost.Phoenix</strong></span>
</p>
<p>
- The following example compares local functions with Boost.Phoenix
+ The following example compares local functions with Boost.Phoenix
(see also add_phoenix.cpp
and add.cpp
):
</p>
@@ -679,11 +680,16 @@
<p>
</p>
<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="special">{</span>
+ <span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">phoenix</span><span class="special">::</span><span class="identifier">let</span><span class="special">;</span>
+ <span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">phoenix</span><span class="special">::</span><span class="identifier">local_names</span><span class="special">::</span><span class="identifier">_f</span><span class="special">;</span>
+ <span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">phoenix</span><span class="special">::</span><span class="identifier">cref</span><span class="special">;</span>
+ <span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">phoenix</span><span class="special">::</span><span class="identifier">ref</span><span class="special">;</span>
+ <span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">phoenix</span><span class="special">::</span><span class="identifier">arg_names</span><span class="special">::</span><span class="identifier">_1</span><span class="special">;</span>
+
<span class="keyword">int</span> <span class="identifier">sum</span> <span class="special">=</span> <span class="number">0</span><span class="special">,</span> <span class="identifier">factor</span> <span class="special">=</span> <span class="number">10</span><span class="special">;</span>
<span class="keyword">int</span> <span class="identifier">nums</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="comment">// Passed to template, `factor` by constant, and defined in expression.</span>
- <span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">phoenix</span><span class="special">;</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">for_each</span><span class="special">(</span><span class="identifier">nums</span><span class="special">,</span> <span class="identifier">nums</span> <span class="special">+</span> <span class="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>
@@ -718,9 +724,9 @@
</tr></tbody>
</table></div>
<p>
- The comparison in this section does not include the Boost.Lambda
- library because it is obsolete and it was replaced replaced by Boost.Phoenix.
- The Boost.Phoenix
+ The comparison in this section does not include the Boost.Lambda
+ library because that library is obsolete and it was replaced by Boost.Phoenix.
+ The Boost.Phoenix
library version 3.0 is used for this comparison.
</p>
<h6>
@@ -734,24 +740,25 @@
<p>
Overall, this library has compile-times and generates binary sizes similar
to the ones of the other approaches. This library run-times on C++03
- compliant compilers were measured to be larger than other approaches when compiler
- optimization is enabled (using <code class="computeroutput"><span class="identifier">bjam</span>
- <span class="identifier">release</span> <span class="special">...</span></code>).
- However, on compilers that allow to pass local types as template parameters
- (e.g., MSVC 8.0 or GCC 4.5.3 with C++11
- features enabled <code class="literal">-std=c++0x</code>, see also [N2657])
+ compilers were measured to be larger than other approaches when compiler optimization
+ is enabled (using <code class="computeroutput"><span class="identifier">bjam</span> <span class="identifier">release</span>
+ <span class="special">...</span></code>). However, on compilers that allow
+ to pass local types as template parameters (e.g., MSVC 8.0 or GCC 4.5.3 with
+ C++11 features
+ enabled <code class="literal">-std=c++0x</code>, see also [N2657])
this library automatically generates optimized code that runs as fast as the
- fastest of the other approaches (see Boost.LocalFunction
+ fastest of the other approaches (see the "Boost.LocalFunction" approach
below). When this library local function is specified <code class="computeroutput"><span class="keyword">inline</span></code>
- (see Boost.LocalFunction
- Inline below and the <a class="link" href="Advanced_Topics.html" title="Advanced Topics">Advanced
- Topics</a> section) its run-times are always comparable to both the Local
- Functor and Global Functor approaches (but in this case the local function
- cannot be portably passed as template parameter, see [N2657],
- so <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">for_each</span></code> is replaced by a for-loop). Finally,
- this library run-times are always among the fastest when no compiler optimization
- is enabled (using <code class="computeroutput"><span class="identifier">bjam</span> <span class="identifier">debug</span>
- <span class="special">...</span></code>).
+ (see the "Boost.LocalFunction Inline" approach below and the <a class="link" href="Advanced_Topics.html" title="Advanced Topics">Advanced Topics</a> section)
+ its run-times are always comparable to both the "Local Functor" and
+ "Global Functor" approaches. However, in these cases the local function
+ cannot be portably passed as template parameter (see [N2657])
+ so <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">for_each</span></code> is replaced by a for-loop (on MSVC
+ the for-loop, and not the local function in fact the same applies to local
+ functors, was measured to have worst performances than using <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">for_each</span></code>).
+ Finally, this library run-times are always among the fastest when no compiler
+ optimization is enabled (using <code class="computeroutput"><span class="identifier">bjam</span>
+ <span class="identifier">debug</span> <span class="special">...</span></code>).
</p>
<div class="note"><table border="0" summary="Note">
<tr>
@@ -767,7 +774,7 @@
and the <a class="link" href="Implementation.html" title="Annex: Implementation">Implementation</a>
section). For all tested compilers, this function pointer prevents the compiler
optimization algorithms from inlining the local function calls. Instead,
- the functors used by other approaches (e.g., Boost.Phoenix)
+ the functors used by other approaches (e.g., Boost.Phoenix)
have been observed to allow all tested compilers to inline all the function
calls for optimization. This run-time performance cost is not present on
compilers that allow to pass local types as template parameters (e.g., MSVC
@@ -779,9 +786,9 @@
</table></div>
<p>
This run-time performance cost on C++03
- compliant compilers might or might not be an issue depending on the performance
- requirements of specific applications. For example, an application might already
- be using a number of indirect function calls (function pointers, virtual functions,
+ compilers might or might not be an issue depending on the performance requirements
+ of specific applications. For example, an application might already be using
+ a number of indirect function calls (function pointers, virtual functions,
etc) for which the overhead added by using the one extra function pointer required
by the local function call might not be noticeable within the overall program
run-time.
@@ -793,7 +800,7 @@
will perform with respect to each other when a more complex set of instructions
is programmed for the local function body (e.g., <span class="emphasis"><em>if</em></span> a
more complex set of instructions in the local function body were to inhibit
- some compilers from inlining functor objects also other approaches like Boost.Phoenix
+ some compilers from inlining functor objects also other approaches like Boost.Phoenix
<span class="emphasis"><em>could</em></span> start to show higher run-times even when optimization
is enabled).
</p>
@@ -801,13 +808,14 @@
The following commands were executed from the library example directory to
measure compile-time, binary size, and run-time respectively:
</p>
-<pre class="programlisting">> python chrono.py bjam {release|debug} <PROGRAM> # compile-time
-> size <PROGRAM> # binary size (Linux and Gygwin)
-> <PROGRAM> # run-time
+<pre class="programlisting">> touch <FILE_NAME>.cpp # force recompilation
+> python chrono.py bjam {release|debug} <FILE_NAME> # compile-time
+> size <FILE_NAME> # binary size
+> ./<FILE_NAME> # run-time
</pre>
<p>
The local function was called <code class="literal">1e8</code> times to add together
- all the elements of a vector and the run-time was measured using Boost.Chrono
+ all the elements of a vector and the run-time was measured using Boost.Chrono
averaging over <code class="literal">10</code> executions of the vector summation (see
the source files below).
</p>
@@ -830,7 +838,7 @@
</th>
<th>
<p>
- File
+ Source File
</p>
</th>
</tr></thead>
@@ -843,7 +851,7 @@
</td>
<td>
<p>
- Boost.LocalFunction
+ Boost.LocalFunction
</p>
</td>
<td>
@@ -860,7 +868,7 @@
</td>
<td>
<p>
- Boost.LocalFunction
+ Boost.LocalFunction
inline
</p>
</td>
@@ -879,7 +887,7 @@
<td>
<p>
<a href="http://www.open-std.org/JTC1/SC22/WG21/" target="_top">C++11</a>
- Lambda Function
+ Lambda Function <sup>[<a name="boost_localfunction.Alternatives.f0" href="#ftn.boost_localfunction.Alternatives.f0" class="footnote">a</a>]</sup>
</p>
</td>
<td>
@@ -930,7 +938,7 @@
</td>
<td>
<p>
- Boost.Phoenix
+ Boost.Phoenix
</p>
</td>
<td>
@@ -940,6 +948,10 @@
</td>
</tr>
</tbody>
+<tbody class="footnotes"><tr><td colspan="3"><div class="footnote"><p><sup>[<a id="ftn.boost_localfunction.Alternatives.f0" href="#boost_localfunction.Alternatives.f0" class="para">a</a>] </sup>
+ Measurements available only for C++11
+ compilers.
+ </p></div></td></tr></tbody>
</table></div>
<div class="informaltable"><table class="table">
<colgroup><col></colgroup>
@@ -1022,7 +1034,7 @@
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2009-2012 Lorenzo
Caminiti<p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
+ 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)
</p>
</div></td>
Modified: sandbox/local_function/libs/local_function/doc/html/boost_localfunction/Bibliography.html
==============================================================================
--- sandbox/local_function/libs/local_function/doc/html/boost_localfunction/Bibliography.html (original)
+++ sandbox/local_function/libs/local_function/doc/html/boost_localfunction/Bibliography.html 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -30,7 +30,9 @@
This section lists all the bibliographic references cited by this documentation.
</p>
<p>
- @todo complete this
+ [N1613]
+ Thorsten Ottosen. <span class="emphasis"><em>Proposal to add Design by Contract to C++.</em></span>
+ The C++ Standards Committee, document no. N1613=04-0053, 2004.
</p>
<p>
<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2511.html" target="_top">[N2511]</a>
@@ -59,7 +61,7 @@
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2009-2012 Lorenzo
Caminiti<p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
+ 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)
</p>
</div></td>
Modified: sandbox/local_function/libs/local_function/doc/html/boost_localfunction/Examples.html
==============================================================================
--- sandbox/local_function/libs/local_function/doc/html/boost_localfunction/Examples.html (original)
+++ sandbox/local_function/libs/local_function/doc/html/boost_localfunction/Examples.html 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -40,7 +40,7 @@
<dt><span class="section">N-Papers</span></dt>
</dl></div>
<p>
- This sections lists some examples that use this library features.
+ This section lists some examples that use this library.
</p>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
@@ -156,7 +156,7 @@
</h3></div></div></div>
<p>
It is possible to use local functions to check assertions between variables
- that are made constant within the asserted expression. This is advantageous
+ that are made constant within the asserted expressions. This is advantageous
because assertions are not supposed to change the state of the program and
ideally the compiler will not compile assertions that modify variables.
</p>
@@ -172,13 +172,13 @@
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 introduced the idea of a <span class="emphasis"><em>const-block</em></span> which could
+ paper introduces the idea of a <span class="emphasis"><em>const-block</em></span> 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 <code class="computeroutput"><span class="keyword">operator</span><span class="special">=</span></code>
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.cpp
):
+ (see also const_block_err.cpp
):
</p>
<div class="informaltable"><table class="table">
<colgroup>
@@ -193,7 +193,7 @@
</th>
<th>
<p>
- N1613 Constant Block
+ N1613 Const-Blocks
</p>
</th>
</tr></thead>
@@ -230,17 +230,18 @@
by constant reference <code class="computeroutput"><span class="keyword">const</span> <span class="identifier">bind</span><span class="special">&</span></code>
all the specified variables (so the variables are constant within the code
block but they do not need to be <code class="computeroutput"><span class="identifier">CopyConstructible</span></code>
- and no extra copy is performed). The local function executes the <code class="computeroutput"><span class="identifier">assert</span></code> instruction its body which is called
- immediately after it is defined. More in general, constant blocks can be
- used to evaluate any instruction (not just assertions) within a block were
- all specified variables are constant.
+ and no extra copy is performed). The local function executes the <code class="computeroutput"><span class="identifier">assert</span></code> instruction in its body which is
+ called immediately after it is defined. More in general, constant blocks
+ can be used to evaluate any instruction (not just assertions) within a block
+ were all specified variables are constant.
</p>
<p>
Unfortunately, constant blocks cannot be implemented with <a href="http://en.wikipedia.org/wiki/C%2B%2B0x#Lambda_functions_and_expressions" target="_top">C++11
lambda</a> functions because these do not support constant binding (of
course it is always possible to introduce extra constant variables <code class="computeroutput"><span class="keyword">const</span> <span class="keyword">int</span><span class="special">&</span> <span class="identifier">const_x</span>
- <span class="special">=</span> <span class="identifier">x</span><span class="special">;</span></code> and use these variables in the assertion).
- Variables bound by value using <a href="http://en.wikipedia.org/wiki/C%2B%2B0x#Lambda_functions_and_expressions" target="_top">C++11
+ <span class="special">=</span> <span class="identifier">x</span></code>,
+ etc and use these variables in the assertion). Variables bound by value using
+ <a href="http://en.wikipedia.org/wiki/C%2B%2B0x#Lambda_functions_and_expressions" target="_top">C++11
lambda</a> functions (<code class="computeroutput"><span class="identifier">variable</span></code>,
<code class="computeroutput"><span class="special">=</span><span class="identifier">variable</span></code>,
and <code class="computeroutput"><span class="special">=</span></code>) are constant but they
@@ -254,18 +255,18 @@
</h3></div></div></div>
<p>
Scope exits allow to execute arbitrary code at the exit of the enclosing
- scope and they are provided by the Boost.ScopeExit
+ scope and they are provided by the Boost.ScopeExit
library.
</p>
<p>
For curiosity, here we show how to re-implement scope exits using local functions.
One small advantage of scope exits that use local functions is that they
- support constant binding. Boost.ScopeExit
+ support constant binding. Boost.ScopeExit
does not directly support constant binding (however, it is always possible
to introduce an extra <code class="computeroutput"><span class="keyword">const</span></code>
local variable, assign it to the value to bind, and then bind the <code class="computeroutput"><span class="keyword">const</span></code> variable so to effectively have constant
- binding with Boost.ScopeExit
- as well). In general, the authors recommend to use Boost.ScopeExit
+ binding with Boost.ScopeExit
+ as well). In general, the authors recommend to use Boost.ScopeExit
instead of the code listed here whenever possible.
</p>
<p>
@@ -307,17 +308,13 @@
</p>
</td>
<td>
- <p>
-</p>
-<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="identifier">person</span><span class="special">&</span> <span class="identifier">p</span> <span class="special">=</span> <span class="identifier">persons_</span><span class="special">.</span><span class="identifier">back</span><span class="special">();</span>
-<span class="identifier">person</span><span class="special">::</span><span class="identifier">evolution_t</span> <span class="identifier">checkpoint</span> <span class="special">=</span> <span class="identifier">p</span><span class="special">.</span><span class="identifier">evolution_</span><span class="special">;</span>
+<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting">person& p = persons_.back();
+ person::evolution_t checkpoint = p.evolution_;
-<span class="identifier">BOOST_SCOPE_EXIT</span><span class="special">(</span><span class="identifier">checkpoint</span><span class="special">,</span> <span class="special">&</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">this_</span><span class="special">)</span> <span class="special">{</span> <span class="comment">// Or extra variable `const_p`.</span>
- <span class="keyword">if</span> <span class="special">(</span><span class="identifier">checkpoint</span> <span class="special">==</span> <span class="identifier">p</span><span class="special">.</span><span class="identifier">evolution_</span><span class="special">)</span> <span class="identifier">this_</span><span class="special">-></span><span class="identifier">persons_</span><span class="special">.</span><span class="identifier">pop_back</span><span class="special">();</span>
-<span class="special">}</span> <span class="identifier">BOOST_SCOPE_EXIT_END</span>
+ BOOST_SCOPE_EXIT(checkpoint, &p, this_) { // Or extra variable <code class="computeroutput"><span class="identifier">const_p</span></code>.
+ if (checkpoint == p.evolution_) this_->persons_.pop_back();
+ } BOOST_SCOPE_EXIT_END
</pre>
-<p>
- </p>
</td>
</tr></tbody>
</table></div>
@@ -353,9 +350,9 @@
Functions</a>
</h3></div></div></div>
<p>
- Local functions can be used to create Boost.Phoenix
- functions. For example (see also boost_phoenix_local_factorial.cpp
- and boost_phoenix_factorial.cpp
):
+ Local functions can be used to create Boost.Phoenix
+ functions. For example (see also phoenix_factorial_local.cpp
+ and phoenix_factorial.cpp
):
</p>
<div class="informaltable"><table class="table">
<colgroup>
@@ -378,10 +375,10 @@
<td>
<p>
</p>
-<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="identifier">BOOST_AUTO_TEST_CASE</span><span class="special">(</span> <span class="identifier">example_boost_phoenix_factorial_local</span> <span class="special">)</span> <span class="special">{</span>
+<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="identifier">BOOST_AUTO_TEST_CASE</span><span class="special">(</span> <span class="identifier">test_phoenix_factorial_local</span> <span class="special">)</span> <span class="special">{</span>
<span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">phoenix</span><span class="special">::</span><span class="identifier">arg_names</span><span class="special">::</span><span class="identifier">arg1</span><span class="special">;</span>
- <span class="keyword">int</span> <span class="identifier">BOOST_LOCAL_FUNCTION</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">n</span><span class="special">)</span> <span class="special">{</span> <span class="comment">// Monomorphic.</span>
+ <span class="keyword">int</span> <span class="identifier">BOOST_LOCAL_FUNCTION</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">n</span><span class="special">)</span> <span class="special">{</span> <span class="comment">// Unfortunately, monomorphic.</span>
<span class="keyword">return</span> <span class="special">(</span><span class="identifier">n</span> <span class="special"><=</span> <span class="number">0</span><span class="special">)</span> <span class="special">?</span> <span class="number">1</span> <span class="special">:</span> <span class="identifier">n</span> <span class="special">*</span> <span class="identifier">factorial_impl</span><span class="special">(</span><span class="identifier">n</span> <span class="special">-</span> <span class="number">1</span><span class="special">);</span>
<span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">recursive</span> <span class="identifier">factorial_impl</span><span class="special">)</span>
@@ -415,7 +412,7 @@
<span class="special">}</span>
<span class="special">};</span>
-<span class="identifier">BOOST_AUTO_TEST_CASE</span><span class="special">(</span> <span class="identifier">example_boost_phoenix_factorial</span> <span class="special">)</span> <span class="special">{</span>
+<span class="identifier">BOOST_AUTO_TEST_CASE</span><span class="special">(</span> <span class="identifier">test_phoenix_factorial</span> <span class="special">)</span> <span class="special">{</span>
<span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">phoenix</span><span class="special">::</span><span class="identifier">arg_names</span><span class="special">::</span><span class="identifier">arg1</span><span class="special">;</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">phoenix</span><span class="special">::</span><span class="identifier">function</span><span class="special"><</span><span class="identifier">factorial_impl</span><span class="special">></span> <span class="identifier">factorial</span><span class="special">;</span>
@@ -431,10 +428,10 @@
</tr></tbody>
</table></div>
<p>
- This is presented here mainly as a curiosity because Boost.Phoenix
+ This is presented here mainly as a curiosity because Boost.Phoenix
functions created from local functions have the important limitation that
- they cannot be polymorphic. <sup>[<a name="boost_localfunction.Examples.boost_phoenix_functions.f0" href="#ftn.boost_localfunction.Examples.boost_phoenix_functions.f0" class="footnote">28</a>]</sup> Therefore, in many cases creating the Boost.Phoenix
- function from global functors (possibly with the help of Boost.Phoenix
+ they cannot be polymorphic. <sup>[<a name="boost_localfunction.Examples.boost_phoenix_functions.f0" href="#ftn.boost_localfunction.Examples.boost_phoenix_functions.f0" class="footnote">28</a>]</sup> Therefore, in many cases creating the Boost.Phoenix
+ function from global functors (possibly with the help of Boost.Phoenix
adaptor macros) might be a more valuable option.
</p>
</div>
@@ -443,8 +440,9 @@
<a name="boost_localfunction.Examples.closures"></a><a class="link" href="Examples.html#boost_localfunction.Examples.closures" title="Closures">Closures</a>
</h3></div></div></div>
<p>
- A few more examples on how to return local functions to the calling scope
- (and the relative precautions to take) mainly adapted from examples of closures.
+ The following are examples of closures
+ that illustrate how to return local functions to the calling scope (and the
+ relative precautions to take).
</p>
<div class="informaltable"><table class="table">
<colgroup><col></colgroup>
@@ -595,7 +593,7 @@
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2009-2012 Lorenzo
Caminiti<p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
+ 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)
</p>
</div></td>
Modified: sandbox/local_function/libs/local_function/doc/html/boost_localfunction/Getting_Started.html
==============================================================================
--- sandbox/local_function/libs/local_function/doc/html/boost_localfunction/Getting_Started.html (original)
+++ sandbox/local_function/libs/local_function/doc/html/boost_localfunction/Getting_Started.html 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -58,10 +58,10 @@
of this library.
</p>
<p>
- In some of the examples presented in this documentation, the Boost.Test
+ In some of the examples presented in this documentation, the Boost.Test
macro <code class="computeroutput"><span class="identifier">BOOST_CHECK</span></code> is used
equivalently to <code class="computeroutput"><span class="identifier">assert</span></code> and
- the Boost.Test
+ the Boost.Test
macro <code class="computeroutput"><span class="identifier">BOOST_AUTO_TEST_CASE</span></code>
is used equivalently to <code class="computeroutput"><span class="identifier">main</span></code>.
<sup>[<a name="boost_localfunction.Getting_Started.this_documentation.f0" href="#ftn.boost_localfunction.Getting_Started.this_documentation.f0" class="footnote">3</a>]</sup>
@@ -73,11 +73,11 @@
and Platforms</a>
</h3></div></div></div>
<p>
- The implementation of this library uses preprocessor and template metaprogramming
- (as supported by Boost.Preprocessor
- and Boost.MPL),
+ The implementation of this library uses preprocessor and template meta-programming
+ (as supported by Boost.Preprocessor
+ and Boost.MPL),
templates with partial specializations and function pointers (similarly to
- Boost.Function).
+ Boost.Function).
As a consequence, this library is fairly demanding on compilers' compliance
with the C++03
standard. At present, this library has been successfully compiled and tested
@@ -114,11 +114,11 @@
</p>
<p>
This library implementation uses a number of Boost
- libraries among which: Boost.Preprocessor,
- Boost.ScopeExit,
- Boost.Typeof,
- Boost.TypeTraits,
- and Boost.MPL.
+ libraries among which: Boost.Preprocessor,
+ Boost.ScopeExit,
+ Boost.Typeof,
+ Boost.TypeTraits,
+ and Boost.MPL.
These Boost libraries must be
properly installed on your system in order for this library to work.
</p>
@@ -163,7 +163,7 @@
<div class="footnotes">
<br><hr width="100" align="left">
<div class="footnote"><p><sup>[<a id="ftn.boost_localfunction.Getting_Started.this_documentation.f0" href="#boost_localfunction.Getting_Started.this_documentation.f0" class="para">3</a>] </sup>
- <span class="bold"><strong>Rationale.</strong></span> Using Boost.Test
+ <span class="bold"><strong>Rationale.</strong></span> Using Boost.Test
allows to add the documentation examples to the library regression tests
so to make sure that the listed examples always compile and run correctly.
</p></div>
@@ -190,7 +190,7 @@
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2009-2012 Lorenzo
Caminiti<p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
+ 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)
</p>
</div></td>
Modified: sandbox/local_function/libs/local_function/doc/html/boost_localfunction/Implementation.html
==============================================================================
--- sandbox/local_function/libs/local_function/doc/html/boost_localfunction/Implementation.html (original)
+++ sandbox/local_function/libs/local_function/doc/html/boost_localfunction/Implementation.html 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -52,7 +52,7 @@
in C++03
local classes (and therefore the local function objects they implement) cannot
be passed as template parameters (e.g., to the <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">for_each</span></code>
- algorithm), this is instead possible on C++11,
+ algorithm), this is instead possible in C++11,
MSVC, and some other compilers (see [N2657]).
To work around this limitation, this library investigated the following two
"tricks" (both tricks can be extended to support eventual function
@@ -78,7 +78,7 @@
</p>
<p>
</p>
-<pre class="programlisting"><span class="preprocessor">#define</span> <span class="identifier">BOOST_TEST_MODULE</span> <span class="identifier">ExampleTparamTricks</span>
+<pre class="programlisting"><span class="preprocessor">#define</span> <span class="identifier">BOOST_TEST_MODULE</span> <span class="identifier">TestImplTparamTricks</span>
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">test</span><span class="special">/</span><span class="identifier">unit_test</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">vector</span><span class="special">></span>
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">algorithm</span><span class="special">></span>
@@ -106,7 +106,7 @@
<span class="identifier">interface</span><span class="special">*</span> <span class="identifier">func_</span><span class="special">;</span>
<span class="special">};</span>
-<span class="identifier">BOOST_AUTO_TEST_CASE</span><span class="special">(</span> <span class="identifier">example_tparam_tricks</span> <span class="special">)</span> <span class="special">{</span>
+<span class="identifier">BOOST_AUTO_TEST_CASE</span><span class="special">(</span> <span class="identifier">test_impl_tparam_tricks</span> <span class="special">)</span> <span class="special">{</span>
<span class="keyword">int</span> <span class="identifier">sum</span> <span class="special">=</span> <span class="number">0</span><span class="special">,</span> <span class="identifier">factor</span> <span class="special">=</span> <span class="number">10</span><span class="special">;</span>
<span class="comment">// Local class for local function.</span>
@@ -170,221 +170,34 @@
(to generate special code to bind the object in scope), or if the variable
is bound by <code class="computeroutput"><span class="keyword">const</span></code> (to generate
special code to bind by constant), etc. The parameter tokens are inspected
- using preprocessor metaprogramming, specifically using the macros from <code class="computeroutput"><span class="string">"boost/local_function/detail/preprocessor/keyword/"</span></code>.
- <sup>[<a name="boost_localfunction.Implementation.f0" href="#ftn.boost_localfunction.Implementation.f0" class="footnote">29</a>]</sup>
+ using preprocessor metaprogramming and specifically using the macros defined
+ by the files in the <code class="literal">boost/local_function/detail/preprocessor/keyword/</code>
+ directory. <sup>[<a name="boost_localfunction.Implementation.f0" href="#ftn.boost_localfunction.Implementation.f0" class="footnote">29</a>]</sup>
</p>
<p>
For example, the following code defines a macro that allows the preprocessor
to detect if a set of space-separated tokens ends with <code class="computeroutput"><span class="identifier">this_</span></code>
- or not:
+ or not (see also impl_pp_keyword.cpp
):
</p>
<p>
</p>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local_function</span><span class="special">/</span><span class="identifier">detail</span><span class="special">/</span><span class="identifier">preprocessor</span><span class="special">/</span><span class="identifier">keyword</span><span class="special">/</span><span class="identifier">thisunderscore</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local_function</span><span class="special">/</span><span class="identifier">detail</span><span class="special">/</span><span class="identifier">preprocessor</span><span class="special">/</span><span class="identifier">keyword</span><span class="special">/</span><span class="keyword">const</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local_function</span><span class="special">/</span><span class="identifier">detail</span><span class="special">/</span><span class="identifier">preprocessor</span><span class="special">/</span><span class="identifier">keyword</span><span class="special">/</span><span class="identifier">bind</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
-<span class="preprocessor">#define</span> <span class="identifier">BOOST_TEST_MODULE</span> <span class="identifier">ExampleImplPpKeyword</span>
+<span class="preprocessor">#define</span> <span class="identifier">BOOST_TEST_MODULE</span> <span class="identifier">TestImplPpKeyword</span>
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">test</span><span class="special">/</span><span class="identifier">unit_test</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
<span class="comment">// Expand to 1 if space-separated tokens end with `this_`, 0 otherwise.</span>
-<span class="preprocessor">#define</span> <span class="identifier">HAS_THIS_</span><span class="special">(</span><span class="identifier">tokens</span><span class="special">)</span> <span class="special">\</span>
+<span class="preprocessor">#define</span> <span class="identifier">IS_THIS_BACK</span><span class="special">(</span><span class="identifier">tokens</span><span class="special">)</span> <span class="special">\</span>
<span class="identifier">BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_IS_THISUNDERSCORE_BACK</span><span class="special">(</span> <span class="special">\</span>
<span class="identifier">BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_BIND_REMOVE_FRONT</span><span class="special">(</span> <span class="special">\</span>
<span class="identifier">BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_CONST_REMOVE_FRONT</span><span class="special">(</span> <span class="special">\</span>
<span class="identifier">tokens</span> <span class="special">\</span>
<span class="special">)))</span>
-<span class="identifier">BOOST_AUTO_TEST_CASE</span><span class="special">(</span> <span class="identifier">example_impl_pp_keyword</span> <span class="special">)</span> <span class="special">{</span>
- <span class="identifier">BOOST_CHECK</span><span class="special">(</span> <span class="identifier">HAS_THIS_</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">bind</span> <span class="identifier">this_</span><span class="special">)</span> <span class="special">==</span> <span class="number">1</span> <span class="special">);</span>
- <span class="identifier">BOOST_CHECK</span><span class="special">(</span> <span class="identifier">HAS_THIS_</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">bind</span><span class="special">&</span> <span class="identifier">x</span><span class="special">)</span> <span class="special">==</span> <span class="number">0</span> <span class="special">);</span>
-<span class="special">}</span>
-</pre>
-<p>
- </p>
-<h6>
-<a name="boost_localfunction.Implementation.h2"></a>
- <span><a name="boost_localfunction.Implementation.local_functions"></a></span><a class="link" href="Implementation.html#boost_localfunction.Implementation.local_functions">Local
- Functions</a>
- </h6>
-<p>
- The local function macros expand to code equivalent to the following:
- </p>
-<p>
-</p>
-<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">function</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
-<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span>
-<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">sstream</span><span class="special">></span>
-<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">algorithm</span><span class="special">></span>
-<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">vector</span><span class="special">></span>
-<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">string</span><span class="special">></span>
-
-<span class="keyword">struct</span> <span class="identifier">calculator</span> <span class="special">{</span>
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostringstream</span> <span class="identifier">output</span><span class="special">;</span>
-
- <span class="keyword">void</span> <span class="identifier">factorials</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">int</span><span class="special">>&</span> <span class="identifier">nums</span><span class="special">,</span>
- <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&</span> <span class="identifier">separator</span> <span class="special">=</span> <span class="string">" "</span><span class="special">)</span> <span class="special">{</span>
-
- <span class="keyword">int</span> <span class="comment">// The local function result type (just before the `BOOST_LOCAL_FUNCTION_PARAMS` macro).</span>
-
- <span class="comment">// *BEGIN* The macro</span>
- <span class="comment">// BOOST_LOCAL_FUNCTION_PARAMS( (int n) (bool recursion)(default false)</span>
- <span class="comment">// (const bind& separator) (bind this) )</span>
- <span class="comment">// expands (at line 21) to:</span>
-
- <span class="comment">// DEDUCE RESULT TYPE</span>
- <span class="comment">// Long name `ERROR_...` gives meaningful compiler-error message if programmers forget result type before the macro. </span>
- <span class="special">(*</span><span class="identifier">ERROR_missing_result_type_before_the_local_function_parameter_macro_id21</span><span class="special">)();</span>
- <span class="comment">// Use Boost.ScopeExit type deduction technique (tagging, wrapping, struct, etc) so to work on all compilers (specifically, some GCC version give internal errors otherwise).</span>
- <span class="keyword">typedef</span> <span class="keyword">void</span> <span class="special">(*</span><span class="identifier">boost_local_auxXdeduce_result_tag21</span><span class="special">)(</span> <span class="keyword">int</span> <span class="identifier">ERROR_missing_result_type_before_the_local_function_parameter_macro_id21</span><span class="special">);</span>
- <span class="keyword">typedef</span> <span class="identifier">BOOST_TYPEOF</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">scope_exit</span><span class="special">::</span><span class="identifier">aux</span><span class="special">::</span><span class="identifier">wrap</span><span class="special">(</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">scope_exit</span><span class="special">::</span><span class="identifier">aux</span><span class="special">::</span><span class="identifier">deref</span><span class="special">(</span> <span class="identifier">ERROR_missing_result_type_before_the_local_function_parameter_macro_id21</span><span class="special">,</span> <span class="special">(</span><span class="identifier">boost_local_auxXdeduce_result_tag21</span><span class="special">)</span><span class="number">0</span><span class="special">)))</span> <span class="identifier">boost
_local_auxXdeduce_result_wrap21</span><span class="special">;</span>
- <span class="keyword">typedef</span> <span class="identifier">boost_local_auxXdeduce_result_wrap21</span><span class="special">::</span><span class="identifier">type</span> <span class="identifier">boost_local_auxXdeduce_result_capture21</span><span class="special">;</span>
- <span class="keyword">struct</span> <span class="identifier">boost_local_auxXdeduce_result_params21</span> <span class="special">{</span>
- <span class="keyword">typedef</span> <span class="identifier">boost_local_auxXdeduce_result_capture21</span> <span class="identifier">function_ptr_type</span><span class="special">;</span>
- <span class="special">};</span>
- <span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">remove_pointer</span><span class="special"><</span> <span class="identifier">boost_local_auxXdeduce_result_params21</span><span class="special">::</span><span class="identifier">function_ptr_type</span> <span class="special">>::</span><span class="identifier">type</span> <span class="identifier">boost_local_auxXdeduce_result_function_type21</span><span class="special">;</span>
- <span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_traits</span><span class="special"><</span> <span class="identifier">boost_local_auxXdeduce_result_function_type21</span><span class="special">>::</span><span class="identifier">result_type</span> <span class="identifier">boost_local_auxXresult_type21</span><span class="special">;</span>
-
- <span class="comment">// HANDLE BOUND PARAMETERS</span>
- <span class="comment">// Deduce object `this` type (using technique from Boost.ScopeExit patch to support `this`).</span>
-<span class="preprocessor">#if</span> <span class="identifier">BOOST_WORKAROUND</span><span class="special">(</span><span class="identifier">BOOST_MSVC</span><span class="special">,>=</span><span class="number">1300</span><span class="special">)</span>
- <span class="keyword">enum</span> <span class="special">{</span> <span class="identifier">boost_se_thistype_index_21</span> <span class="special">=</span> <span class="keyword">sizeof</span><span class="special">(*</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">scope_exit</span><span class="special">::</span><span class="identifier">msvc_typeof_this</span><span class="special">::</span><span class="identifier">encode_start</span><span class="special">(</span><span class="keyword">this</span><span class="special">))</span> <span class="special">};</span>
- <span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">scope_exit</span><span class="special">::</span><span class="identifier">msvc_typeof_this</span><span class="special">::</span><span class="identifier">msvc_typeid_wrapper</span><span class="special"><</span><span class="identifier">boost_se_thistype_index_21</span><span class="special">>::</span><span class="identifier">type</span> <span class="identifier">se_this_type21</span><span class="special">;</span>
-<span class="preprocessor">#else</span>
- <span class="keyword">typedef</span> <span class="identifier">BOOST_TYPEOF</span><span class="special">(</span><span class="keyword">this</span><span class="special">)</span> <span class="identifier">se_this_type21</span><span class="special">;</span>
-<span class="preprocessor">#endif</span>
- <span class="comment">// Deduce other `& separator` type (using Boost.ScopeExit techniques).</span>
- <span class="keyword">typedef</span> <span class="keyword">void</span> <span class="special">(*</span><span class="identifier">boost_se_tag_0_21</span><span class="special">)(</span><span class="keyword">int</span> <span class="special">&</span> <span class="identifier">separator</span><span class="special">);</span>
- <span class="keyword">typedef</span> <span class="identifier">BOOST_TYPEOF</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">scope_exit</span><span class="special">::</span><span class="identifier">aux</span><span class="special">::</span><span class="identifier">wrap</span><span class="special">(</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">scope_exit</span><span class="special">::</span><span class="identifier">aux</span><span class="special">::</span><span class="identifier">deref</span><span class="special">(&</span> <span class="identifier">separator</span><span class="special">,</span> <span class="special">(</span><span class="identifier">boost_se_tag_0_21</span><span class="special">)</span><span class="number">0</span><span class="special">)))</span> <span class="identifier">boost_se_wrapped_t_0_21</span><span class="special">;</span>
- <span class="keyword">typedef</span> <span class="identifier">boost_se_wrapped_t_0_21</span><span class="special">::</span><span class="identifier">type</span> <span class="identifier">boost_se_capture_t_0_21</span><span class="special">;</span>
- <span class="comment">// Store bound parameter values and references.</span>
- <span class="keyword">struct</span> <span class="identifier">boost_se_params_t_21</span> <span class="special">{</span>
- <span class="identifier">se_this_type21</span> <span class="identifier">se_this</span><span class="special">;</span>
- <span class="keyword">typedef</span> <span class="identifier">boost_se_capture_t_0_21</span> <span class="identifier">boost_se_param_t_0_21</span><span class="special">;</span>
- <span class="identifier">boost</span><span class="special">::</span><span class="identifier">scope_exit</span><span class="special">::</span><span class="identifier">aux</span><span class="special">::</span><span class="identifier">member</span><span class="special"><</span> <span class="identifier">boost_se_param_t_0_21</span><span class="special">,</span> <span class="identifier">boost_se_tag_0_21</span> <span class="special">></span> <span class="identifier">boost_se_param_0_21</span><span class="special">;</span>
- <span class="special">}</span> <span class="identifier">boost_local_auxXparams21</span> <span class="special">=</span> <span class="special">{</span>
- <span class="keyword">this</span> <span class="special">,</span>
-<span class="preprocessor">#ifdef</span> <span class="identifier">BOOST_SCOPE_EXIT_AUX_TPL_WORKAROUND</span>
- <span class="special">{</span>
-<span class="preprocessor">#endif</span>
- <span class="identifier">boost</span><span class="special">::</span><span class="identifier">scope_exit</span><span class="special">::</span><span class="identifier">aux</span><span class="special">::</span><span class="identifier">deref</span><span class="special">(&</span> <span class="identifier">separator</span><span class="special">,</span> <span class="special">(</span><span class="identifier">boost_se_tag_0_21</span><span class="special">)</span><span class="number">0</span><span class="special">)</span>
-<span class="preprocessor">#ifdef</span> <span class="identifier">BOOST_SCOPE_EXIT_AUX_TPL_WORKAROUND</span>
- <span class="special">}</span>
-<span class="preprocessor">#endif</span>
- <span class="special">};</span>
- <span class="comment">// Use variable name `...args` without line number to hold bound parameter values (so the same variable name can be used by the `NAME` macro even if it expands on a different line number).</span>
- <span class="comment">// The `declared<>` template makes sure that the variable `...args` is not declared multiple times in the same context (if the variable is already declared, this template expand to a no-operation).</span>
- <span class="identifier">boost</span><span class="special">::</span><span class="identifier">scope_exit</span><span class="special">::</span><span class="identifier">aux</span><span class="special">::</span><span class="identifier">declared</span><span class="special"><</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">scope_exit</span><span class="special">::</span><span class="identifier">aux</span><span class="special">::</span><span class="identifier">resolve</span><span class="special"><</span> <span class="keyword">sizeof</span><span class="special">(</span><span class="identifier">boost_local_auxXargs</span><span class="special">)</span> <span class="special">>::</span><span class="identifier">cmp1</span><span class="special"><</span><span class="number">0</span><span class="special">>::</span><span class="identifier">cmp2</span> <span class="special">></span> <span class="identifier">boost_local_auxXargs</span><span class="s
pecial">;</span>
- <span class="identifier">boost_local_auxXargs</span><span class="special">.</span><span class="identifier">value</span> <span class="special">=</span> <span class="special">&</span><span class="identifier">boost_local_auxXparams21</span><span class="special">;</span>
-
- <span class="comment">// LOCAL FUNCTOR</span>
- <span class="keyword">class</span> <span class="identifier">boost_local_auxXfunctor21</span> <span class="special">{</span>
- <span class="keyword">typedef</span> <span class="identifier">boost_local_auxXresult_type21</span> <span class="special">(</span><span class="identifier">boost_local_auxXfunction_type</span><span class="special">)</span> <span class="special">(</span> <span class="keyword">int</span> <span class="identifier">n</span> <span class="special">,</span> <span class="keyword">bool</span> <span class="identifier">recursion</span> <span class="special">);</span>
- <span class="keyword">typedef</span> <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">local</span><span class="special">::</span><span class="identifier">aux</span><span class="special">::</span><span class="identifier">function</span><span class="special"><</span> <span class="identifier">boost_local_auxXfunction_type</span><span class="special">,</span> <span class="number">1</span> <span class="special">></span> <span class="identifier">boost_local_auxXfunctor_type</span><span class="special">;</span>
- <span class="keyword">typedef</span> <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">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">separatorXboost_local_auxXtypeof_type</span> <span class="special">;</span>
- <span class="keyword">typedef</span> <span class="identifier">se_this_type21</span> <span class="identifier">thisXboost_local_auxXtypeof_type</span> <span class="special">;</span>
- <span class="keyword">public</span><span class="special">:</span>
- <span class="comment">// Take a generic pointer so it can be invoked by the `NAME` macro even if it expands on a different line number. </span>
- <span class="keyword">inline</span> <span class="keyword">explicit</span> <span class="identifier">boost_local_auxXfunctor21</span><span class="special">(</span> <span class="keyword">void</span><span class="special">*</span> <span class="identifier">bindings</span><span class="special">)</span> <span class="special">:</span>
- <span class="identifier">boost_local_auxXbind_this</span><span class="special">(</span> <span class="keyword">static_cast</span><span class="special"><</span> <span class="identifier">boost_se_params_t_21</span><span class="special">*</span> <span class="special">>(</span> <span class="identifier">bindings</span><span class="special">)-></span> <span class="identifier">se_this</span> <span class="special">)</span>
- <span class="special">,</span> <span class="identifier">boost_local_auxXbind0</span> <span class="special">(</span> <span class="keyword">static_cast</span><span class="special"><</span> <span class="identifier">boost_se_params_t_21</span><span class="special">*</span> <span class="special">>(</span> <span class="identifier">bindings</span><span class="special">)-></span> <span class="identifier">boost_se_param_0_21</span><span class="special">.</span><span class="identifier">value</span> <span class="special">)</span>
- <span class="special">{</span> <span class="special">}</span>
-
- <span class="comment">// Implement `operator()` for all parameters and any combination of default parameter.</span>
- <span class="keyword">inline</span> <span class="identifier">boost_local_auxXresult_type21</span> <span class="keyword">operator</span><span class="special">()(</span>
- <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">call_traits</span><span class="special"><</span> <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_traits</span><span class="special"><</span> <span class="identifier">boost_local_auxXfunction_type</span><span class="special">>::</span><span class="identifier">arg1_type</span><span class="special">>::</span><span class="identifier">param_type</span> <span class="identifier">arg1</span>
- <span class="special">,</span> <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">call_traits</span><span class="special"><</span> <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_traits</span><span class="special"><</span> <span class="identifier">boost_local_auxXfunction_type</span><span class="special">>::</span><span class="identifier">arg2_type</span><span class="special">>::</span><span class="identifier">param_type</span> <span class="identifier">arg2</span>
- <span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span>
- <span class="keyword">return</span> <span class="identifier">boost_local_auxXbody</span><span class="special">(</span> <span class="identifier">boost_local_auxXbind0</span> <span class="special">,</span> <span class="identifier">boost_local_auxXbind_this</span> <span class="special">,</span> <span class="identifier">arg1</span> <span class="special">,</span> <span class="identifier">arg2</span> <span class="special">);</span>
- <span class="special">}</span>
- <span class="keyword">inline</span> <span class="identifier">boost_local_auxXresult_type21</span> <span class="keyword">operator</span><span class="special">()(</span>
- <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">call_traits</span><span class="special"><</span> <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_traits</span><span class="special"><</span> <span class="identifier">boost_local_auxXfunction_type</span><span class="special">>::</span><span class="identifier">arg1_type</span><span class="special">>::</span><span class="identifier">param_type</span> <span class="identifier">arg1</span>
- <span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span>
- <span class="keyword">return</span> <span class="identifier">boost_local_auxXbody</span><span class="special">(</span> <span class="identifier">boost_local_auxXbind0</span> <span class="special">,</span> <span class="identifier">boost_local_auxXbind_this</span> <span class="special">,</span> <span class="identifier">arg1</span> <span class="special">);</span>
- <span class="special">}</span>
-
- <span class="comment">// "Casting functor trick" to pass this local class as template parameter.</span>
- <span class="keyword">inline</span> <span class="keyword">static</span> <span class="identifier">boost_local_auxXresult_type21</span> <span class="identifier">boost_local_auxXcall0</span><span class="special">(</span>
- <span class="keyword">void</span><span class="special">*</span> <span class="identifier">object</span>
- <span class="special">,</span> <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">call_traits</span><span class="special"><</span> <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_traits</span><span class="special"><</span> <span class="identifier">boost_local_auxXfunction_type</span><span class="special">>::</span><span class="identifier">arg1_type</span><span class="special">>::</span><span class="identifier">param_type</span> <span class="identifier">arg1</span>
- <span class="special">,</span> <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">call_traits</span><span class="special"><</span> <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_traits</span><span class="special"><</span> <span class="identifier">boost_local_auxXfunction_type</span><span class="special">>::</span><span class="identifier">arg2_type</span><span class="special">>::</span><span class="identifier">param_type</span> <span class="identifier">arg2</span>
- <span class="special">)</span> <span class="special">{</span>
- <span class="keyword">return</span> <span class="keyword">static_cast</span><span class="special"><</span> <span class="identifier">boost_local_auxXfunctor21</span><span class="special">*</span> <span class="special">>(</span> <span class="identifier">object</span><span class="special">)-></span><span class="keyword">operator</span><span class="special">()(</span> <span class="identifier">arg1</span> <span class="special">,</span> <span class="identifier">arg2</span> <span class="special">);</span>
- <span class="special">}</span>
- <span class="keyword">inline</span> <span class="keyword">static</span> <span class="identifier">boost_local_auxXresult_type21</span> <span class="identifier">boost_local_auxXcall1</span><span class="special">(</span>
- <span class="keyword">void</span><span class="special">*</span> <span class="identifier">object</span>
- <span class="special">,</span> <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">call_traits</span><span class="special"><</span> <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_traits</span><span class="special"><</span> <span class="identifier">boost_local_auxXfunction_type</span><span class="special">>::</span><span class="identifier">arg1_type</span><span class="special">>::</span><span class="identifier">param_type</span> <span class="identifier">arg1</span>
- <span class="special">)</span> <span class="special">{</span>
- <span class="keyword">return</span> <span class="keyword">static_cast</span><span class="special"><</span> <span class="identifier">boost_local_auxXfunctor21</span><span class="special">*</span> <span class="special">>(</span> <span class="identifier">object</span><span class="special">)-></span><span class="keyword">operator</span><span class="special">()(</span> <span class="identifier">arg1</span> <span class="special">);</span>
- <span class="special">}</span>
- <span class="keyword">inline</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="identifier">boost_local_auxXinit_call</span><span class="special">(</span> <span class="keyword">void</span><span class="special">*</span> <span class="identifier">object</span><span class="special">,</span> <span class="identifier">boost_local_auxXfunctor_type</span><span class="special">&</span> <span class="identifier">functor</span><span class="special">)</span> <span class="special">{</span>
- <span class="identifier">functor</span><span class="special">.</span><span class="identifier">boost_local_auxXinit_call</span><span class="special">(</span><span class="identifier">object</span><span class="special">,</span> <span class="special">&</span><span class="identifier">boost_local_auxXcall0</span> <span class="special">,</span> <span class="special">&</span><span class="identifier">boost_local_auxXcall1</span> <span class="special">);</span>
- <span class="special">}</span>
-
- <span class="keyword">private</span><span class="special">:</span>
- <span class="comment">// Hold bound variables (by value and reference).</span>
- <span class="identifier">se_this_type21</span> <span class="special">&</span> <span class="identifier">boost_local_auxXbind_this</span> <span class="special">;</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">boost_local_auxXbind0</span> <span class="special">;</span>
- <span class="comment">// This same declaration is first made at global scope in one of the library header files. This declaration needs to be repeated here so it is also visible from within the local function body to allow for nesting local function into one another.</span>
- <span class="identifier">boost</span><span class="special">::</span><span class="identifier">scope_exit</span><span class="special">::</span><span class="identifier">aux</span><span class="special">::</span><span class="identifier">undeclared</span> <span class="identifier">boost_local_auxXargs</span><span class="special">;</span>
-
- <span class="comment">// The local function body.</span>
- <span class="keyword">inline</span> <span class="identifier">boost_local_auxXresult_type21</span> <span class="identifier">boost_local_auxXbody</span><span class="special">(</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="keyword">const</span> <span class="identifier">this_</span> <span class="comment">// Use special name `this_` instead of `this` here.</span>
- <span class="comment">// Specify default parameter values here.</span>
- <span class="special">,</span> <span class="keyword">int</span> <span class="identifier">n</span> <span class="special">,</span> <span class="keyword">bool</span> <span class="identifier">recursion</span> <span class="special">=</span> <span class="keyword">false</span>
- <span class="special">)</span> <span class="keyword">const</span>
-
- <span class="comment">// *END* The expansion of `BOOST_LOCAL_FUNCTION_PARAMS` ends here.</span>
-
- <span class="comment">// *BEGIN* The local function body code `{ ... }` as specified by the programmers:</span>
-
- <span class="special">{</span>
-
- <span class="keyword">int</span> <span class="identifier">result</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
-
- <span class="keyword">if</span> <span class="special">(</span><span class="identifier">n</span> <span class="special"><</span> <span class="number">2</span> <span class="special">)</span> <span class="identifier">result</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span>
- <span class="keyword">else</span> <span class="identifier">result</span> <span class="special">=</span> <span class="identifier">n</span> <span class="special">*</span> <span class="identifier">factorial</span><span class="special">(</span><span class="identifier">n</span> <span class="special">-</span> <span class="number">1</span><span class="special">,</span> <span class="keyword">true</span><span class="special">);</span> <span class="comment">// Recursive call.</span>
-
- <span class="keyword">if</span> <span class="special">(!</span><span class="identifier">recursion</span><span class="special">)</span> <span class="identifier">this_</span><span class="special">-></span><span class="identifier">output</span> <span class="special"><<</span> <span class="identifier">result</span> <span class="special"><<</span> <span class="identifier">separator</span><span class="special">;</span>
- <span class="keyword">return</span> <span class="identifier">result</span><span class="special">;</span>
- <span class="special">}</span>
-
- <span class="comment">// *END* The local function body `{ ... }` ends here.</span>
-
- <span class="comment">// *BEGIN* The macro `BOOST_LOCAL_FUNCTION_NAME(recursive factorial)` expands to:</span>
-
- <span class="keyword">public</span><span class="special">:</span>
- <span class="comment">// Member variable named after the local function so the body can recursively call the local function (this must be defined here because the local function name was not known before). This must be public because it is also used to deduce the local function functor type later when when declaring the actual local function object.</span>
- <span class="identifier">boost_local_auxXfunctor_type</span> <span class="identifier">factorial</span><span class="special">;</span>
- <span class="comment">// Initializes the local functor member variable (this cannot be done directly within the constructor because the local function name is not known when the constructor code is expanded by the `PARAMS` macro).</span>
- <span class="keyword">inline</span> <span class="keyword">void</span> <span class="identifier">boost_local_auxXinit_recursion</span><span class="special">(</span> <span class="identifier">boost_local_auxXfunctor_type</span><span class="special">&</span> <span class="identifier">functor</span><span class="special">)</span> <span class="special">{</span>
- <span class="identifier">factorial</span> <span class="special">=</span> <span class="identifier">functor</span><span class="special">;</span>
- <span class="special">}</span>
- <span class="comment">// Declare the local class object -- which cannot be passed as template parameter (because it is a local class). It uses the variable with the generic `...args` name to pass the bound parameter values and references (so this variable name must not contain the line number because it is used by different macros expanding on different lines).</span>
- <span class="special">}</span> <span class="identifier">boost_local_auxXfactorial</span><span class="special">(</span><span class="identifier">boost_local_auxXargs</span><span class="special">.</span><span class="identifier">value</span><span class="special">);</span>
- <span class="comment">// Declare the actual local function object with the local function name -- which can be passed as template parameter (because it is a `boost::local::function` functor and not a local class).</span>
- <span class="identifier">BOOST_TYPEOF</span><span class="special">(</span><span class="identifier">boost_local_auxXfactorial</span><span class="special">.</span> <span class="identifier">factorial</span><span class="special">)</span> <span class="identifier">factorial</span><span class="special">;</span>
- <span class="comment">// Initializes casting functor to pass local function as template parameter.</span>
- <span class="identifier">boost_local_auxXfactorial</span><span class="special">.</span><span class="identifier">boost_local_auxXinit_call</span><span class="special">(</span> <span class="special">&</span><span class="identifier">boost_local_auxXfactorial</span><span class="special">,</span> <span class="identifier">factorial</span><span class="special">);</span>
- <span class="comment">// Initializes functor for recursion.</span>
- <span class="identifier">boost_local_auxXfactorial</span><span class="special">.</span><span class="identifier">boost_local_auxXinit_recursion</span><span class="special">(</span> <span class="identifier">factorial</span><span class="special">);</span>
-
- <span class="comment">// *END* The expansion of `BOOST_LOCAL_FUNCTION_NAME` ends here.</span>
-
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">for_each</span><span class="special">(</span><span class="identifier">nums</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">nums</span><span class="special">.</span><span class="identifier">end</span><span class="special">(),</span> <span class="identifier">factorial</span><span class="special">);</span>
- <span class="special">}</span>
-<span class="special">};</span>
-
-<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span> <span class="special">{</span>
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">int</span><span class="special">></span> <span class="identifier">v</span><span class="special">(</span><span class="number">3</span><span class="special">);</span>
- <span class="identifier">v</span><span class="special">[</span><span class="number">0</span><span class="special">]</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> <span class="identifier">v</span><span class="special">[</span><span class="number">1</span><span class="special">]</span> <span class="special">=</span> <span class="number">4</span><span class="special">;</span> <span class="identifier">v</span><span class="special">[</span><span class="number">2</span><span class="special">]</span> <span class="special">=</span> <span class="number">7</span><span class="special">;</span>
-
- <span class="identifier">calculator</span> <span class="identifier">calc</span><span class="special">;</span>
- <span class="identifier">calc</span><span class="special">.</span><span class="identifier">factorials</span><span class="special">(</span><span class="identifier">v</span><span class="special">);</span>
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">calc</span><span class="special">.</span><span class="identifier">output</span><span class="special">.</span><span class="identifier">str</span><span class="special">()</span> <span class="special"><<</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="identifier">BOOST_AUTO_TEST_CASE</span><span class="special">(</span> <span class="identifier">test_impl_pp_keyword</span> <span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">BOOST_CHECK</span><span class="special">(</span> <span class="identifier">IS_THIS_BACK</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">bind</span> <span class="identifier">this_</span><span class="special">)</span> <span class="special">==</span> <span class="number">1</span> <span class="special">);</span>
+ <span class="identifier">BOOST_CHECK</span><span class="special">(</span> <span class="identifier">IS_THIS_BACK</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">bind</span><span class="special">&</span> <span class="identifier">x</span><span class="special">)</span> <span class="special">==</span> <span class="number">0</span> <span class="special">);</span>
<span class="special">}</span>
</pre>
<p>
@@ -402,7 +215,7 @@
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2009-2012 Lorenzo
Caminiti<p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
+ 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)
</p>
</div></td>
Modified: sandbox/local_function/libs/local_function/doc/html/boost_localfunction/No_Variadic_Macros.html
==============================================================================
--- sandbox/local_function/libs/local_function/doc/html/boost_localfunction/No_Variadic_Macros.html (original)
+++ sandbox/local_function/libs/local_function/doc/html/boost_localfunction/No_Variadic_Macros.html 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -40,7 +40,7 @@
macros</a> (notably, these include GCC, MSVC, and all C++11
compilers). However, in the rare case that programmers need to use this library
on a compiler without variadic macros, this library also allows to specify
- its macro parameters using a Boost.Preprocessor
+ its macro parameters using a Boost.Preprocessor
sequence where tokens are separated by round parenthesis <code class="computeroutput"><span class="special">()</span></code>:
</p>
<pre class="programlisting"><span class="special">(</span><span class="identifier">token1</span><span class="special">)</span> <span class="special">(</span><span class="identifier">token2</span><span class="special">)</span> <span class="special">...</span> <span class="comment">// All compilers.</span>
@@ -53,26 +53,29 @@
</pre>
<p>
For example, the following syntax is accepted on all compilers with and without
- variadic macros (see also "add_seq.cpp"
):
+ variadic macros (see also add_seq.cpp
):
</p>
<p>
</p>
-<pre class="programlisting"><span class="keyword">int</span> <span class="identifier">sum</span> <span class="special">=</span> <span class="number">0</span><span class="special">,</span> <span class="identifier">factor</span> <span class="special">=</span> <span class="number">10</span><span class="special">;</span> <span class="comment">// Variables in scope to bind.</span>
+<pre class="programlisting"><span class="special">{</span> <span class="comment">// Some local scope.</span>
+ <span class="keyword">int</span> <span class="identifier">sum</span> <span class="special">=</span> <span class="number">0</span><span class="special">,</span> <span class="identifier">factor</span> <span class="special">=</span> <span class="number">10</span><span class="special">;</span> <span class="comment">// Variables in scope to bind.</span>
-<span class="keyword">void</span> <span class="identifier">BOOST_LOCAL_FUNCTION</span><span class="special">(</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">bind</span> <span class="identifier">factor</span><span class="special">)</span> <span class="special">(</span><span class="identifier">bind</span><span class="special">&</span> <span class="identifier">sum</span><span class="special">)</span> <span class="special">(</span><span class="keyword">int</span> <span class="identifier">num</span><span class="special">)</span> <span class="special">)</span> <span class="special">{</span>
- <span class="identifier">sum</span> <span class="special">+=</span> <span class="identifier">factor</span> <span class="special">*</span> <span class="identifier">num</span><span class="special">;</span>
-<span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">add</span><span class="special">)</span>
+ <span class="keyword">void</span> <span class="identifier">BOOST_LOCAL_FUNCTION</span><span class="special">(</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">bind</span> <span class="identifier">factor</span><span class="special">)</span> <span class="special">(</span><span class="identifier">bind</span><span class="special">&</span> <span class="identifier">sum</span><span class="special">)</span> <span class="special">(</span><span class="keyword">int</span> <span class="identifier">num</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="comment">// Parameters as sequence.</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">1</span><span class="special">);</span> <span class="comment">// Call the local function (with one parameter `num`).</span>
+ <span class="identifier">add</span><span class="special">(</span><span class="number">1</span><span class="special">);</span> <span class="comment">// Call the local function.</span>
+ <span class="keyword">int</span> <span class="identifier">nums</span><span class="special">[]</span> <span class="special">=</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">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">2</span><span class="special">,</span> <span class="identifier">add</span><span class="special">);</span> <span class="comment">// Pass it to an algorithm.</span>
-<span class="keyword">int</span> <span class="identifier">nums</span><span class="special">[]</span> <span class="special">=</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">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">2</span><span class="special">,</span> <span class="identifier">add</span><span class="special">);</span> <span class="comment">// Pass it to an algorithm.</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> <span class="comment">// Assert final summation value.</span>
+<span class="special">}</span>
</pre>
<p>
</p>
<p>
However, on compilers with variadic macros the comma-separated syntax we have
- seen so far is preferred because more readable (see also "add.cpp"
):
+ seen so far is preferred because more readable (see also add.cpp
):
</p>
<p>
</p>
@@ -95,8 +98,18 @@
<p>
Note how the same macros accept both syntaxes on compilers with variadic macros
and only the sequence syntax on compilers without variadic macros. Finally,
- an empty list is always specified using <code class="computeroutput"><span class="keyword">void</span></code>
- on compilers with and without variadic macros.
+ an parameter list is always specified using <code class="computeroutput"><span class="keyword">void</span></code>
+ on compilers with and without variadic macros:
+ </p>
+<p>
+</p>
+<pre class="programlisting"><span class="keyword">int</span> <span class="identifier">BOOST_LOCAL_FUNCTION</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">{</span> <span class="comment">// No parameter.</span>
+ <span class="keyword">return</span> <span class="number">10</span><span class="special">;</span>
+<span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">ten</span><span class="special">)</span>
+
+<span class="identifier">BOOST_CHECK</span><span class="special">(</span> <span class="identifier">ten</span><span class="special">()</span> <span class="special">==</span> <span class="number">10</span> <span class="special">);</span>
+</pre>
+<p>
</p>
<h6>
<a name="boost_localfunction.No_Variadic_Macros.h1"></a>
@@ -104,8 +117,8 @@
Example</a>
</h6>
<p>
- The following is an example that shows a bit of all the different macro parameter
- combinations using the sequence syntax (see also "seq.cpp"
):
+ The following example shows a bit of all the different macro parameter combinations
+ using the sequence syntax (see also seq.cpp
):
</p>
<p>
</p>
@@ -266,7 +279,7 @@
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2009-2012 Lorenzo
Caminiti<p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
+ 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)
</p>
</div></td>
Modified: sandbox/local_function/libs/local_function/doc/html/boost_localfunction/Release_Notes.html
==============================================================================
--- sandbox/local_function/libs/local_function/doc/html/boost_localfunction/Release_Notes.html (original)
+++ sandbox/local_function/libs/local_function/doc/html/boost_localfunction/Release_Notes.html 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -35,9 +35,37 @@
<span><a name="boost_localfunction.Release_Notes.version_1_0_0__2012_01_31_"></a></span><a class="link" href="Release_Notes.html#boost_localfunction.Release_Notes.version_1_0_0__2012_01_31_">Version
1.0.0 (2012-01-31)</a>
</h6>
-<p>
- @todo do this
- </p>
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem">
+ Incorporated all comments from the <a href="http://lists.boost.org/boost-announce/2011/12/0340.php" target="_top">Boost
+ review of this library</a>.
+ </li>
+<li class="listitem">
+ Removed local blocks and local exits.
+ </li>
+<li class="listitem">
+ Renamed the library from Boost.Local to Boost.LocalFunction.
+ </li>
+<li class="listitem">
+ Using <code class="computeroutput"><span class="identifier">this_</span></code> instead of
+ <code class="computeroutput"><span class="keyword">this</span></code> also in the local function
+ declaration (not just the body).
+ </li>
+<li class="listitem">
+ Made changes that allow to return local functions (similar to closures).
+ </li>
+<li class="listitem">
+ Added GCC lambda and constant block examples.
+ </li>
+<li class="listitem">
+ Moved <code class="computeroutput"><span class="identifier">overloaded_function</span></code>
+ to Boost.Functional/OverloadedFunction.
+ </li>
+<li class="listitem">
+ Moved <code class="computeroutput"><span class="identifier">BOOST_IDENTITY_TYPE</span></code>
+ to Boost.Utility/IdentityType.
+ </li>
+</ol></div>
<h6>
<a name="boost_localfunction.Release_Notes.h1"></a>
<span><a name="boost_localfunction.Release_Notes.version_0_2_0__2011_05_14_"></a></span><a class="link" href="Release_Notes.html#boost_localfunction.Release_Notes.version_0_2_0__2011_05_14_">Version
@@ -116,7 +144,7 @@
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2009-2012 Lorenzo
Caminiti<p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
+ 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)
</p>
</div></td>
Modified: sandbox/local_function/libs/local_function/doc/html/boost_localfunction/Tutorial.html
==============================================================================
--- sandbox/local_function/libs/local_function/doc/html/boost_localfunction/Tutorial.html (original)
+++ sandbox/local_function/libs/local_function/doc/html/boost_localfunction/Tutorial.html 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -44,9 +44,9 @@
Local functions are defined using macros from the header file <code class="computeroutput"><a class="link" href="../reference.html#header.boost.local_function_hpp" title="Header <boost/local_function.hpp>">boost/local_function.hpp</a></code>. The
macros must be used from within a declarative context (this is a limitation
with respect to <a href="http://en.wikipedia.org/wiki/C%2B%2B0x#Lambda_functions_and_expressions" target="_top">C++11
- lambda</a> functions which can instead be declared within expressions):
+ lambda</a> functions which can instead be declared also within expressions):
</p>
-<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local_function</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> <span class="comment">// Include library header.</span>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local_function</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> <span class="comment">// This library header.</span>
<span class="special">...</span>
<span class="special">{</span> <span class="comment">// Some declarative context.</span>
@@ -98,8 +98,8 @@
</p>
<p>
If the local function has no parameter, it is possible to pass <code class="computeroutput"><span class="keyword">void</span></code> to the <code class="computeroutput"><a class="link" href="../BOOST_LOCAL_FUNCTION.html" title="Macro BOOST_LOCAL_FUNCTION">BOOST_LOCAL_FUNCTION</a></code>
- macro (similarly to the C syntax that allows to use <code class="computeroutput"><span class="keyword">int</span>
- <span class="identifier">f</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span></code> to declare
+ macro (similarly to the C syntax that allows to use <code class="literal"><span class="emphasis"><em>result-type
+ function-name</em></span></code><code class="computeroutput"><span class="special">(</span><span class="keyword">void</span><span class="special">)</span></code> to declare
a function with no parameter): <sup>[<a name="boost_localfunction.Tutorial.local_functions.f2" href="#ftn.boost_localfunction.Tutorial.local_functions.f2" class="footnote">7</a>]</sup>
</p>
<pre class="programlisting"><span class="identifier">BOOST_LOCAL_FUNCTION</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="comment">// No parameter.</span>
@@ -127,8 +127,7 @@
variables, etc) can be bound to a local function declaration. Only bound
variables, static variables, global variables, functions, and enumerations
from the enclosing scope are accessible from within the local function body.
- The types of bound variables are automatically deduced by this library using
- Boost.Typeof.
+ The types of bound variables are deduced automatically by this library.
<sup>[<a name="boost_localfunction.Tutorial.Binding.f0" href="#ftn.boost_localfunction.Tutorial.Binding.f0" class="footnote">8</a>]</sup>
</p>
<div class="important"><table border="0" summary="Important">
@@ -137,13 +136,13 @@
<th align="left">Important</th>
</tr>
<tr><td align="left" valign="top"><p>
- The library implementation uses Boost.Typeof
+ The library implementation uses Boost.Typeof
to automatically deduce the types of the bound variables. Therefore, in
order to compile code in type-of emulation mode, all types should be properly
registered with <code class="computeroutput"><span class="identifier">BOOST_TYPEOF_REGISTER_TYPE</span></code>
or <code class="computeroutput"><span class="identifier">BOOST_TYPEOF_REGISTER_TEMPLATE</span></code>
- macros, or appropriate Boost.Typeof
- headers should be included (see the Boost.Typeof
+ macros, or appropriate Boost.Typeof
+ headers should be included (see the Boost.Typeof
documentation for more detail).
</p></td></tr>
</table></div>
@@ -183,10 +182,11 @@
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. Furthermore, it is the programmers' responsibility
- to ensure that variables bound by reference survive the declaration scope
- of the local function otherwise the bound references will be invalid resulting
- in undefined behaviour (in other words, the usual care in using C++ references
- must be taken for variables bound by reference).
+ to ensure that variables bound by reference survive the existence scope of
+ the local function otherwise the bound references will be invalid when the
+ local function is called resulting in undefined behaviour (in other words,
+ the usual care in using C++ references must be taken for variables bound
+ by reference).
</p>
<p>
The type of a bound variable is automatically deduced and it is the exact
@@ -216,17 +216,18 @@
When a variable is bound by value (constant or not), its type must be <code class="computeroutput"><span class="identifier">CopyConstructible</span></code> (i.e., its must provide
a copy constructor). As with passing parameters to usual C++ functions, programmers
might want to bind variables of complex types by (possibly constant) reference
- instead than by value to avoid expensive copy operations when these variables
+ instead of by value to avoid expensive copy operations when these variables
are bound to a local function.
</p>
<p>
For example, let's program the local function <code class="computeroutput"><span class="identifier">add</span></code>
from the example in the <a class="link" href="../index.html#boost_localfunction.Introduction" title="Introduction">Introduction</a>
section. We bind the local variable <code class="computeroutput"><span class="identifier">factor</span></code>
- by constant value (because its value does not need to be changed), the local
- variable <code class="computeroutput"><span class="identifier">sum</span></code> by non-constant
- reference (because its value needs to be updated with the summation result),
- and program the body to perform the summation (see also add.cpp
):
+ by constant value (because its value should not be modified by the local
+ function), the local variable <code class="computeroutput"><span class="identifier">sum</span></code>
+ by non-constant reference (because its value needs to be updated with the
+ summation result), and program the body to perform the summation (see also
+ add.cpp
):
</p>
<p>
</p>
@@ -256,8 +257,9 @@
It is also possible to bind the object <code class="computeroutput"><span class="keyword">this</span></code>
when it is in scope (e.g., from an enclosing non-static member function).
This is done by using the special symbol <code class="computeroutput"><span class="identifier">this_</span></code>
- (instead of <code class="computeroutput"><span class="keyword">this</span></code>) <sup>[<a name="boost_localfunction.Tutorial.binding_the_object__this_.f0" href="#ftn.boost_localfunction.Tutorial.binding_the_object__this_.f0" class="footnote">13</a>]</sup> as the name of the variable to bind in the local function declaration
- and also to access the object within the local function body.
+ (instead of <code class="computeroutput"><span class="keyword">this</span></code>) as the name
+ of the variable to bind in the local function declaration and also to access
+ the object within the local function body. <sup>[<a name="boost_localfunction.Tutorial.binding_the_object__this_.f0" href="#ftn.boost_localfunction.Tutorial.binding_the_object__this_.f0" class="footnote">13</a>]</sup>
</p>
<div class="warning"><table border="0" summary="Warning">
<tr>
@@ -300,9 +302,9 @@
or <code class="computeroutput"><span class="keyword">const</span> <span class="identifier">bind</span><span class="special">&</span> <span class="identifier">this_</span></code>).
Note that <code class="computeroutput"><span class="keyword">this</span></code> is a pointer
so the pointed object is never copied even if <code class="computeroutput"><span class="keyword">this</span></code>
- is bound by value (also it is not allowed to directly bind <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code> because
+ is bound by value (also it is not possible to directly bind <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code> because
<code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>
- is an expression and not a valid name of a variable in scope).
+ is an expression and not a variable name).
</p>
<p>
For example, let's program a local function <code class="computeroutput"><span class="identifier">add</span></code>
@@ -331,7 +333,7 @@
<p>
</p>
<p>
- As expected, the local function has access to all class members via the bound
+ Note that the local function has access to all class members via the bound
object <code class="computeroutput"><span class="identifier">this_</span></code> regardless of
their access level (<code class="computeroutput"><span class="keyword">public</span></code>,
<code class="computeroutput"><span class="keyword">protected</span></code>, or <code class="computeroutput"><span class="keyword">private</span></code>). <sup>[<a name="boost_localfunction.Tutorial.binding_the_object__this_.f2" href="#ftn.boost_localfunction.Tutorial.binding_the_object__this_.f2" class="footnote">15</a>]</sup> Specifically, in the example above the local function updates
@@ -344,10 +346,10 @@
</h3></div></div></div>
<p>
When local functions are programmed within templates, they need to be declared
- using the special macro <code class="computeroutput"><a class="link" href="../BOOST_LOCAL_FUNCTION_TPL.html" title="Macro BOOST_LOCAL_FUNCTION_TPL">BOOST_LOCAL_FUNCTION_TPL</a></code>
- (see the Reference section): <sup>[<a name="boost_localfunction.Tutorial.templates.f0" href="#ftn.boost_localfunction.Tutorial.templates.f0" class="footnote">16</a>]</sup>
+ using the special macro <code class="computeroutput"><a class="link" href="../BOOST_LOCAL_FUNCTION_TPL.html" title="Macro BOOST_LOCAL_FUNCTION_TPL">BOOST_LOCAL_FUNCTION_TPL</a></code>:
+ <sup>[<a name="boost_localfunction.Tutorial.templates.f0" href="#ftn.boost_localfunction.Tutorial.templates.f0" class="footnote">16</a>]</sup>
</p>
-<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local_function</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local_function</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> <span class="comment">// This library header.</span>
<span class="special">...</span>
<span class="special">{</span> <span class="comment">// Some declarative context within a template.</span>
@@ -366,7 +368,7 @@
<p>
For example, let's program a local function similar to the one from the
<a class="link" href="../index.html#boost_localfunction.Introduction" title="Introduction">Introduction</a> section
- but wrapped within a template (see also add_template.cpp
):
+ but within a template (see also add_template.cpp
):
</p>
<p>
</p>
@@ -380,7 +382,6 @@
<span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">add</span><span class="special">)</span>
<span class="identifier">add</span><span class="special">(</span><span class="identifier">x</span><span class="special">);</span>
-
<span class="identifier">T</span> <span class="identifier">nums</span><span class="special">[</span><span class="number">2</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="special">=</span> <span class="identifier">y</span><span class="special">;</span> <span class="identifier">nums</span><span class="special">[</span><span class="number">1</span><span class="special">]</span> <span class="special">=</span> <span class="identifier">z</span><span class="special">;</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">for_each</span><span class="special">(</span><span class="identifier">nums</span><span class="special">,</span> <span class="identifier">nums</span> <span class="special">+</span> <span class="number">2</span><span class="special">,</span> <span class="identifier">add</span><span class="special">);</span>
@@ -410,9 +411,9 @@
</p></div>
<div class="footnote"><p><sup>[<a id="ftn.boost_localfunction.Tutorial.local_functions.f2" href="#boost_localfunction.Tutorial.local_functions.f2" class="para">7</a>] </sup>
<span class="bold"><strong>Rationale.</strong></span> The C++03
- standard does not allow pass empty parameters to a macro so the macro cannot
- be invoked as <code class="computeroutput"><span class="identifier">BOOST_LOCAL_FUNCTION</span><span class="special">()</span></code>. On C99
- compilers with properly implemented empty macro parameter support it would
+ standard does not allow to pass empty parameters to a macro so the macro
+ cannot be invoked as <code class="computeroutput"><span class="identifier">BOOST_LOCAL_FUNCTION</span><span class="special">()</span></code>. On C99
+ compilers with properly implemented empty macro parameter support, it would
be possible to allow <code class="computeroutput"><span class="identifier">BOOST_LOCAL_FUNCTION</span><span class="special">()</span></code> but this is already not the case for
MSVC so this syntax is never allowed to ensure better portability.
</p></div>
@@ -432,9 +433,9 @@
<div class="footnote"><p><sup>[<a id="ftn.boost_localfunction.Tutorial.Binding.f1" href="#boost_localfunction.Tutorial.Binding.f1" class="para">9</a>] </sup>
Obviously, the token <code class="computeroutput"><span class="identifier">bind</span></code>
is not a keyword of the C++ language. This library parses the token <code class="computeroutput"><span class="identifier">bind</span></code> during macro expansion using preprocessor
- metaprogramming (see the <a class="link" href="Implementation.html" title="Annex: Implementation">Implementation</a>
+ meta-programming (see the <a class="link" href="Implementation.html" title="Annex: Implementation">Implementation</a>
section). Therefore, <code class="computeroutput"><span class="identifier">bind</span></code>
- can be considered a new "keyword" only at the preprocessor metaprogramming
+ can be considered a new "keyword" only at the preprocessor meta-programming
level within the syntax defined by the macros of this library (thus it
is referred to as a "keyword" only within quotes).
</p></div>
@@ -469,7 +470,7 @@
as references are bound by value unless <code class="computeroutput"><span class="special">[</span><span class="keyword">const</span><span class="special">]</span> <span class="identifier">bind</span><span class="special">&</span></code>
is used so that references can be bound by both value <code class="computeroutput"><span class="special">[</span><span class="keyword">const</span><span class="special">]</span> <span class="identifier">bind</span></code>
and reference <code class="computeroutput"><span class="special">[</span><span class="keyword">const</span><span class="special">]</span> <span class="identifier">bind</span><span class="special">&</span></code> (this is the same binding semantic
- adopted by Boost.ScopeExit).
+ adopted by Boost.ScopeExit).
On the other hand, variables originally declared as constants should
never loose their <code class="computeroutput"><span class="keyword">const</span></code>
qualifier (to prevent their modification not just in the enclosing
@@ -510,8 +511,9 @@
</p></div>
<div class="footnote"><p><sup>[<a id="ftn.boost_localfunction.Tutorial.binding_the_object__this_.f2" href="#boost_localfunction.Tutorial.binding_the_object__this_.f2" class="para">15</a>] </sup>
<span class="bold"><strong>Rationale.</strong></span> This is possible because of
- C++ defect fix #46 that made inner and local types able to access all outer
- class members regardless of their access level.
+ the fix to C++ <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#45" target="_top">defect
+ 45</a> that made inner and local types able to access all outer class
+ members regardless of their access level.
</p></div>
<div class="footnote"><p><sup>[<a id="ftn.boost_localfunction.Tutorial.templates.f0" href="#boost_localfunction.Tutorial.templates.f0" class="para">16</a>] </sup>
<span class="bold"><strong>Rationale.</strong></span> Within templates, this library
@@ -529,7 +531,7 @@
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2009-2012 Lorenzo
Caminiti<p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
+ 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)
</p>
</div></td>
Modified: sandbox/local_function/libs/local_function/doc/html/index.html
==============================================================================
--- sandbox/local_function/libs/local_function/doc/html/index.html (original)
+++ sandbox/local_function/libs/local_function/doc/html/index.html 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -29,7 +29,7 @@
Caminiti</p></div>
<div><div class="legalnotice">
<a name="boost_localfunction.legal"></a><p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
+ 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)
</p>
</div></div>
@@ -64,8 +64,8 @@
<dt><span class="section"><a href="boost_localfunction/Advanced_Topics.html#boost_localfunction.Advanced_Topics.assigning_and_returning">Assigning
and Returning</a></span></dt>
<dt><span class="section">Nesting</span></dt>
-<dt><span class="section"><a href="boost_localfunction/Advanced_Topics.html#boost_localfunction.Advanced_Topics.deducing_bound_types__concepts__etc_">Deducing
- Bound Types (concepts, etc)</a></span></dt>
+<dt><span class="section"><a href="boost_localfunction/Advanced_Topics.html#boost_localfunction.Advanced_Topics.accessing_types__concepts__etc_">Accessing
+ Types (concepts, etc)</a></span></dt>
<dt><span class="section"><a href="boost_localfunction/Advanced_Topics.html#boost_localfunction.Advanced_Topics.specifying_types">Specifying
Types</a></span></dt>
<dt><span class="section">Inlining</span></dt>
@@ -116,11 +116,11 @@
</h2></div></div></div>
<p>
<span class="emphasis"><em>Local functions</em></span> are a form of <span class="emphasis"><em>information hiding</em></span>
- and are useful for dividing procedural tasks into subtasks which are only meaningful
- locally, avoiding cluttering other parts of the program with functions, variables,
- etc unrelated to those parts. Local functions therefore complement other structuring
- possibilities such as namespaces and classes. Local functions are a feature
- of many programming languages, notably Pascal
+ and they are useful for dividing procedural tasks into subtasks which are only
+ meaningful locally, avoiding cluttering other parts of the program with functions,
+ variables, etc unrelated to those parts. Local functions therefore complement
+ other structuring possibilities such as namespaces and classes. Local functions
+ are a feature of many programming languages, notably Pascal
and Ada,
yet lacking from C++03
(see also [N2511]).
@@ -189,7 +189,7 @@
</li>
<li class="listitem">
Local functions can be passed as template parameters so they can be conveniently
- passed to STL algorithms, etc. <sup>[<a name="boost_localfunction.Introduction.f0" href="#ftn.boost_localfunction.Introduction.f0" class="footnote">1</a>]</sup>
+ used with STL algorithms, etc. <sup>[<a name="boost_localfunction.Introduction.f0" href="#ftn.boost_localfunction.Introduction.f0" class="footnote">1</a>]</sup>
</li>
<li class="listitem">
However, local functions must be specified within a declarative context
@@ -200,7 +200,7 @@
<p>
See the <a class="link" href="boost_localfunction/Alternatives.html" title="Annex: Alternatives">Alternatives</a>
section for a comparison between this library, <a href="http://en.wikipedia.org/wiki/C%2B%2B0x#Lambda_functions_and_expressions" target="_top">C++11
- lambda</a> functions, Boost.Phoenix,
+ lambda</a> functions, Boost.Phoenix,
and other C++ techniques that implement features related to local functions.
</p>
</div>
@@ -209,20 +209,20 @@
<div class="footnote"><p><sup>[<a id="ftn.boost_localfunction.Introduction.f0" href="#boost_localfunction.Introduction.f0" class="para">1</a>] </sup>
This is a strength with respect to C++03
functors implemented using local classes which cannot be passed as template
- parameters, see [N2657]
+ parameters (see [N2657]
and the <a class="link" href="boost_localfunction/Alternatives.html" title="Annex: Alternatives">Alternatives</a>
- section.
+ section).
</p></div>
<div class="footnote"><p><sup>[<a id="ftn.boost_localfunction.Introduction.f1" href="#boost_localfunction.Introduction.f1" class="para">2</a>] </sup>
This is a weakness with respect to <a href="http://en.wikipedia.org/wiki/C%2B%2B0x#Lambda_functions_and_expressions" target="_top">C++11
- lambda</a> functions which can instead be specified also within expressions,
- see the <a class="link" href="boost_localfunction/Alternatives.html" title="Annex: Alternatives">Alternatives</a>
- section.
+ lambda</a> functions which can instead be specified also within expressions
+ (see the <a class="link" href="boost_localfunction/Alternatives.html" title="Annex: Alternatives">Alternatives</a>
+ section).
</p></div>
</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: January 26, 2012 at 22:13:12 GMT</small></p></td>
+<td align="left"><p><small>Last revised: February 01, 2012 at 00:00:23 GMT</small></p></td>
<td align="right"><div class="copyright-footer"></div></td>
</tr></table>
<hr>
Modified: sandbox/local_function/libs/local_function/doc/html/reference.html
==============================================================================
--- sandbox/local_function/libs/local_function/doc/html/reference.html (original)
+++ sandbox/local_function/libs/local_function/doc/html/reference.html 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -54,7 +54,7 @@
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2009-2012 Lorenzo
Caminiti<p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
+ 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)
</p>
</div></td>
Modified: sandbox/local_function/libs/local_function/doc/implementation.qbk
==============================================================================
--- sandbox/local_function/libs/local_function/doc/implementation.qbk (original)
+++ sandbox/local_function/libs/local_function/doc/implementation.qbk 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -16,7 +16,7 @@
[h5 Local Classes as Template Parameters]
This library uses a local class to implement the local function object.
-However, in __CPP03__ local classes (and therefore the local function objects they implement) cannot be passed as template parameters (e.g., to the `std::for_each` algorithm), this is instead possible on __CPP11__, MSVC, and some other compilers (see __N2657__).
+However, in __CPP03__ local classes (and therefore the local function objects they implement) cannot be passed as template parameters (e.g., to the `std::for_each` algorithm), this is instead possible in __CPP11__, MSVC, and some other compilers (see __N2657__).
To work around this limitation, this library investigated the following two "tricks" (both tricks can be extended to support eventual function default parameters):
# The /casting functor trick/ uses a non-local functor that calls a static member function of the local class via a function pointer.
@@ -27,7 +27,7 @@
For example (see also [@../../example/impl_tparam_tricks.cpp =impl_tparam_tricks.cpp=]):
-[example_impl_tparam_tricks]
+[impl_tparam_tricks]
The casting functor trick measured slightly better run-time performances than the virtual functor trick so the current implementation of this library uses the casting functor trick (probably because in addition to the indirect function call, the virtual functor trick also requires accessing the [@http://en.wikipedia.org/wiki/Virtual_method_table virtual function table]).
However, neither one of tricks has been observed to allow for compiler optimizations that inline the local function calls (because they rely on one indirect function call via either a function pointer or a virtual function respectively).
@@ -36,20 +36,14 @@
[h5 Parsing Macros]
This library macros can parse the list of specified parameters and detect if any of the bound variable names matches the token `this_` (to generate special code to bind the object in scope), or if the variable is bound by `const` (to generate special code to bind by constant), etc.
-The parameter tokens are inspected using preprocessor metaprogramming, specifically using the macros from `"boost/local_function/detail/preprocessor/keyword/"`.
+The parameter tokens are inspected using preprocessor metaprogramming and specifically using the macros defined by the files in the =boost/local_function/detail/preprocessor/keyword/= directory.
[footnote
This technique is at the core of even more complex preprocessor parsing macros like the ones that parse the __Contractpp__ syntax.
]
-For example, the following code defines a macro that allows the preprocessor to detect if a set of space-separated tokens ends with `this_` or not:
+For example, the following code defines a macro that allows the preprocessor to detect if a set of space-separated tokens ends with `this_` or not (see also [@../../example/impl_pp_keyword.cpp =impl_pp_keyword.cpp=]):
-[example_impl_pp_keyword]
-
-[h5 Local Functions]
-
-The local function macros expand to code equivalent to the following:
-
-[example_impl_factorial]
+[impl_pp_keyword]
[endsect]
Modified: sandbox/local_function/libs/local_function/doc/introduction.qbk
==============================================================================
--- sandbox/local_function/libs/local_function/doc/introduction.qbk (original)
+++ sandbox/local_function/libs/local_function/doc/introduction.qbk 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -6,31 +6,31 @@
[section:Introduction Introduction]
-/Local functions/ are a form of /information hiding/ and are useful for dividing procedural tasks into subtasks which are only meaningful locally, avoiding cluttering other parts of the program with functions, variables, etc unrelated to those parts.
+/Local functions/ are a form of /information hiding/ and they are useful for dividing procedural tasks into subtasks which are only meaningful locally, avoiding cluttering other parts of the program with functions, variables, etc unrelated to those parts.
Local functions therefore complement other structuring possibilities such as namespaces and classes.
Local functions are a feature of many programming languages, notably [@http://en.wikipedia.org/wiki/Nested_function#An_example Pascal] and [@http://en.wikipedia.org/wiki/Nesting_(computing)#In_programming Ada], yet lacking from __CPP03__ (see also __N2511__).
Using __CPP11_lambda__ functions, it is possible to implement local functions by naming the lambdas assigning them to local variables.
For example (see also [@../../test/add_lambda.cpp =add_lambda.cpp=]):
-[test_add_lambda]
+[add_lambda]
This library allows to program local functions portably between __CPP03__ and __CPP11__ (and with performances comparable to lambdas on __CPP11__ compilers, see the __Alternatives__ section).
For example (see also [@../../test/add.cpp =add.cpp=]):
-[test_add]
+[add]
This library supports the following features for local functions:
* Local functions can capture, or better [@http://en.wikipedia.org/wiki/Name_binding /bind/], any of the variables from the enclosing scope (a function together with its captured variables is also called a [@http://en.wikipedia.org/wiki/Closure_(computer_science) /closure/]).
* The local function body is programmed using the usual C++ statement syntax (as a consequence, compiler errors and debugging retain their usual meaning and format).
-* Local functions can be passed as template parameters so they can be conveniently passed to STL algorithms, etc.
+* Local functions can be passed as template parameters so they can be conveniently used with STL algorithms, etc.
[footnote
-This is a strength with respect to __CPP03__ functors implemented using local classes which cannot be passed as template parameters, see __N2657__ and the __Alternatives__ section.
+This is a strength with respect to __CPP03__ functors implemented using local classes which cannot be passed as template parameters (see __N2657__ and the __Alternatives__ section).
]
* However, local functions must be specified within a declarative context (e.g., at a point in the code where local variables can be declared) thus they cannot be specified within expressions.
[footnote
-This is a weakness with respect to __CPP11_lambda__ functions which can instead be specified also within expressions, see the __Alternatives__ section.
+This is a weakness with respect to __CPP11_lambda__ functions which can instead be specified also within expressions (see the __Alternatives__ section).
]
See the __Alternatives__ section for a comparison between this library, __CPP11_lambda__ functions, __Boost_Phoenix__, and other C++ techniques that implement features related to local functions.
Modified: sandbox/local_function/libs/local_function/doc/local_function.qbk
==============================================================================
--- sandbox/local_function/libs/local_function/doc/local_function.qbk (original)
+++ sandbox/local_function/libs/local_function/doc/local_function.qbk 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -10,8 +10,8 @@
[copyright 2009-2012 Lorenzo Caminiti]
[purpose declare functions at local scope]
[license
- Distributed under the Boost Software License, Version 1.0.
- (See accompanying file LICENSE_1_0.txt or a copy at
+ 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])
]
[authors [Caminiti <email>lorcaminiti_at_[hidden]</email>, Lorenzo]]
@@ -22,21 +22,21 @@
[def __CPP11__ [@http://www.open-std.org/JTC1/SC22/WG21/ C++11]]
[def __C99__ [@http://www.open-std.org/jtc1/sc22/wg14/www/projects#9899 C99]]
[def __Boost__ [@http://www.boost.org/ Boost]]
-[def __Boost_LocalFunction__ [@http://www.boost.org/doc/libs/release/libs/local_function/doc/html/index.html Boost.LocalFunction]]
-[def __Boost_ScopeExit__ [@http://www.boost.org/doc/libs/release/libs/scope_exit/doc/html/index.html Boost.ScopeExit]]
-[def __Boost_Test__ [@http://www.boost.org/doc/libs/release/libs/test/doc/html/index.html Boost.Test]]
-[def __Boost_Lambda__ [@http://www.boost.org/doc/libs/release/doc/html/lambda.html Boost.Lambda]]
-[def __Boost_Phoenix__ [@http://www.boost.org/doc/libs/release/libs/spirit/phoenix/index.html Boost.Phoenix]]
-[def __Boost_Preprocessor__ [@http://www.boost.org/doc/libs/release/libs/preprocessor/doc/index.html Boost.Preprocessor]]
-[def __Boost_MPL__ [@http://www.boost.org/doc/libs/release/libs/mpl/doc/index.html Boost.MPL]]
-[def __Boost_ConceptCheck__ [@http://www.boost.org/doc/libs/release/libs/concept_check/doc/index.html Boost.ConceptCheck]]
-[def __Boost_Parameter__ [@http://www.boost.org/doc/libs/release/libs/parameter/doc/index.html Boost.Paramater]]
-[def __Boost_Typeof__ [@http://www.boost.org/doc/libs/release/doc/html/typeof.html Boost.Typeof]]
-[def __Boost_Function__ [@http://www.boost.org/doc/libs/release/doc/html/function.html Boost.Function]]
-[def __Boost_FunctionalOverloadedFunction__ [@http://www.boost.org/doc/libs/release/doc/html/functional/overloaded_function.html Boost.Functional/OverloadedFunction]]
-[def __Boost_TypeTraits__ [@http://www.boost.org/doc/libs/release/libs/type_traits/doc/html/index.html Boost.TypeTraits]]
-[def __Boost_Utility__ [@http://www.boost.org/doc/libs/release/libs/utility/doc/html/index.html Boost.Utility]]
-[def __Boost_Chrono__ [@http://www.boost.org/doc/libs/release/libs/chrono/doc/html/index.html Boost.Chrono]]
+[def __Boost_LocalFunction__ [@http://www.boost.org/doc/libs/release/libs/local_function Boost.LocalFunction]]
+[def __Boost_ScopeExit__ [@http://www.boost.org/doc/libs/release/libs/scope_exit Boost.ScopeExit]]
+[def __Boost_Test__ [@http://www.boost.org/doc/libs/release/libs/test Boost.Test]]
+[def __Boost_Lambda__ [@http://www.boost.org/doc/libs/release/libs/lambda Boost.Lambda]]
+[def __Boost_Phoenix__ [@http://www.boost.org/doc/libs/release/libs/phoenix Boost.Phoenix]]
+[def __Boost_Preprocessor__ [@http://www.boost.org/doc/libs/release/libs/preprocessor Boost.Preprocessor]]
+[def __Boost_MPL__ [@http://www.boost.org/doc/libs/release/libs/mpl Boost.MPL]]
+[def __Boost_ConceptCheck__ [@http://www.boost.org/doc/libs/release/libs/concept_check Boost.ConceptCheck]]
+[def __Boost_Parameter__ [@http://www.boost.org/doc/libs/release/libs/parameter Boost.Paramater]]
+[def __Boost_Typeof__ [@http://www.boost.org/doc/libs/release/libs/typeof Boost.Typeof]]
+[def __Boost_Function__ [@http://www.boost.org/doc/libs/release/libs/function Boost.Function]]
+[def __Boost_Functional_OverloadedFunction__ [@http://www.boost.org/doc/libs/release/libs/functional/overloaded_function Boost.Functional/OverloadedFunction]]
+[def __Boost_TypeTraits__ [@http://www.boost.org/doc/libs/release/libs/type_traits Boost.TypeTraits]]
+[def __Boost_Utility_IdentityType__ [@http://www.boost.org/doc/libs/release/libs/utility/identity_type Boost.Utility/IdentityType]]
+[def __Boost_Chrono__ [@http://www.boost.org/doc/libs/release/libs/chrono Boost.Chrono]]
[def __CPP11_lambda__ [@http://en.wikipedia.org/wiki/C%2B%2B0x#Lambda_functions_and_expressions C++11 lambda]]
[def __LISP__ [@http://en.wikipedia.org/wiki/Lisp_(programming_language) LISP]]
[def __Contractpp__ [@http://sourceforge.net/projects/contractpp Contract++]]
@@ -86,14 +86,14 @@
[import ../test/goto_err.cpp]
[import ../test/seq.cpp]
-[import ../example/const_block.cpp]
[import ../example/gcc_lambda.cpp]
[import ../example/gcc_lambda_cpp11.cpp]
+[import ../example/const_block_err.cpp]
[import ../example/scope_exit.cpp]
[import ../example/scope_exit.hpp]
-[import ../example/phoenix_local_factorial.cpp]
+[import ../example/phoenix_factorial_local.cpp]
[import ../example/phoenix_factorial.cpp]
-[import ../example/noncopyable_lambda.cpp]
+[import ../example/noncopyable_lambda_err.cpp]
[import ../example/noncopyable_local_function.cpp]
[import ../example/expensive_copy_lambda.cpp]
[import ../example/expensive_copy_local_function.cpp]
@@ -102,7 +102,6 @@
[import ../example/add_phoenix.cpp]
[import ../example/impl_tparam_tricks.cpp]
[import ../example/impl_pp_keyword.cpp]
-[import ../example/impl_factorial.cpp]
This library allows to program functions locally, directly within the scope where they are needed.
Modified: sandbox/local_function/libs/local_function/doc/no_variadic_macros.qbk
==============================================================================
--- sandbox/local_function/libs/local_function/doc/no_variadic_macros.qbk (original)
+++ sandbox/local_function/libs/local_function/doc/no_variadic_macros.qbk 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -19,22 +19,24 @@
token1, token2, ... // Only compilers with varidic macros.
-For example, the following syntax is accepted on all compilers with and without variadic macros (see also [@../../test/add_seq.cpp `"add_seq.cpp"`]):
+For example, the following syntax is accepted on all compilers with and without variadic macros (see also [@../../test/add_seq.cpp =add_seq.cpp=]):
-[test_add_seq]
+[add_seq]
-However, on compilers with variadic macros the comma-separated syntax we have seen so far is preferred because more readable (see also [@../../test/add.cpp `"add.cpp"`]):
+However, on compilers with variadic macros the comma-separated syntax we have seen so far is preferred because more readable (see also [@../../test/add.cpp =add.cpp=]):
-[test_add]
+[add]
Note how the same macros accept both syntaxes on compilers with variadic macros and only the sequence syntax on compilers without variadic macros.
-Finally, an empty list is always specified using `void` on compilers with and without variadic macros.
+Finally, an parameter list is always specified using `void` on compilers with and without variadic macros:
+
+[ten_void]
[h5 An Example]
-The following is an example that shows a bit of all the different macro parameter combinations using the sequence syntax (see also [@../../test/seq.cpp `"seq.cpp"`]):
+The following example shows a bit of all the different macro parameter combinations using the sequence syntax (see also [@../../test/seq.cpp =seq.cpp=]):
-[test_seq]
+[seq]
[endsect]
Modified: sandbox/local_function/libs/local_function/doc/release_notes.qbk
==============================================================================
--- sandbox/local_function/libs/local_function/doc/release_notes.qbk (original)
+++ sandbox/local_function/libs/local_function/doc/release_notes.qbk 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -10,7 +10,14 @@
[h5 Version 1.0.0 (2012-01-31)]
-_at_todo do this
+# Incorporated all comments from the [@http://lists.boost.org/boost-announce/2011/12/0340.php Boost review of this library].
+# Removed local blocks and local exits.
+# Renamed the library from Boost.Local to Boost.LocalFunction.
+# Using `this_` instead of `this` also in the local function declaration (not just the body).
+# Made changes that allow to return local functions (similar to closures).
+# Added GCC lambda and constant block examples.
+# Moved `overloaded_function` to Boost.Functional/OverloadedFunction.
+# Moved `BOOST_IDENTITY_TYPE` to Boost.Utility/IdentityType.
[h5 Version 0.2.0 (2011-05-14)]
Modified: sandbox/local_function/libs/local_function/doc/tutorial.qbk
==============================================================================
--- sandbox/local_function/libs/local_function/doc/tutorial.qbk (original)
+++ sandbox/local_function/libs/local_function/doc/tutorial.qbk 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -11,9 +11,9 @@
[section Local Functions]
Local functions are defined using macros from the header file [headerref boost/local_function.hpp].
-The macros must be used from within a declarative context (this is a limitation with respect to __CPP11_lambda__ functions which can instead be declared within expressions):
+The macros must be used from within a declarative context (this is a limitation with respect to __CPP11_lambda__ functions which can instead be declared also within expressions):
- #include <boost/local_function.hpp> // Include library header.
+ #include <boost/local_function.hpp> // This library header.
...
{ // Some declarative context.
@@ -47,20 +47,20 @@
The maximum number of parameters that can be passed to a local function is controlled at compile-time by the configuration macro [macroref BOOST_LOCAL_FUNCTION_CONFIG_ARITY_MAX].
For example, let's program a local function named `add` that adds together two integers `x` and `y` (see also [@../../test/add_params.cpp =add_params.cpp=]):
-[test_add_params]
+[add_params]
-If the local function has no parameter, it is possible to pass `void` to the [macroref BOOST_LOCAL_FUNCTION] macro (similarly to the C syntax that allows to use `int f(void)` to declare a function with no parameter):
+If the local function has no parameter, it is possible to pass `void` to the [macroref BOOST_LOCAL_FUNCTION] macro (similarly to the C syntax that allows to use [^['result-type function-name]]`(void)` to declare a function with no parameter):
[footnote
*Rationale.*
-The __CPP03__ standard does not allow pass empty parameters to a macro so the macro cannot be invoked as `BOOST_LOCAL_FUNCTION()`.
-On __C99__ compilers with properly implemented empty macro parameter support it would be possible to allow `BOOST_LOCAL_FUNCTION()` but this is already not the case for MSVC so this syntax is never allowed to ensure better portability.
+The __CPP03__ standard does not allow to pass empty parameters to a macro so the macro cannot be invoked as `BOOST_LOCAL_FUNCTION()`.
+On __C99__ compilers with properly implemented empty macro parameter support, it would be possible to allow `BOOST_LOCAL_FUNCTION()` but this is already not the case for MSVC so this syntax is never allowed to ensure better portability.
]
BOOST_LOCAL_FUNCTION(void) // No parameter.
For example, let's program a local function that always returns `10` (see also [@../../test/ten_void.cpp =ten_void.cpp=]):
-[test_ten_void]
+[ten_void]
[endsect]
@@ -68,7 +68,7 @@
Variables in scope (local variables, enclosing function parameters, member variables, etc) can be bound to a local function declaration.
Only bound variables, static variables, global variables, functions, and enumerations from the enclosing scope are accessible from within the local function body.
-The types of bound variables are automatically deduced by this library using __Boost_Typeof__.
+The types of bound variables are deduced automatically by this library.
[footnote
*Rationale.*
By binding a variable in scope, the local function declaration is specifying that such a variable should be accessible within the local function body regardless of its type.
@@ -85,8 +85,8 @@
This library introduces the new "keyword" `bind`
[footnote
Obviously, the token `bind` is not a keyword of the C++ language.
-This library parses the token `bind` during macro expansion using preprocessor metaprogramming (see the __Implementation__ section).
-Therefore, `bind` can be considered a new "keyword" only at the preprocessor metaprogramming level within the syntax defined by the macros of this library (thus it is referred to as a "keyword" only within quotes).
+This library parses the token `bind` during macro expansion using preprocessor meta-programming (see the __Implementation__ section).
+Therefore, `bind` can be considered a new "keyword" only at the preprocessor meta-programming level within the syntax defined by the macros of this library (thus it is referred to as a "keyword" only within quotes).
]
which is used in place of the parameter type to specify the name of a variable in scope to bind (therefore, `bind` cannot be used as a local function parameter type).
A variable can be bound by value:
@@ -114,7 +114,7 @@
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.
-Furthermore, it is the programmers' responsibility to ensure that variables bound by reference survive the declaration scope of the local function otherwise the bound references will be invalid resulting in undefined behaviour (in other words, the usual care in using C++ references must be taken for variables bound by reference).
+Furthermore, it is the programmers' responsibility to ensure that variables bound by reference survive the existence scope of the local function otherwise the bound references will be invalid when the local function is called resulting in undefined behaviour (in other words, the usual care in using C++ references must be taken for variables bound by reference).
The type of a bound variable is automatically deduced and it is the exact same type used to declare such a variable in the enclosing scope with the following notes:
@@ -135,26 +135,25 @@
]
When a variable is bound by value (constant or not), its type must be `CopyConstructible` (i.e., its must provide a copy constructor).
-As with passing parameters to usual C++ functions, programmers might want to bind variables of complex types by (possibly constant) reference instead than by value to avoid expensive copy operations when these variables are bound to a local function.
+As with passing parameters to usual C++ functions, programmers might want to bind variables of complex types by (possibly constant) reference instead of by value to avoid expensive copy operations when these variables are bound to a local function.
For example, let's program the local function `add` from the example in the __Introduction__ section.
-We bind the local variable `factor` by constant value (because its value does not need to be changed), the local variable `sum` by non-constant reference (because its value needs to be updated with the summation result), and program the body to perform the summation (see also [@../../test/add.cpp =add.cpp=]):
+We bind the local variable `factor` by constant value (because its value should not be modified by the local function), the local variable `sum` by non-constant reference (because its value needs to be updated with the summation result), and program the body to perform the summation (see also [@../../test/add.cpp =add.cpp=]):
-[test_add]
+[add]
[endsect]
[section Binding the Object `this`]
It is also possible to bind the object `this` when it is in scope (e.g., from an enclosing non-static member function).
-This is done by using the special symbol `this_` (instead of `this`)
+This is done by using the special symbol `this_` (instead of `this`) as the name of the variable to bind in the local function declaration and also to access the object within the local function body.
[footnote
*Rationale.*
The special name `this_` was chosen following [@http://boost.2283326.n4.nabble.com/local-this-or-this-td3423912.html Boost practises] which postfix with an underscore identifiers that are named after keywords (the C++ keyword `this` in this case).
The special symbol `this_` is needed because `this` is a reserved C++ keyword so it cannot be used as the name of the internal parameter that passes the bound object to the local function body.
It would have been possible to use `this` (instead of `this_`) within the local function body either at the expenses of copying the bound object (which would introduce run-time overhead and also the stringent requirement that the bound object must have a deep copy constructor) or by relying on an [@http://groups.google.com/group/comp.lang.c++.moderated/browse_thread/thread/d3a86f27277f713b undefined behaviour of `static_cast`] (which might not work on all platforms at the cost of portability).
]
-as the name of the variable to bind in the local function declaration and also to access the object within the local function body.
[warning
The library will generate a compile-time error if `this` is mistakenly used instead of `this_` to bind the object in the local function declaration.
@@ -179,16 +178,16 @@
In this case the local function will never be able to modify the object (regardless of whether the enclosing scope is a constant member or not).
Note that the object `this` can never be bound by reference because C++ does not allow to obtain a reference to `this` (the library will generate a compile-time error if programmers try to use `bind& this_` or `const bind& this_`).
-Note that `this` is a pointer so the pointed object is never copied even if `this` is bound by value (also it is not allowed to directly bind `*this` because `*this` is an expression and not a valid name of a variable in scope).
+Note that `this` is a pointer so the pointed object is never copied even if `this` is bound by value (also it is not possible to directly bind `*this` because `*this` is an expression and not a variable name).
For example, let's program a local function `add` similar to the one in the example from the __Introduction__ section but using a member function to illustrate how to bind the object `this` (see also [@../../test/add_this.cpp =add_this.cpp=]):
-[test_add_this]
+[add_this]
-As expected, the local function has access to all class members via the bound object `this_` regardless of their access level (`public`, `protected`, or `private`).
+Note that the local function has access to all class members via the bound object `this_` regardless of their access level (`public`, `protected`, or `private`).
[footnote
*Rationale.*
-This is possible because of C++ defect fix #46 that made inner and local types able to access all outer class members regardless of their access level.
+This is possible because of the fix to C++ [@http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#45 defect 45] that made inner and local types able to access all outer class members regardless of their access level.
]
Specifically, in the example above the local function updates the `private` data member `sum_`.
@@ -196,14 +195,14 @@
[section Templates]
-When local functions are programmed within templates, they need to be declared using the special macro [macroref BOOST_LOCAL_FUNCTION_TPL] (see the __Reference__ section):
+When local functions are programmed within templates, they need to be declared using the special macro [macroref BOOST_LOCAL_FUNCTION_TPL]:
[footnote
*Rationale.*
Within templates, this library needs to use `typename` to explicitly indicate that some expressions evaluate to a type.
Because __CPP03__ does not allow to use `typename` outside templates, the special `TPL` macro is used to indicate that the enclosing scope is a template so this library can safely use `typename` to resolve expression type ambiguities.
]
- #include <boost/local_function.hpp>
+ #include <boost/local_function.hpp> // This library header.
...
{ // Some declarative context within a template.
@@ -216,9 +215,9 @@
The [macroref BOOST_LOCAL_FUNCTION_TPL] macro has the exact same syntax of the [macroref BOOST_LOCAL_FUNCTION] macro that we have seen so far.
-For example, let's program a local function similar to the one from the __Introduction__ section but wrapped within a template (see also [@../../test/add_template.cpp =add_template.cpp=]):
+For example, let's program a local function similar to the one from the __Introduction__ section but within a template (see also [@../../test/add_template.cpp =add_template.cpp=]):
-[test_add_template]
+[add_template]
[endsect]
Modified: sandbox/local_function/libs/local_function/example/Jamfile.v2
==============================================================================
--- sandbox/local_function/libs/local_function/example/Jamfile.v2 (original)
+++ sandbox/local_function/libs/local_function/example/Jamfile.v2 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -13,7 +13,7 @@
#run add_phoenix.cpp ;
run const_block.cpp ;
-compile-fail const_block_err.cpp ;
+#compile-fail const_block_err.cpp ;
run expensive_copy_lambda.cpp ;
run expensive_copy_local_function.cpp ;
@@ -24,7 +24,6 @@
run gcc_square.cpp ;
run gcc_store.cpp ;
-#run impl_factorial.cpp ;
run impl_pp_keyword.cpp ;
run impl_tparam_tricks.cpp ;
Modified: sandbox/local_function/libs/local_function/example/add_global_functor.cpp
==============================================================================
--- sandbox/local_function/libs/local_function/example/add_global_functor.cpp (original)
+++ sandbox/local_function/libs/local_function/example/add_global_functor.cpp 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -9,7 +9,7 @@
#include <algorithm>
//[add_global_functor
-// Unfortunately, cannot be defined locally (so not real alternative).
+// Unfortunately, cannot be defined locally (so not a real alternative).
struct global_add { // Unfortunately, boilerplate code to program the class.
global_add(int& _sum, int _factor): sum(_sum), factor(_factor) {}
Modified: sandbox/local_function/libs/local_function/example/gcc_lambda_cpp11.cpp
==============================================================================
--- sandbox/local_function/libs/local_function/example/gcc_lambda_cpp11.cpp (original)
+++ sandbox/local_function/libs/local_function/example/gcc_lambda_cpp11.cpp 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -5,7 +5,6 @@
// http://www.boost.org/LICENSE_1_0.txt)
#include <boost/config.hpp>
-
#ifndef BOOST_NO_LAMBDAS
#define BOOST_TEST_MODULE TestGccLambdaCpp11
Deleted: sandbox/local_function/libs/local_function/example/impl_factorial.cpp
==============================================================================
--- sandbox/local_function/libs/local_function/example/impl_factorial.cpp 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
+++ (empty file)
@@ -1,184 +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)
-
-//[impl_factorial
-#include <boost/local/function.hpp>
-#include <iostream>
-#include <sstream>
-#include <algorithm>
-#include <vector>
-#include <string>
-
-struct calculator {
- std::ostringstream output;
-
- void factorials(const std::vector<int>& nums,
- const std::string& separator = " ") {
-
- int // The local function result type (just before the `BOOST_LOCAL_FUNCTION_PARAMS` macro).
-
- // *BEGIN* The macro
- // BOOST_LOCAL_FUNCTION_PARAMS( (int n) (bool recursion)(default false)
- // (const bind& separator) (bind this) )
- // expands (at line 21) to:
-
- // DEDUCE RESULT TYPE
- // Long name `ERROR_...` gives meaningful compiler-error message if programmers forget result type before the macro.
- (*ERROR_missing_result_type_before_the_local_function_parameter_macro_id21)();
- // Use Boost.ScopeExit type deduction technique (tagging, wrapping, struct, etc) so to work on all compilers (specifically, some GCC version give internal errors otherwise).
- typedef void (*boost_local_auxXdeduce_result_tag21)( int ERROR_missing_result_type_before_the_local_function_parameter_macro_id21);
- typedef BOOST_TYPEOF(boost::scope_exit::aux::wrap( boost::scope_exit::aux::deref( ERROR_missing_result_type_before_the_local_function_parameter_macro_id21, (boost_local_auxXdeduce_result_tag21)0))) boost_local_auxXdeduce_result_wrap21;
- typedef boost_local_auxXdeduce_result_wrap21::type boost_local_auxXdeduce_result_capture21;
- struct boost_local_auxXdeduce_result_params21 {
- typedef boost_local_auxXdeduce_result_capture21 function_ptr_type;
- };
- typedef boost::remove_pointer< boost_local_auxXdeduce_result_params21::function_ptr_type >::type boost_local_auxXdeduce_result_function_type21;
- typedef boost::function_traits< boost_local_auxXdeduce_result_function_type21>::result_type boost_local_auxXresult_type21;
-
- // HANDLE BOUND PARAMETERS
- // Deduce object `this` type (using technique from Boost.ScopeExit patch to support `this`).
-#if BOOST_WORKAROUND(BOOST_MSVC,>=1300)
- enum { boost_se_thistype_index_21 = sizeof(*boost::scope_exit::msvc_typeof_this::encode_start(this)) };
- typedef boost::scope_exit::msvc_typeof_this::msvc_typeid_wrapper<boost_se_thistype_index_21>::type se_this_type21;
-#else
- typedef BOOST_TYPEOF(this) se_this_type21;
-#endif
- // Deduce other `& separator` type (using Boost.ScopeExit techniques).
- typedef void (*boost_se_tag_0_21)(int & separator);
- typedef BOOST_TYPEOF(boost::scope_exit::aux::wrap( boost::scope_exit::aux::deref(& separator, (boost_se_tag_0_21)0))) boost_se_wrapped_t_0_21;
- typedef boost_se_wrapped_t_0_21::type boost_se_capture_t_0_21;
- // Store bound parameter values and references.
- struct boost_se_params_t_21 {
- se_this_type21 se_this;
- typedef boost_se_capture_t_0_21 boost_se_param_t_0_21;
- boost::scope_exit::aux::member< boost_se_param_t_0_21, boost_se_tag_0_21 > boost_se_param_0_21;
- } boost_local_auxXparams21 = {
- this ,
-#ifdef BOOST_SCOPE_EXIT_AUX_TPL_WORKAROUND
- {
-#endif
- boost::scope_exit::aux::deref(& separator, (boost_se_tag_0_21)0)
-#ifdef BOOST_SCOPE_EXIT_AUX_TPL_WORKAROUND
- }
-#endif
- };
- // Use variable name `...args` without line number to hold bound parameter values (so the same variable name can be used by the `NAME` macro even if it expands on a different line number).
- // The `declared<>` template makes sure that the variable `...args` is not declared multiple times in the same context (if the variable is already declared, this template expand to a no-operation).
- boost::scope_exit::aux::declared< boost::scope_exit::aux::resolve< sizeof(boost_local_auxXargs) >::cmp1<0>::cmp2 > boost_local_auxXargs;
- boost_local_auxXargs.value = &boost_local_auxXparams21;
-
- // LOCAL FUNCTOR
- class boost_local_auxXfunctor21 {
- typedef boost_local_auxXresult_type21 (boost_local_auxXfunction_type) ( int n , bool recursion );
- typedef ::boost::local::aux::function< boost_local_auxXfunction_type, 1 > boost_local_auxXfunctor_type;
- typedef ::boost::add_const< boost_se_params_t_21:: boost_se_param_t_0_21 >::type & separatorXboost_local_auxXtypeof_type ;
- typedef se_this_type21 thisXboost_local_auxXtypeof_type ;
- public:
- // Take a generic pointer so it can be invoked by the `NAME` macro even if it expands on a different line number.
- inline explicit boost_local_auxXfunctor21( void* bindings) :
- boost_local_auxXbind_this( static_cast< boost_se_params_t_21* >( bindings)-> se_this )
- , boost_local_auxXbind0 ( static_cast< boost_se_params_t_21* >( bindings)-> boost_se_param_0_21.value )
- { }
-
- // Implement `operator()` for all parameters and any combination of default parameter.
- inline boost_local_auxXresult_type21 operator()(
- ::boost::call_traits< ::boost::function_traits< boost_local_auxXfunction_type>::arg1_type>::param_type arg1
- , ::boost::call_traits< ::boost::function_traits< boost_local_auxXfunction_type>::arg2_type>::param_type arg2
- ) const {
- return boost_local_auxXbody( boost_local_auxXbind0 , boost_local_auxXbind_this , arg1 , arg2 );
- }
- inline boost_local_auxXresult_type21 operator()(
- ::boost::call_traits< ::boost::function_traits< boost_local_auxXfunction_type>::arg1_type>::param_type arg1
- ) const {
- return boost_local_auxXbody( boost_local_auxXbind0 , boost_local_auxXbind_this , arg1 );
- }
-
- // "Casting functor trick" to pass this local class as template parameter.
- inline static boost_local_auxXresult_type21 boost_local_auxXcall0(
- void* object
- , ::boost::call_traits< ::boost::function_traits< boost_local_auxXfunction_type>::arg1_type>::param_type arg1
- , ::boost::call_traits< ::boost::function_traits< boost_local_auxXfunction_type>::arg2_type>::param_type arg2
- ) {
- return static_cast< boost_local_auxXfunctor21* >( object)->operator()( arg1 , arg2 );
- }
- inline static boost_local_auxXresult_type21 boost_local_auxXcall1(
- void* object
- , ::boost::call_traits< ::boost::function_traits< boost_local_auxXfunction_type>::arg1_type>::param_type arg1
- ) {
- return static_cast< boost_local_auxXfunctor21* >( object)->operator()( arg1 );
- }
- inline static void boost_local_auxXinit_call( void* object, boost_local_auxXfunctor_type& functor) {
- functor.boost_local_auxXinit_call(object, &boost_local_auxXcall0 , &boost_local_auxXcall1 );
- }
-
- private:
- // Hold bound variables (by value and reference).
- se_this_type21 & boost_local_auxXbind_this ;
- ::boost::add_const< boost_se_params_t_21:: boost_se_param_t_0_21 >::type & boost_local_auxXbind0 ;
- // 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.
- inline boost_local_auxXresult_type21 boost_local_auxXbody(
- ::boost::add_const< boost_se_params_t_21:: boost_se_param_t_0_21 >::type & separator
- , se_this_type21 const this_ // Use special name `this_` instead of `this` here.
- // Specify default parameter values here.
- , int n , bool recursion = false
- ) const
-
- // *END* The expansion of `BOOST_LOCAL_FUNCTION_PARAMS` ends here.
-
- // *BEGIN* The local function body code `{ ... }` as specified by the programmers:
-
- {
-
- int result = 0;
-
- if (n < 2 ) result = 1;
- else result = n * factorial(n - 1, true); // Recursive call.
-
- if (!recursion) this_->output << result << separator;
- return result;
- }
-
- // *END* The local function body `{ ... }` ends here.
-
- // *BEGIN* The macro `BOOST_LOCAL_FUNCTION_NAME(recursive factorial)` expands to:
-
- public:
- // Member variable named after the local function so the body can recursively call the local function (this must be defined here because the local function name was not known before). This must be public because it is also used to deduce the local function functor type later when when declaring the actual local function object.
- boost_local_auxXfunctor_type factorial;
- // Initializes the local functor member variable (this cannot be done directly within the constructor because the local function name is not known when the constructor code is expanded by the `PARAMS` macro).
- inline void boost_local_auxXinit_recursion( boost_local_auxXfunctor_type& functor) {
- factorial = functor;
- }
- // Declare the local class object -- which cannot be passed as template parameter (because it is a local class). It uses the variable with the generic `...args` name to pass the bound parameter values and references (so this variable name must not contain the line number because it is used by different macros expanding on different lines).
- } boost_local_auxXfactorial(boost_local_auxXargs.value);
- // Declare the actual local function object with the local function name -- which can be passed as template parameter (because it is a `boost::local::function` functor and not a local class).
- BOOST_TYPEOF(boost_local_auxXfactorial. factorial) factorial;
- // Initializes casting functor to pass local function as template parameter.
- boost_local_auxXfactorial.boost_local_auxXinit_call( &boost_local_auxXfactorial, factorial);
- // Initializes functor for recursion.
- boost_local_auxXfactorial.boost_local_auxXinit_recursion( factorial);
-
- // *END* The expansion of `BOOST_LOCAL_FUNCTION_NAME` ends here.
-
- std::for_each(nums.begin(), nums.end(), factorial);
- }
-};
-
-int main() {
- std::vector<int> v(3);
- v[0] = 1; v[1] = 4; v[2] = 7;
-
- calculator calc;
- calc.factorials(v);
- std::cout << calc.output.str() << std::endl;
-
- return 0;
-}
-//]
-
Modified: sandbox/local_function/libs/local_function/example/impl_pp_keyword.cpp
==============================================================================
--- sandbox/local_function/libs/local_function/example/impl_pp_keyword.cpp (original)
+++ sandbox/local_function/libs/local_function/example/impl_pp_keyword.cpp 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -12,7 +12,7 @@
#include <boost/test/unit_test.hpp>
// Expand to 1 if space-separated tokens end with `this_`, 0 otherwise.
-#define HAS_THIS_(tokens) \
+#define IS_THIS_BACK(tokens) \
BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_IS_THISUNDERSCORE_BACK( \
BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_BIND_REMOVE_FRONT( \
BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_CONST_REMOVE_FRONT( \
@@ -20,8 +20,8 @@
)))
BOOST_AUTO_TEST_CASE( test_impl_pp_keyword ) {
- BOOST_CHECK( HAS_THIS_(const bind this_) == 1 );
- BOOST_CHECK( HAS_THIS_(const bind& x) == 0 );
+ BOOST_CHECK( IS_THIS_BACK(const bind this_) == 1 );
+ BOOST_CHECK( IS_THIS_BACK(const bind& x) == 0 );
}
//]
Modified: sandbox/local_function/libs/local_function/example/noncopyable_lambda_err.cpp
==============================================================================
--- sandbox/local_function/libs/local_function/example/noncopyable_lambda_err.cpp (original)
+++ sandbox/local_function/libs/local_function/example/noncopyable_lambda_err.cpp 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -10,7 +10,7 @@
#include <boost/noncopyable.hpp>
#include <cassert>
-//[noncopyable_lambda
+//[noncopyable_lambda_err
struct n: boost::noncopyable {
int i;
n(int _i): i(_i) {}
Modified: sandbox/local_function/libs/local_function/test/add_classifiers.cpp
==============================================================================
--- sandbox/local_function/libs/local_function/test/add_classifiers.cpp (original)
+++ sandbox/local_function/libs/local_function/test/add_classifiers.cpp 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -5,7 +5,6 @@
// http://www.boost.org/LICENSE_1_0.txt)
#include <boost/config.hpp>
-
#ifdef BOOST_NO_AUTO_DECLARATIONS // No C++11 auto declarations.
#include <boost/local_function.hpp>
@@ -14,7 +13,7 @@
BOOST_AUTO_TEST_CASE( test_add_classifiers ) {
//[add_classifiers
- int BOOST_LOCAL_FUNCTION(auto int x, register int y) { // Classifers.
+ int BOOST_LOCAL_FUNCTION(auto int x, register int y) { // Classifiers.
return x + y;
} BOOST_LOCAL_FUNCTION_NAME(add)
//]
@@ -24,7 +23,7 @@
#else // C++11 auto declarations.
-int main(void) { return 0; } // Trivial test.
+int main(void) { return 0; } // Trivial program.
#endif
Modified: sandbox/local_function/libs/local_function/test/add_lambda.cpp
==============================================================================
--- sandbox/local_function/libs/local_function/test/add_lambda.cpp (original)
+++ sandbox/local_function/libs/local_function/test/add_lambda.cpp 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -5,7 +5,6 @@
// http://www.boost.org/LICENSE_1_0.txt)
#include <boost/config.hpp>
-
#ifndef BOOST_NO_LAMBDAS
#define BOOST_TEST_MODULE TestAddLambda
@@ -29,9 +28,9 @@
}
//]
-#else // LAMBDAS
+#else // NO_LAMBDAS
-int main(void) { return 0; } // Trivial test.
+int main(void) { return 0; } // Trivial program.
-#endif // LAMBDAS
+#endif // NO_LAMBDAS
Modified: sandbox/local_function/libs/local_function/test/add_seq.cpp
==============================================================================
--- sandbox/local_function/libs/local_function/test/add_seq.cpp (original)
+++ sandbox/local_function/libs/local_function/test/add_seq.cpp 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -9,20 +9,20 @@
#include <boost/test/unit_test.hpp>
#include <algorithm>
-BOOST_AUTO_TEST_CASE( test_add_seq ) {
- //[add_seq
- int sum = 0, factor = 10; // Variables in scope to bind.
+BOOST_AUTO_TEST_CASE( test_add_seq )
+//[add_seq
+{ // Some local scope.
+ int sum = 0, factor = 10; // Variables in scope to bind.
void BOOST_LOCAL_FUNCTION( (const bind factor) (bind& sum) (int num) ) {
- sum += factor * num;
+ sum += factor * num; // Parameters as sequence.
} BOOST_LOCAL_FUNCTION_NAME(add)
- add(1); // Call the local function (with one parameter `num`).
-
+ add(1); // Call the local function.
int nums[] = {2, 3};
- std::for_each(nums, nums + 2, add); // Pass it to an algorithm.
- //]
+ std::for_each(nums, nums + 2, add); // Pass it to an algorithm.
- BOOST_CHECK( sum == 60 );
+ BOOST_CHECK( sum == 60 ); // Assert final summation value.
}
+//]
Modified: sandbox/local_function/libs/local_function/test/add_template.cpp
==============================================================================
--- sandbox/local_function/libs/local_function/test/add_template.cpp (original)
+++ sandbox/local_function/libs/local_function/test/add_template.cpp 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -20,7 +20,6 @@
} BOOST_LOCAL_FUNCTION_NAME(add)
add(x);
-
T nums[2]; nums[0] = y; nums[1] = z;
std::for_each(nums, nums + 2, add);
Modified: sandbox/local_function/libs/local_function/test/add_typed.cpp
==============================================================================
--- sandbox/local_function/libs/local_function/test/add_typed.cpp (original)
+++ sandbox/local_function/libs/local_function/test/add_typed.cpp 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -10,7 +10,7 @@
#include <vector>
#include <algorithm>
-//[test_add_typed
+//[add_typed
struct adder {
adder(): sum_(0) {}
Modified: sandbox/local_function/libs/local_function/test/factorial.cpp
==============================================================================
--- sandbox/local_function/libs/local_function/test/factorial.cpp (original)
+++ sandbox/local_function/libs/local_function/test/factorial.cpp 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -22,7 +22,7 @@
if(num <= 0) result = 1;
else result = num * factorial(num - 1, true); // Recursive call.
- if (!recursion) this_->results.push_back(result);
+ if(!recursion) this_->results.push_back(result);
return result;
} BOOST_LOCAL_FUNCTION_NAME(recursive factorial) // Recursive.
Modified: sandbox/local_function/libs/local_function/test/macro_commas.cpp
==============================================================================
--- sandbox/local_function/libs/local_function/test/macro_commas.cpp (original)
+++ sandbox/local_function/libs/local_function/test/macro_commas.cpp 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -21,7 +21,7 @@
typedef int sign_t;
-BOOST_AUTO_TEST_CASE( text_macro_commas ) {
+BOOST_AUTO_TEST_CASE( test_macro_commas ) {
//[macro_commas
void BOOST_LOCAL_FUNCTION(
BOOST_IDENTITY_TYPE((const std::map<std::string, size_t>&)) m,
Modified: sandbox/local_function/libs/scope_exit/doc/Jamfile.v2
==============================================================================
--- sandbox/local_function/libs/scope_exit/doc/Jamfile.v2 (original)
+++ sandbox/local_function/libs/scope_exit/doc/Jamfile.v2 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -9,25 +9,23 @@
using boostbook ;
doxygen reference
- :
- ../../../boost/scope_exit.hpp
- :
- <doxygen:param>QUIET=YES
+ : ../../../boost/scope_exit.hpp
+ : <doxygen:param>QUIET=YES
<doxygen:param>WARN_IF_UNDOCUMENTED=NO
<doxygen:param>HIDE_UNDOC_MEMBERS=YES
<doxygen:param>HIDE_UNDOC_CLASSES=YES
<doxygen:param>ALIASES=" Params=\"<b>Parameters:</b> <table border="0">\" Param{2}=\"<tr><td><b><tt>\\1</tt></b></td><td>\\2</td></tr>\" EndParams=\"</table>\" Returns=\"<b>Returns:</b>\" Note=\"<b>Note:</b>\" Warning=\"<b>Warning:</b>\" See=\"<b>See:</b>\" RefSect{1}=\"\\xmlonly<link linkend='scope_exit.\\1'>\\1</link>\\endxmlonly\" RefSectId{2}=\"\\xmlonly<link linkend='scope_exit.\\1'>\\2</link>\\endxmlonly\" RefClass{1}=\"\\xmlonly<computeroutput><classname alt='\\1'>\\1</classname></computeroutput>\\endxmlonly\" RefFunc{1}=\"\\xmlonly<computeroutput><functionname alt='\\1'>\\1</functionname></computeroutput>\\endxmlonly\" RefMacro{1}=\"\\xmlonly<computeroutput><macroname alt='\\1'>\\1</macroname></computeroutput>\\endxmlonly\" "
# Extract Doxygen that comments non-variant macros.
- <doxygen:param>PREDEFINED="DOXY"
+ <doxygen:param>PREDEFINED="DOXYGEN"
<reftitle>"Reference"
;
xml doc : scope_exit.qbk : <dependency>reference ;
-boostbook standalone : doc :
- <xsl:param>boost.root=../../../..
- <xsl:param>boost.defaults=Boost
- <format>pdf:<xsl:param>boost.url.prefix=http://www.boost.org/doc/libs/release/libs/scope_exit/doc/html
-;
+boostbook standalone : doc
+ : <xsl:param>boost.root=../../../..
+ <xsl:param>boost.defaults=Boost
+ <format>pdf:<xsl:param>boost.url.prefix=http://www.boost.org/doc/libs/release/libs/scope_exit/doc/html
+ ;
Modified: sandbox/local_function/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT.html
==============================================================================
--- sandbox/local_function/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT.html (original)
+++ sandbox/local_function/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT.html 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -33,7 +33,7 @@
</span>BOOST_SCOPE_EXIT(capture_list)</pre></div>
<div class="refsect1">
-<a name="id823602"></a><h2>Description</h2>
+<a name="id822410"></a><h2>Description</h2>
<p>The scope exit declaration schedules the execution of the scope exit body at the exit of the enclosing scope:</p>
<pre class="programlisting"> <span class="special">{</span> <span class="comment">// Some local scope.</span>
<span class="special">...</span>
@@ -43,7 +43,7 @@
<span class="special">...</span>
<span class="special">}</span>
</pre>
-<p>The enclosing scope must be local. If multiple scope exits are declared within the same enclosing scope, the scope exit bodies are executed in the reversed order of their declarations. Note how the end of the scope exit body must be marked with the <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_END.html" title="Macro BOOST_SCOPE_EXIT_END">BOOST_SCOPE_EXIT_END</a></code> (or with a <code class="computeroutput">;</code> but only on C++11).</p>
+<p>The enclosing scope must be local. If multiple scope exits are declared within the same enclosing scope, the scope exit bodies are executed in the reversed order of their declarations. Note how the end of the scope exit body must be marked by <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_END.html" title="Macro BOOST_SCOPE_EXIT_END">BOOST_SCOPE_EXIT_END</a></code> (or by a <code class="computeroutput">;</code> but only on C++11).</p>
<p><span class="bold"><strong>Parameters:</strong></span> </p>
<div class="informaltable"><table class="table">
<colgroup>
@@ -64,7 +64,7 @@
<span class="keyword">void</span> <span class="special">|</span> <span class="identifier">capture_sequence</span>
</pre> Finally, on C++11 compilers <code class="computeroutput">this</code> can be used instead of <code class="computeroutput">this_</code>: <pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"> <span class="identifier">capture</span><span class="special">:</span>
<span class="special">[</span><span class="special">&</span><span class="special">]</span><span class="identifier">variable</span> <span class="special">|</span> <span class="identifier">this_</span> <span class="special">|</span> <span class="keyword">this</span>
-</pre> </td>
+</pre>Lexical conventions: <code class="computeroutput">token1 | token2</code> means either <code class="computeroutput">token1</code> or <code class="computeroutput">token2</code>; <code class="computeroutput">[token]</code> means either <code class="computeroutput">token</code> or nothing; <code class="computeroutput">{expression}</code> means the token resulting from the expression. </td>
</tr></tbody>
</table></div>
<p>
@@ -77,15 +77,15 @@
<p>On various GCC versions the special macro <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_TPL.html" title="Macro BOOST_SCOPE_EXIT_TPL">BOOST_SCOPE_EXIT_TPL</a></code> must be used instead of <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code> within templates (this is not necessary on C++11).</p>
<p>On C++11, it is possible capture all variables in scope without listing their names using the macro <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">BOOST_SCOPE_EXIT_ALL</a></code>.</p>
<p><span class="bold"><strong>Warning:</strong></span> The implementation executes the scope exit body within a destructor thus the scope exit body must never throw in order to comply with STL exception safety requirements.</p>
-<p><span class="bold"><strong>Note:</strong></span> The implementation uses Boost.Typeof to automatically deduce the types of the captured variables. In order to compile code in typeof-emulation mode, Boost.Typeof must be properly configured (see the <a class="link" href="scope_exit/Getting_Started.html" title="Getting Started"> Getting Started</a> section).</p>
+<p><span class="bold"><strong>Note:</strong></span> The implementation uses Boost.Typeof to automatically deduce the types of the captured variables. In order to compile code in type-of emulation mode, Boost.Typeof must be properly configured (see the <a class="link" href="scope_exit/Getting_Started.html" title="Getting Started"> Getting Started</a> section).</p>
<p><span class="bold"><strong>See:</strong></span> <a class="link" href="scope_exit/Tutorial.html" title="Tutorial">Tutorial</a> section, <a class="link" href="scope_exit/Getting_Started.html" title="Getting Started"> Getting Started</a> section, <a class="link" href="scope_exit/No_Variadic_Macros.html" title="Annex: No Variadic Macros"> No Variadic Macros</a> section, <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_TPL.html" title="Macro BOOST_SCOPE_EXIT_TPL">BOOST_SCOPE_EXIT_TPL</a></code>, <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">BOOST_SCOPE_EXIT_ALL</a></code>, <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_END.html" title="Macro BOOST_SCOPE_EXIT_END">BOOST_SCOPE_EXIT_END</a></code>. </p>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2006-2012 Alexander Nasonov, Lorenzo Caminiti<p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ 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)
</p>
</div></td>
</tr></table>
Modified: sandbox/local_function/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_ALL.html
==============================================================================
--- sandbox/local_function/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_ALL.html (original)
+++ sandbox/local_function/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_ALL.html 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -33,8 +33,8 @@
</span>BOOST_SCOPE_EXIT_ALL(capture_list)</pre></div>
<div class="refsect1">
-<a name="id824653"></a><h2>Description</h2>
-<p><span class="bold"><strong>Warning:</strong></span> This macro is only available on C++11 compilers. It is not defined on non-C++11 compilers so its use on non-C++11 compilers will generate a compiler error.</p>
+<a name="id823501"></a><h2>Description</h2>
+<p>This macro accepts a capture list starting with either <code class="computeroutput">&</code> or <code class="computeroutput">=</code> to capture all variables in scope by reference or value respectively (following the same syntax of C++11 lambdas). A part from that, this macro works like <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code> (see <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code> for more information).</p>
<pre class="programlisting"> <span class="special">{</span> <span class="comment">// Some local scope.</span>
<span class="special">...</span>
<span class="identifier">BOOST_SCOPE_EXIT_ALL</span><span class="special">(</span><span class="identifier">capture_list</span><span class="special">)</span> <span class="special">{</span> <span class="comment">// C++11 only.</span>
@@ -43,7 +43,7 @@
<span class="special">...</span>
<span class="special">}</span>
</pre>
-<p>This macro accepts a capture list starting with either <code class="computeroutput">&</code> or <code class="computeroutput">=</code> to capture all variables in scope by reference or value respectively (following the same syntax of C++11 lambdas). A part from that, this macro works like <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code> (see <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code> for more information).</p>
+<p><span class="bold"><strong>Warning:</strong></span> This macro is only available on C++11 compilers. It is not defined on non-C++11 compilers so its use on non-C++11 compilers will generate a compiler error.</p>
<p><span class="bold"><strong>Parameters:</strong></span> </p>
<div class="informaltable"><table class="table">
<colgroup>
@@ -61,15 +61,13 @@
<span class="special">{</span><span class="special">(</span><span class="special">&</span><span class="special">)</span> <span class="special">|</span> <span class="special">(</span><span class="special">=</span><span class="special">)</span><span class="special">}</span> <span class="special">[</span><span class="special">(</span><span class="identifier">capture</span><span class="special">)</span> <span class="special">(</span><span class="identifier">capture</span><span class="special">)</span> <span class="special">...</span><span class="special">]</span>
<span class="identifier">capture</span><span class="special">:</span>
<span class="special">[</span><span class="special">&</span><span class="special">]</span><span class="identifier">variable</span> <span class="special">|</span> <span class="identifier">this_</span> <span class="special">|</span> <span class="keyword">this</span>
-</pre> </td>
+</pre>Lexical conventions: <code class="computeroutput">token1 | token2</code> means either <code class="computeroutput">token1</code> or <code class="computeroutput">token2</code>; <code class="computeroutput">[token]</code> means either <code class="computeroutput">token</code> or nothing; <code class="computeroutput">{expression}</code> means the token resulting from the expression. </td>
</tr></tbody>
</table></div>
<p>
</p>
-<p>Note that on compilers with variadic macro support (which should be all C++11 compilers), the capture list can be specified as a comma-separated list. On all compilers, the same macro <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">BOOST_SCOPE_EXIT_ALL</a></code> also allows to specify the capture list as a Boost.Preprocessor sequence (to allow to use a syntax consistent with the one of <code class="computeroutput">BOOST_SCOPE_EXIT</code> when used on compilers without variadic macro support).</p>
<p>For this macro, the capture list must always contain at least the leading <code class="computeroutput">&</code> or <code class="computeroutput">=</code> so it can never be <code class="computeroutput">void</code>.</p>
-<p>The scope exit body declared by this macro can be terminated equivalently by either a semi-column <code class="computeroutput">;</code> or by the macro <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_END.html" title="Macro BOOST_SCOPE_EXIT_END">BOOST_SCOPE_EXIT_END</a></code>. The <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">BOOST_SCOPE_EXIT_ALL</a></code> macro is only available on C++11 where the terminating semi-column <code class="computeroutput">;</code> can always be used without worrying about portability with C++03 (see <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_END.html" title="Macro BOOST_SCOPE_EXIT_END">BOOST_SCOPE_EXIT_END</a></code> for more information).</p>
-<p>Similarly, this macro can always use <code class="computeroutput">this</code> instead of <code class="computeroutput">this_</code> to capture the enclosing object without worrying about portability with C++03 because this macro is only available on C++11 compilers.</p>
+<p>Note that on compilers with variadic macro support (which should be all C++11 compilers), the capture list can be specified as a comma-separated list. On all compilers, the same macro <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">BOOST_SCOPE_EXIT_ALL</a></code> also allows to specify the capture list as a Boost.Preprocessor sequence (to allow to use a syntax consistent with the one of <code class="computeroutput">BOOST_SCOPE_EXIT</code> when used on compilers without variadic macro support). The scope exit body declared by this macro can be terminated equivalently by either a semi-column <code class="computeroutput">;</code> or by the macro <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_END.html" title="Macro BOOST_SCOPE_EXIT_END">BOOST_SCOPE_EXIT_END</a></code>. The <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">BOOST_SCOPE_EXIT_ALL</a></code> macro
is only available on C++11 where the terminating semi-column <code class="computeroutput">;</code> can always be used without worrying about portability with C++03 (see <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_END.html" title="Macro BOOST_SCOPE_EXIT_END">BOOST_SCOPE_EXIT_END</a></code> for more information). Similarly, this macro can always use <code class="computeroutput">this</code> instead of <code class="computeroutput">this_</code> to capture the enclosing object without worrying about portability with C++03 because this macro is only available on C++11 compilers.</p>
<p><span class="bold"><strong>Note:</strong></span> In summary, this macro can take advantage of all syntax improvements allowed by C++11 but it optionally supports the same syntax required by C++03 so programmers can always program both <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">BOOST_SCOPE_EXIT_ALL</a></code> and <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code> using the same syntax and for all compilers if they wish to do so.</p>
<p><span class="bold"><strong>Warning:</strong></span> The implementation executes the scope exit body within a destructor thus the scope exit body must never throw in order to comply with STL exception safety requirements.</p>
<p><span class="bold"><strong>See:</strong></span> <a class="link" href="scope_exit/Tutorial.html" title="Tutorial">Tutorial</a> section, <a class="link" href="scope_exit/No_Variadic_Macros.html" title="Annex: No Variadic Macros"> No Variadic Macros</a> section, <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code>, <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_END.html" title="Macro BOOST_SCOPE_EXIT_END">BOOST_SCOPE_EXIT_END</a></code>. </p>
@@ -78,8 +76,8 @@
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2006-2012 Alexander Nasonov, Lorenzo Caminiti<p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ 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)
</p>
</div></td>
</tr></table>
Modified: sandbox/local_function/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_CONFIG_NO_CPP11.html
==============================================================================
--- sandbox/local_function/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_CONFIG_NO_CPP11.html (original)
+++ sandbox/local_function/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_CONFIG_NO_CPP11.html 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -7,7 +7,7 @@
<link rel="home" href="index.html" title="Chapter 1. Boost.ScopeExit 1.1.0">
<link rel="up" href="reference.html#header.boost.scope_exit_hpp" title="Header <boost/scope_exit.hpp>">
<link rel="prev" href="BOOST_SCOPE_EXIT_END.html" title="Macro BOOST_SCOPE_EXIT_END">
-<link rel="next" href="scope_exit/acknowledgements.html" title="Acknowledgements">
+<link rel="next" href="scope_exit/annex__alternatives.html" title="Annex: Alternatives">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
@@ -20,7 +20,7 @@
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="BOOST_SCOPE_EXIT_END.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.scope_exit_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="scope_exit/acknowledgements.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
+<a accesskey="p" href="BOOST_SCOPE_EXIT_END.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.scope_exit_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="scope_exit/annex__alternatives.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="BOOST_SCOPE_EXIT_CONFIG_NO_CPP11"></a><div class="titlepage"></div>
@@ -33,7 +33,7 @@
</span>BOOST_SCOPE_EXIT_CONFIG_NO_CPP11</pre></div>
<div class="refsect1">
-<a name="id825393"></a><h2>Description</h2>
+<a name="id824274"></a><h2>Description</h2>
<p>If programmers define this configuration macro, C++11 features will not be used even on C++11 compilers (only C++03 features will be used). By default this macro is not defined.</p>
<p><span class="bold"><strong>Note:</strong></span> This macro does not disable comma-separated capture lists on compilers that support variadic macros (programmers can simply use Boost.Preprocessor sequences if they do not wish to use comma-separated capture lists).</p>
<p><span class="bold"><strong>See:</strong></span> <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code>, <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">BOOST_SCOPE_EXIT_ALL</a></code>, <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_END.html" title="Macro BOOST_SCOPE_EXIT_END">BOOST_SCOPE_EXIT_END</a></code>. </p>
@@ -42,14 +42,14 @@
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2006-2012 Alexander Nasonov, Lorenzo Caminiti<p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ 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)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="BOOST_SCOPE_EXIT_END.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.scope_exit_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="scope_exit/acknowledgements.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
+<a accesskey="p" href="BOOST_SCOPE_EXIT_END.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.scope_exit_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="scope_exit/annex__alternatives.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
Modified: sandbox/local_function/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_END.html
==============================================================================
--- sandbox/local_function/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_END.html (original)
+++ sandbox/local_function/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_END.html 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -33,7 +33,7 @@
</span>BOOST_SCOPE_EXIT_END</pre></div>
<div class="refsect1">
-<a name="id825167"></a><h2>Description</h2>
+<a name="id824048"></a><h2>Description</h2>
<p>This macro must follow the closing curly bracket <code class="computeroutput">}</code> that ends the scope exit body:</p>
<pre class="programlisting"> <span class="special">{</span> <span class="comment">// Some local scope.</span>
<span class="special">...</span>
@@ -59,8 +59,8 @@
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2006-2012 Alexander Nasonov, Lorenzo Caminiti<p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ 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)
</p>
</div></td>
</tr></table>
Modified: sandbox/local_function/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_TPL.html
==============================================================================
--- sandbox/local_function/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_TPL.html (original)
+++ sandbox/local_function/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_TPL.html 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -33,7 +33,7 @@
</span>BOOST_SCOPE_EXIT_TPL(capture_list)</pre></div>
<div class="refsect1">
-<a name="id824131"></a><h2>Description</h2>
+<a name="id822968"></a><h2>Description</h2>
<p>Various versions of the GCC compiler do not compile <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code> inside function templates. As a workaround, <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_TPL.html" title="Macro BOOST_SCOPE_EXIT_TPL">BOOST_SCOPE_EXIT_TPL</a></code> should be used instead of <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code> in these cases:</p>
<pre class="programlisting"> <span class="special">{</span> <span class="comment">// Some local scope.</span>
<span class="special">...</span>
@@ -44,7 +44,7 @@
<span class="special">}</span>
</pre>
<p>The syntax of <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_TPL.html" title="Macro BOOST_SCOPE_EXIT_TPL">BOOST_SCOPE_EXIT_TPL</a></code> is the exact same as the one of <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code> (see <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code> for more information).</p>
-<p>On C++11, <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_TPL.html" title="Macro BOOST_SCOPE_EXIT_TPL">BOOST_SCOPE_EXIT_TPL</a></code> is not needed because <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code> always compiles on GCC versions that support C++11. However, <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_TPL.html" title="Macro BOOST_SCOPE_EXIT_TPL">BOOST_SCOPE_EXIT_TPL</a></code> is still provided on C++11 so to write code that is portable between C++03 and C++11 compilers.</p>
+<p>On C++11, <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_TPL.html" title="Macro BOOST_SCOPE_EXIT_TPL">BOOST_SCOPE_EXIT_TPL</a></code> is not needed because <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code> always compiles on GCC versions that support C++11 (that is also why there is no need for a <code class="computeroutput">BOOST_SCOPE_EXIT_ALL_TPL</code> macro given that <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">BOOST_SCOPE_EXIT_ALL</a></code> is only available for C++11 compilers on which it always compiles correctly). However, <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_TPL.html" title="Macro BOOST_SCOPE_EXIT_TPL">BOOST_SCOPE_EXIT_TPL</a></code> is still provided on C++11 so to write code that is portable between C++03 and C++11 compilers.</p>
<p><span class="bold"><strong>Note:</strong></span> The problem boils down to the following code (see also GCC bug 37920): </p>
<pre class="programlisting"> <span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
<span class="keyword">void</span> <span class="identifier">f</span><span class="special">(</span><span class="identifier">T</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">x</span><span class="special">)</span> <span class="special">{</span>
@@ -67,8 +67,8 @@
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2006-2012 Alexander Nasonov, Lorenzo Caminiti<p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ 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)
</p>
</div></td>
</tr></table>
Modified: sandbox/local_function/libs/scope_exit/doc/html/index.html
==============================================================================
--- sandbox/local_function/libs/scope_exit/doc/html/index.html (original)
+++ sandbox/local_function/libs/scope_exit/doc/html/index.html 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -26,13 +26,13 @@
<span class="firstname">Alexander</span> <span class="surname">Nasonov</span>
</h3></div></div>
<div><div class="author"><h3 class="author">
-<span class="firstname">Lorenzo</span> <span class="surname">Caminiti (lorcaminiti-AT-gmail.com)</span>
+<span class="firstname">Lorenzo</span> <span class="surname">Caminiti <code class="email"><<a class="email" href="mailto:lorcaminiti_at_[hidden]">lorcaminiti_at_[hidden]</a>></code></span>
</h3></div></div>
<div><p class="copyright">Copyright © 2006-2012 Alexander Nasonov, Lorenzo Caminiti</p></div>
<div><div class="legalnotice">
<a name="scope_exit.legal"></a><p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ 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)
</p>
</div></div>
</div></div>
@@ -58,23 +58,10 @@
<dt><span class="section"><a href="scope_exit/Tutorial.html#scope_exit.Tutorial.gcc_template_workaround">GCC Template
Workaround</a></span></dt>
</dl></dd>
-<dt><span class="section">Annex: Alternatives</span></dt>
-<dd><dl>
-<dt><span class="section">Try-Catch</span></dt>
-<dt><span class="section">RAII</span></dt>
-<dt><span class="section">Scope Guards</span></dt>
-<dt><span class="section"><a href="scope_exit/annex__alternatives.html#scope_exit.annex__alternatives.the_d_programming_language">The
- D Programming Language</a></span></dt>
-<dt><span class="section">C++11 Lambdas</span></dt>
-</dl></dd>
-<dt><span class="section">Annex: No Variadic Macros</span></dt>
-<dd><dl>
-<dt><span class="section"><a href="scope_exit/No_Variadic_Macros.html#scope_exit.No_Variadic_Macros.sequence_syntax">Sequence
- Syntax</a></span></dt>
-<dt><span class="section">Examples</span></dt>
-</dl></dd>
<dt><span class="section">Reference</span></dt>
<dd><dl><dt><span class="section">Header <boost/scope_exit.hpp></span></dt></dl></dd>
+<dt><span class="section">Annex: Alternatives</span></dt>
+<dt><span class="section">Annex: No Variadic Macros</span></dt>
<dt><span class="section">Acknowledgements</span></dt>
</dl>
</div>
@@ -89,13 +76,13 @@
Nowadays, every C++ developer is familiar with the RAII
technique. It binds resource acquisition and release to initialization and
destruction of a variable that holds the resource. But there are times when
- writing a special class for such variable is not worth the effort.
+ writing a special class for such variable is not worth the effort. This is
+ when the <a class="link" href="index.html" title="Chapter 1. Boost.ScopeExit 1.1.0">ScopeExit</a> library comes into play.
</p>
<p>
- This is when the <a class="link" href="index.html" title="Chapter 1. Boost.ScopeExit 1.1.0">ScopeExit</a> library comes
- into play. Programmers can put resource acquisition directly in their code
- and next to it, they can write code that releases the resource using this library.
- For example: <sup>[<a name="scope_exit.intro.f0" href="#ftn.scope_exit.intro.f0" class="footnote">1</a>]</sup>
+ Programmers can put resource acquisition directly in their code and next to
+ it, they can write code that releases the resource using this library. For
+ example: <sup>[<a name="scope_exit.intro.f0" href="#ftn.scope_exit.intro.f0" class="footnote">1</a>]</sup>
</p>
<p>
</p>
@@ -134,7 +121,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: January 20, 2012 at 15:09:49 GMT</small></p></td>
+<td align="left"><p><small>Last revised: February 01, 2012 at 00:00:47 GMT</small></p></td>
<td align="right"><div class="copyright-footer"></div></td>
</tr></table>
<hr>
Modified: sandbox/local_function/libs/scope_exit/doc/html/reference.html
==============================================================================
--- sandbox/local_function/libs/scope_exit/doc/html/reference.html (original)
+++ sandbox/local_function/libs/scope_exit/doc/html/reference.html 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -6,7 +6,7 @@
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="Chapter 1. Boost.ScopeExit 1.1.0">
<link rel="up" href="index.html" title="Chapter 1. Boost.ScopeExit 1.1.0">
-<link rel="prev" href="scope_exit/No_Variadic_Macros.html" title="Annex: No Variadic Macros">
+<link rel="prev" href="scope_exit/Tutorial.html" title="Tutorial">
<link rel="next" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
@@ -20,7 +20,7 @@
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="scope_exit/No_Variadic_Macros.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="index.html"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_SCOPE_EXIT.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
+<a accesskey="p" href="scope_exit/Tutorial.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="index.html"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_SCOPE_EXIT.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
@@ -42,14 +42,14 @@
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2006-2012 Alexander Nasonov, Lorenzo Caminiti<p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ 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)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="scope_exit/No_Variadic_Macros.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="index.html"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_SCOPE_EXIT.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
+<a accesskey="p" href="scope_exit/Tutorial.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="index.html"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_SCOPE_EXIT.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
Modified: sandbox/local_function/libs/scope_exit/doc/html/scope_exit/Getting_Started.html
==============================================================================
--- sandbox/local_function/libs/scope_exit/doc/html/scope_exit/Getting_Started.html (original)
+++ sandbox/local_function/libs/scope_exit/doc/html/scope_exit/Getting_Started.html 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -49,8 +49,8 @@
is included by multiple translation units. Furthermore, on MSVC 7.1 and
8.0 it is possible to capture the object <code class="computeroutput"><span class="identifier">this_</span></code>
only with native Boost.Typeof
- (and not in Boost.Typeof
- emulation mode).
+ (and not in typeof emulation
+ mode).
</li>
<li class="listitem">
GCC 3.3 cannot compile <a class="link" href="../index.html" title="Chapter 1. Boost.ScopeExit 1.1.0">ScopeExit</a> inside
@@ -84,27 +84,13 @@
macros, or appropriate Boost.Typeof
headers should be included.
</p>
-<p>
- When using comma-separated lists to specify captures (see the <a class="link" href="No_Variadic_Macros.html" title="Annex: No Variadic Macros">No
- Variadic Macros</a> section), make sure that the <code class="computeroutput"><span class="identifier">BOOST_PP_VARIADICS</span></code>
- macro is defined (either automatically by Boost.Preprocessor
- or manually using compiler options <code class="computeroutput"><span class="special">-</span><span class="identifier">D</span></code>, <code class="computeroutput"><span class="special">/</span><span class="identifier">D</span></code>, etc). <sup>[<a name="scope_exit.Getting_Started.installation.f0" href="#ftn.scope_exit.Getting_Started.installation.f0" class="footnote">2</a>]</sup>
- </p>
-</div>
-<div class="footnotes">
-<br><hr width="100" align="left">
-<div class="footnote"><p><sup>[<a id="ftn.scope_exit.Getting_Started.installation.f0" href="#scope_exit.Getting_Started.installation.f0" class="para">2</a>] </sup>
- It is not sufficient for the <code class="computeroutput"><span class="identifier">BOOST_NO_VARIADIC_MACROS</span></code>
- macro to be undefined, the <code class="computeroutput"><span class="identifier">BOOST_PP_VARIADICS</span></code>
- macro must be defined.
- </p></div>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2006-2012 Alexander Nasonov, Lorenzo Caminiti<p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ 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)
</p>
</div></td>
</tr></table>
Modified: sandbox/local_function/libs/scope_exit/doc/html/scope_exit/No_Variadic_Macros.html
==============================================================================
--- sandbox/local_function/libs/scope_exit/doc/html/scope_exit/No_Variadic_Macros.html (original)
+++ sandbox/local_function/libs/scope_exit/doc/html/scope_exit/No_Variadic_Macros.html 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -7,7 +7,7 @@
<link rel="home" href="../index.html" title="Chapter 1. Boost.ScopeExit 1.1.0">
<link rel="up" href="../index.html" title="Chapter 1. Boost.ScopeExit 1.1.0">
<link rel="prev" href="annex__alternatives.html" title="Annex: Alternatives">
-<link rel="next" href="../reference.html" title="Reference">
+<link rel="next" href="acknowledgements.html" title="Acknowledgements">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
@@ -20,45 +20,40 @@
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="annex__alternatives.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../reference.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
+<a accesskey="p" href="annex__alternatives.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="acknowledgements.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="scope_exit.No_Variadic_Macros"></a><a class="link" href="No_Variadic_Macros.html" title="Annex: No Variadic Macros">Annex: No Variadic Macros</a>
</h2></div></div></div>
-<div class="toc"><dl>
-<dt><span class="section"><a href="No_Variadic_Macros.html#scope_exit.No_Variadic_Macros.sequence_syntax">Sequence
- Syntax</a></span></dt>
-<dt><span class="section">Examples</span></dt>
-</dl></div>
<p>
This section presents an alternative syntax for compilers without variadic
macro support.
</p>
-<div class="section">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="scope_exit.No_Variadic_Macros.sequence_syntax"></a><a class="link" href="No_Variadic_Macros.html#scope_exit.No_Variadic_Macros.sequence_syntax" title="Sequence Syntax">Sequence
+<h6>
+<a name="scope_exit.No_Variadic_Macros.h0"></a>
+ <span><a name="scope_exit.No_Variadic_Macros.sequence_syntax"></a></span><a class="link" href="No_Variadic_Macros.html#scope_exit.No_Variadic_Macros.sequence_syntax">Sequence
Syntax</a>
-</h3></div></div></div>
+ </h6>
<p>
- Most modern compilers support variadic macros (notably, these include GCC,
- MSVC, and all C++11 compilers). However, in the rare case that programmers
- need to use this library on a complier without variaidc macros, this library
- also allows to specify the capture list using a <a href="../../../../../libs/preprocessor/index.html" target="_top">Boost.Preprocessor
- sequence</a> where tokens are separated by round parenthesis <code class="computeroutput"><span class="special">()</span></code>:
- </p>
+ Most modern compilers support variadic macros (notably, these include GCC,
+ MSVC, and all C++11 compilers). However, in the rare case that programmers
+ need to use this library on a complier without variaidc macros, this library
+ also allows to specify the capture list using a <a href="../../../../../libs/preprocessor/index.html" target="_top">Boost.Preprocessor
+ sequence</a> where tokens are separated by round parenthesis <code class="computeroutput"><span class="special">()</span></code>:
+ </p>
<pre class="programlisting"><span class="special">(</span><span class="identifier">capture1</span><span class="special">)</span> <span class="special">(</span><span class="identifier">capture2</span><span class="special">)</span> <span class="special">...</span> <span class="comment">// All compilers.</span>
</pre>
<p>
- Instead of a comma-separated list that we have seen so far which requires
- variadic macros:
- </p>
+ Instead of the comma-separated list that we have seen so far which requires
+ variadic macros:
+ </p>
<pre class="programlisting"><span class="identifier">capture1</span><span class="special">,</span> <span class="identifier">capture2</span><span class="special">,</span> <span class="special">...</span> <span class="comment">// Only compilers with variadic macros.</span>
</pre>
<p>
- For example, the following syntax is accepted on all compilers with and without
- variadic macros (see also "world_seq.cpp"
):
- </p>
+ For example, the following syntax is accepted on all compilers with and without
+ variadic macros (see also world_seq.cpp
):
+ </p>
<p>
</p>
<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">world</span><span class="special">::</span><span class="identifier">add_person</span><span class="special">(</span><span class="identifier">person</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">a_person</span><span class="special">)</span> <span class="special">{</span>
@@ -75,14 +70,14 @@
<span class="special">}</span>
</pre>
<p>
- </p>
+ </p>
<p>
- Furthermore, older versions of this library used to only support the Boost.Preprocessor sequence
- syntax so the above syntax is also supported for backward compatibility.
- However, in the current version of this library and on compilers with variadic
- macros, the syntax we have seen so far is preferred because more readable
- (see also "world.cpp"
):
- </p>
+ Furthermore, older versions of this library used to only support the Boost.Preprocessor sequence
+ syntax so the above syntax is also supported for backward compatibility. However,
+ in the current version of this library and on compilers with variadic macros,
+ the comma-separated syntax we have seen so far is preferred because more readable
+ (see also world.cpp
):
+ </p>
<p>
</p>
<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">world</span><span class="special">::</span><span class="identifier">add_person</span><span class="special">(</span><span class="identifier">person</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">a_person</span><span class="special">)</span> <span class="special">{</span>
@@ -100,77 +95,97 @@
<span class="special">}</span>
</pre>
<p>
- </p>
+ </p>
<p>
- Note how the same macros accepts both syntaxes on compilers with variadic
- macros and only the <a href="../../../../../libs/preprocessor/index.html" target="_top">Boost.Preprocessor
- sequence</a> syntax on compilers without variadic macros. Finally, an
- empty capture list is always specified using <code class="computeroutput"><span class="keyword">void</span></code>
- on compilers with and without variaidc macros.
- </p>
-</div>
-<div class="section">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="scope_exit.No_Variadic_Macros.examples"></a><a class="link" href="No_Variadic_Macros.html#scope_exit.No_Variadic_Macros.examples" title="Examples">Examples</a>
-</h3></div></div></div>
-<p>
- The following is a list of most of the examples presented in this documentation
- reprogrammed using the <a href="../../../../../libs/preprocessor/index.html" target="_top">Boost.Preprocessor
- sequence</a> syntax instead of the comma-separated list:
- </p>
+ Note how the same macros accept both syntaxes on compilers with variadic macros
+ and only the <a href="../../../../../libs/preprocessor/index.html" target="_top">Boost.Preprocessor
+ sequence</a> syntax on compilers without variadic macros. Finally, an empty
+ capture list is always specified using <code class="computeroutput"><span class="keyword">void</span></code>
+ on compilers with and without variaidc macros (see also world_void.cpp
):
+ </p>
+<p>
+</p>
+<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">world_t</span> <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">person</span><span class="special">></span> <span class="identifier">persons</span><span class="special">;</span>
+ <span class="keyword">bool</span> <span class="identifier">commit</span><span class="special">;</span>
+<span class="special">}</span> <span class="identifier">world</span><span class="special">;</span> <span class="comment">// Global variable.</span>
+
+<span class="keyword">void</span> <span class="identifier">add_person</span><span class="special">(</span><span class="identifier">person</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">a_person</span><span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">world</span><span class="special">.</span><span class="identifier">commit</span> <span class="special">=</span> <span class="keyword">false</span><span class="special">;</span>
+ <span class="identifier">world</span><span class="special">.</span><span class="identifier">persons</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">a_person</span><span class="special">);</span>
+
+ <span class="identifier">BOOST_SCOPE_EXIT</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">{</span> <span class="comment">// No captures.</span>
+ <span class="keyword">if</span><span class="special">(!</span><span class="identifier">world</span><span class="special">.</span><span class="identifier">commit</span><span class="special">)</span> <span class="identifier">world</span><span class="special">.</span><span class="identifier">persons</span><span class="special">.</span><span class="identifier">pop_back</span><span class="special">();</span>
+ <span class="special">}</span> <span class="identifier">BOOST_SCOPE_EXIT_END</span>
+
+ <span class="comment">// ...</span>
+
+ <span class="identifier">world</span><span class="special">.</span><span class="identifier">commit</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<h6>
+<a name="scope_exit.No_Variadic_Macros.h1"></a>
+ <span><a name="scope_exit.No_Variadic_Macros.examples"></a></span><a class="link" href="No_Variadic_Macros.html#scope_exit.No_Variadic_Macros.examples">Examples</a>
+ </h6>
+<p>
+ The following is a list of most of the examples presented in this documentation
+ reprogrammed using the <a href="../../../../../libs/preprocessor/index.html" target="_top">Boost.Preprocessor
+ sequence</a> syntax instead of the comma-separated list:
+ </p>
<div class="informaltable"><table class="table">
<colgroup><col></colgroup>
<thead><tr><th>
- <p>
- Files
- </p>
- </th></tr></thead>
+ <p>
+ Files
+ </p>
+ </th></tr></thead>
<tbody>
<tr><td>
- <p>
- "world_checkpoint_seq.cpp"
- </p>
- </td></tr>
-<tr><td>
- <p>
- "world_this_seq.cpp"
- </p>
- </td></tr>
-<tr><td>
- <p>
- "world_checkpoint_all_seq.cpp"
- </p>
- </td></tr>
-<tr><td>
- <p>
- "world_tpl_seq.cpp"
- </p>
- </td></tr>
-<tr><td>
- <p>
- "try_catch_seq.cpp"
- </p>
- </td></tr>
-<tr><td>
- <p>
- "scope_guard_seq.cpp"
- </p>
- </td></tr>
+ <p>
+ world_checkpoint_seq.cpp
+ </p>
+ </td></tr>
+<tr><td>
+ <p>
+ world_this_seq.cpp
+ </p>
+ </td></tr>
+<tr><td>
+ <p>
+ world_checkpoint_all_seq.cpp
+ </p>
+ </td></tr>
+<tr><td>
+ <p>
+ world_tpl_seq.cpp
+ </p>
+ </td></tr>
+<tr><td>
+ <p>
+ try_catch_seq.cpp
+ </p>
+ </td></tr>
+<tr><td>
+ <p>
+ scope_guard_seq.cpp
+ </p>
+ </td></tr>
</tbody>
</table></div>
</div>
-</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2006-2012 Alexander Nasonov, Lorenzo Caminiti<p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ 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)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="annex__alternatives.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../reference.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
+<a accesskey="p" href="annex__alternatives.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="acknowledgements.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
Modified: sandbox/local_function/libs/scope_exit/doc/html/scope_exit/Tutorial.html
==============================================================================
--- sandbox/local_function/libs/scope_exit/doc/html/scope_exit/Tutorial.html (original)
+++ sandbox/local_function/libs/scope_exit/doc/html/scope_exit/Tutorial.html 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -7,7 +7,7 @@
<link rel="home" href="../index.html" title="Chapter 1. Boost.ScopeExit 1.1.0">
<link rel="up" href="../index.html" title="Chapter 1. Boost.ScopeExit 1.1.0">
<link rel="prev" href="Getting_Started.html" title="Getting Started">
-<link rel="next" href="annex__alternatives.html" title="Annex: Alternatives">
+<link rel="next" href="../reference.html" title="Reference">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
@@ -20,7 +20,7 @@
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="Getting_Started.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="annex__alternatives.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
+<a accesskey="p" href="Getting_Started.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../reference.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
@@ -45,9 +45,10 @@
<a name="scope_exit.Tutorial.capturing_variables"></a><a class="link" href="Tutorial.html#scope_exit.Tutorial.capturing_variables" title="Capturing Variables">Capturing Variables</a>
</h3></div></div></div>
<p>
- Imagine that we want to make many modifications to data members of the <code class="computeroutput"><span class="identifier">world</span></code> class in the <code class="computeroutput"><span class="identifier">world</span><span class="special">::</span><span class="identifier">add_person</span></code>
- function. You start with adding a new <code class="computeroutput"><span class="identifier">person</span></code>
- object to a vector of persons:
+ Imagine that we want to make many modifications to data members of some
+ <code class="computeroutput"><span class="identifier">world</span></code> class in its <code class="computeroutput"><span class="identifier">world</span><span class="special">::</span><span class="identifier">add_person</span></code> member function. We start with
+ adding a new <code class="computeroutput"><span class="identifier">person</span></code> object
+ to a vector of persons:
</p>
<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">world</span><span class="special">::</span><span class="identifier">add_person</span><span class="special">(</span><span class="identifier">person</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">a_person</span><span class="special">)</span> <span class="special">{</span>
<span class="keyword">bool</span> <span class="identifier">commit</span> <span class="special">=</span> <span class="keyword">false</span><span class="special">;</span>
@@ -65,7 +66,7 @@
In particular, the last added person must be deleted from <code class="computeroutput"><span class="identifier">persons_</span></code>
if the function throws. All we need is to define a delayed action (release
of a resource) right after the direct action (resource acquisition). For
- example (see also "world.cpp"
):
+ example (see also world.cpp
):
</p>
<p>
</p>
@@ -86,12 +87,11 @@
<p>
</p>
<p>
- The block below point <code class="computeroutput"><span class="special">(</span><span class="number">1</span><span class="special">)</span></code> is a <a class="link" href="../index.html" title="Chapter 1. Boost.ScopeExit 1.1.0">ScopeExit</a>
- declaration. Unlike point <code class="computeroutput"><span class="special">(</span><span class="number">1</span><span class="special">)</span></code>, an execution
- of the <a class="link" href="../index.html" title="Chapter 1. Boost.ScopeExit 1.1.0">ScopeExit</a> body will be delayed until
- the end of the current scope. In this case it will be executed either after
- point <code class="computeroutput"><span class="special">(</span><span class="number">4</span><span class="special">)</span></code> or on any exception. (On various versions
- of the GCC compiler, it is necessary to use <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_TPL.html" title="Macro BOOST_SCOPE_EXIT_TPL">BOOST_SCOPE_EXIT_TPL</a></code>
+ The block below point <code class="literal">(1)</code> is a <a class="link" href="../index.html" title="Chapter 1. Boost.ScopeExit 1.1.0">ScopeExit</a>
+ declaration. Unlike point <code class="literal">(1)</code>, an execution of the <a class="link" href="../index.html" title="Chapter 1. Boost.ScopeExit 1.1.0">ScopeExit</a> body will be delayed until the end
+ of the current scope. In this case it will be executed either after point
+ <code class="literal">(4)</code> or on any exception. (On various versions of the GCC
+ compiler, it is necessary to use <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_TPL.html" title="Macro BOOST_SCOPE_EXIT_TPL">BOOST_SCOPE_EXIT_TPL</a></code>
instead of <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code>
within templates, see later in this section for details.)
</p>
@@ -105,8 +105,8 @@
Macros</a> section). If a capture starts with the ampersand sign <code class="computeroutput"><span class="special">&</span></code>, a reference to the captured variable
will be available inside the <a class="link" href="../index.html" title="Chapter 1. Boost.ScopeExit 1.1.0">ScopeExit</a>
body; otherwise, a copy of the variable will be made after the <a class="link" href="../index.html" title="Chapter 1. Boost.ScopeExit 1.1.0">ScopeExit</a>
- declaration at point <code class="computeroutput"><span class="special">(</span><span class="number">1</span><span class="special">)</span></code> and only the copy will be available inside
- the body (in this case, the captured variable's type must be <code class="computeroutput"><span class="identifier">CopyConstructible</span></code>).
+ declaration at point <code class="literal">(1)</code> and only the copy will be available
+ inside the body (in this case, the captured variable's type must be <code class="computeroutput"><span class="identifier">CopyConstructible</span></code>).
</p>
<p>
In the example above, the variables <code class="computeroutput"><span class="identifier">commit</span></code>
@@ -124,12 +124,12 @@
of the <a class="link" href="../index.html" title="Chapter 1. Boost.ScopeExit 1.1.0">ScopeExit</a> body. On C++11 it is also
possible (but not required) to use a semi-column <code class="computeroutput"><span class="special">;</span></code>
instead of the <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_END.html" title="Macro BOOST_SCOPE_EXIT_END">BOOST_SCOPE_EXIT_END</a></code>
- macro. <sup>[<a name="scope_exit.Tutorial.capturing_variables.f0" href="#ftn.scope_exit.Tutorial.capturing_variables.f0" class="footnote">3</a>]</sup>
+ macro. <sup>[<a name="scope_exit.Tutorial.capturing_variables.f0" href="#ftn.scope_exit.Tutorial.capturing_variables.f0" class="footnote">2</a>]</sup>
</p>
-<div class="warning"><table border="0" summary="Warning">
+<div class="important"><table border="0" summary="Important">
<tr>
-<td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="../../../../../doc/src/images/warning.png"></td>
-<th align="left">Warning</th>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Important]" src="../../../../../doc/src/images/important.png"></td>
+<th align="left">Important</th>
</tr>
<tr><td align="left" valign="top"><p>
In order to comply with the STL exception safety requirements, the <a class="link" href="../index.html" title="Chapter 1. Boost.ScopeExit 1.1.0">ScopeExit</a> body must never throw (because the
@@ -151,7 +151,7 @@
body so we can compare it with the final value of <code class="computeroutput"><span class="identifier">evolution_</span></code>.
If the latter was not incremented since we saved it, the rollback action
inside the <a class="link" href="../index.html" title="Chapter 1. Boost.ScopeExit 1.1.0">ScopeExit</a> body should be executed.
- For example (see also "world_checkpoint.cpp"
):
+ For example (see also world_checkpoint.cpp
):
</p>
<p>
</p>
@@ -200,7 +200,7 @@
<p>
Within a member function, it is also possible to capture the object <code class="computeroutput"><span class="keyword">this</span></code>. However, the special symbol <code class="computeroutput"><span class="identifier">this_</span></code> must be used instead of <code class="computeroutput"><span class="keyword">this</span></code> in the <a class="link" href="../index.html" title="Chapter 1. Boost.ScopeExit 1.1.0">ScopeExit</a>
declaration and body to capture and access the object. For example (see also
- "world_this.cpp"
):
+ world_this.cpp
):
</p>
<p>
</p>
@@ -211,7 +211,7 @@
<p>
</p>
<p>
- On C++11, it is possible (but not required) to directly use <code class="computeroutput"><span class="keyword">this</span></code> instead of the special symbol <code class="computeroutput"><span class="identifier">this_</span></code>. <sup>[<a name="scope_exit.Tutorial.capturing_the_object__this_.f0" href="#ftn.scope_exit.Tutorial.capturing_the_object__this_.f0" class="footnote">4</a>]</sup> For example (see also "world_this.cpp"
):
+ On C++11, it is possible (but not required) to directly use <code class="computeroutput"><span class="keyword">this</span></code> instead of the special symbol <code class="computeroutput"><span class="identifier">this_</span></code>. <sup>[<a name="scope_exit.Tutorial.capturing_the_object__this_.f0" href="#ftn.scope_exit.Tutorial.capturing_the_object__this_.f0" class="footnote">3</a>]</sup> For example (see also world_this.cpp
):
</p>
<p>
</p>
@@ -235,13 +235,13 @@
No Variable</a>
</h3></div></div></div>
<p>
- It is possible to declare a <a class="link" href="../index.html" title="Chapter 1. Boost.ScopeExit 1.1.0">ScopeExit</a> block
+ It is possible to declare <a class="link" href="../index.html" title="Chapter 1. Boost.ScopeExit 1.1.0">ScopeExit</a> code
that captures no variable. In this case, the list of captured variables is
replaced by the <code class="computeroutput"><span class="keyword">void</span></code> keyword
(similarly to the C syntax that allows to declare a function with no parameter
- using <code class="computeroutput"><span class="identifier">result_type</span> <span class="identifier">func</span><span class="special">(</span><span class="keyword">void</span><span class="special">);</span></code>).
- <sup>[<a name="scope_exit.Tutorial.capturing_no_variable.f0" href="#ftn.scope_exit.Tutorial.capturing_no_variable.f0" class="footnote">5</a>]</sup> For example, this can be useful when the <a class="link" href="../index.html" title="Chapter 1. Boost.ScopeExit 1.1.0">ScopeExit</a>
- body only needs to access global variables (see also "world_void.cpp"
):
+ using <code class="literal"><span class="emphasis"><em>result-type function-name</em></span></code><code class="computeroutput"><span class="special">(</span><span class="keyword">void</span><span class="special">)</span></code>).
+ <sup>[<a name="scope_exit.Tutorial.capturing_no_variable.f0" href="#ftn.scope_exit.Tutorial.capturing_no_variable.f0" class="footnote">4</a>]</sup> For example, this can be useful when the <a class="link" href="../index.html" title="Chapter 1. Boost.ScopeExit 1.1.0">ScopeExit</a>
+ body only needs to access global variables (see also world_void.cpp
):
</p>
<p>
</p>
@@ -279,7 +279,7 @@
On C++11 compliers, it is also possible to capture all the variables in scope
without naming them one by one using the special macro <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">BOOST_SCOPE_EXIT_ALL</a></code>
instead of <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code>.
- <sup>[<a name="scope_exit.Tutorial.capturing_all_variables__c__11_only_.f0" href="#ftn.scope_exit.Tutorial.capturing_all_variables__c__11_only_.f0" class="footnote">6</a>]</sup>
+ <sup>[<a name="scope_exit.Tutorial.capturing_all_variables__c__11_only_.f0" href="#ftn.scope_exit.Tutorial.capturing_all_variables__c__11_only_.f0" class="footnote">5</a>]</sup>
</p>
<p>
Following the same syntax adopted by C++11 lambdas, the <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">BOOST_SCOPE_EXIT_ALL</a></code>
@@ -289,7 +289,7 @@
that no variable name is specified by these leading captures). Additional
captures of specific variables can follow the leading <code class="computeroutput"><span class="special">&</span></code>
or <code class="computeroutput"><span class="special">=</span></code> and they will override
- the default reference or value captures. For example (see also "world_checkpoint_all.cpp"
):
+ the default reference or value captures. For example (see also world_checkpoint_all.cpp
):
</p>
<p>
</p>
@@ -344,9 +344,9 @@
<p>
Various versions of the GCC compiler do not compile <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code>
inside templates (see the Reference section
- for more information). <sup>[<a name="scope_exit.Tutorial.gcc_template_workaround.f0" href="#ftn.scope_exit.Tutorial.gcc_template_workaround.f0" class="footnote">7</a>]</sup> As a workaround, <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_TPL.html" title="Macro BOOST_SCOPE_EXIT_TPL">BOOST_SCOPE_EXIT_TPL</a></code>
+ for more information). As a workaround, <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_TPL.html" title="Macro BOOST_SCOPE_EXIT_TPL">BOOST_SCOPE_EXIT_TPL</a></code>
should be used instead of <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code>
- in these cases:
+ in these cases: <sup>[<a name="scope_exit.Tutorial.gcc_template_workaround.f0" href="#ftn.scope_exit.Tutorial.gcc_template_workaround.f0" class="footnote">6</a>]</sup>
</p>
<p>
</p>
@@ -373,14 +373,14 @@
</div>
<div class="footnotes">
<br><hr width="100" align="left">
-<div class="footnote"><p><sup>[<a id="ftn.scope_exit.Tutorial.capturing_variables.f0" href="#scope_exit.Tutorial.capturing_variables.f0" class="para">3</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.scope_exit.Tutorial.capturing_variables.f0" href="#scope_exit.Tutorial.capturing_variables.f0" class="para">2</a>] </sup>
The macro <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_END.html" title="Macro BOOST_SCOPE_EXIT_END">BOOST_SCOPE_EXIT_END</a></code>
can still be used on C++11 to write portable code that can be used on both
C++03 and C++11 compilers. Using <code class="computeroutput"><span class="special">;</span></code>
instead of <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_END.html" title="Macro BOOST_SCOPE_EXIT_END">BOOST_SCOPE_EXIT_END</a></code>
on C++03 compilers will generate a (possibly cryptic) compiler error.
</p></div>
-<div class="footnote"><p><sup>[<a id="ftn.scope_exit.Tutorial.capturing_the_object__this_.f0" href="#scope_exit.Tutorial.capturing_the_object__this_.f0" class="para">4</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.scope_exit.Tutorial.capturing_the_object__this_.f0" href="#scope_exit.Tutorial.capturing_the_object__this_.f0" class="para">3</a>] </sup>
The special symbol <code class="computeroutput"><span class="identifier">this_</span></code>
can still be used on C++11 to write portable code that can be used on both
C++03 and C++11 compilers. Unfortunately, using <code class="computeroutput"><span class="keyword">this</span></code>
@@ -388,14 +388,15 @@
compilers leads to undefined behaviour (it will likely generate a compiler
error but that is not guaranteed).
</p></div>
-<div class="footnote"><p><sup>[<a id="ftn.scope_exit.Tutorial.capturing_no_variable.f0" href="#scope_exit.Tutorial.capturing_no_variable.f0" class="para">5</a>] </sup>
- Unfortunately, it is not possible to simply invoke the <a class="link" href="../index.html" title="Chapter 1. Boost.ScopeExit 1.1.0">ScopeExit</a>
- macro with no parameters <code class="computeroutput"><span class="identifier">BOOST_SCOPE_EXIT</span><span class="special">()</span></code> because the preprocessor cannot detect
+<div class="footnote"><p><sup>[<a id="ftn.scope_exit.Tutorial.capturing_no_variable.f0" href="#scope_exit.Tutorial.capturing_no_variable.f0" class="para">4</a>] </sup>
+ <span class="bold"><strong>Rationale.</strong></span> Unfortunately, it is not possible
+ to simply invoke the <a class="link" href="../index.html" title="Chapter 1. Boost.ScopeExit 1.1.0">ScopeExit</a> macro
+ with no parameters <code class="computeroutput"><span class="identifier">BOOST_SCOPE_EXIT</span><span class="special">()</span></code> because the preprocessor cannot detect
emptiness of a macro parameter when the parameter can start with a non-alphanumeric
symbol (which is the case when capturing a variable by reference <code class="computeroutput"><span class="special">&</span><span class="identifier">variable</span></code>).
</p></div>
-<div class="footnote"><p><sup>[<a id="ftn.scope_exit.Tutorial.capturing_all_variables__c__11_only_.f0" href="#scope_exit.Tutorial.capturing_all_variables__c__11_only_.f0" class="para">6</a>] </sup>
- The <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">BOOST_SCOPE_EXIT_ALL</a></code>
+<div class="footnote"><p><sup>[<a id="ftn.scope_exit.Tutorial.capturing_all_variables__c__11_only_.f0" href="#scope_exit.Tutorial.capturing_all_variables__c__11_only_.f0" class="para">5</a>] </sup>
+ <span class="bold"><strong>Rationale.</strong></span> The <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">BOOST_SCOPE_EXIT_ALL</a></code>
macro is only defined on C++11 compilers. Using <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">BOOST_SCOPE_EXIT_ALL</a></code>
on C++03 compilers will generate a (possibly cryptic) compiler error. Note
that a new macro <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">BOOST_SCOPE_EXIT_ALL</a></code>
@@ -407,9 +408,9 @@
or postfixed by alphanumeric tokens (this is not an issue for <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">BOOST_SCOPE_EXIT_ALL</a></code> which always
has <code class="computeroutput"><span class="special">&</span></code> or <code class="computeroutput"><span class="special">=</span></code> as the first capture so the first capture
token is never compared with neither <code class="computeroutput"><span class="keyword">void</span></code>
- of <code class="computeroutput"><span class="identifier">this_</span></code> for this macro).
+ or <code class="computeroutput"><span class="identifier">this_</span></code> for this macro).
</p></div>
-<div class="footnote"><p><sup>[<a id="ftn.scope_exit.Tutorial.gcc_template_workaround.f0" href="#scope_exit.Tutorial.gcc_template_workaround.f0" class="para">7</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.scope_exit.Tutorial.gcc_template_workaround.f0" href="#scope_exit.Tutorial.gcc_template_workaround.f0" class="para">6</a>] </sup>
GCC versions compliant with C++11 do not present this issue and given that
<code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">BOOST_SCOPE_EXIT_ALL</a></code>
is only available on C++11 compilers, there is no need for a <code class="computeroutput"><span class="identifier">BOOST_SCOPE_EXIT_ALL_TPL</span></code> macro.
@@ -419,14 +420,14 @@
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2006-2012 Alexander Nasonov, Lorenzo Caminiti<p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ 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)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="Getting_Started.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="annex__alternatives.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
+<a accesskey="p" href="Getting_Started.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../reference.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
Modified: sandbox/local_function/libs/scope_exit/doc/html/scope_exit/acknowledgements.html
==============================================================================
--- sandbox/local_function/libs/scope_exit/doc/html/scope_exit/acknowledgements.html (original)
+++ sandbox/local_function/libs/scope_exit/doc/html/scope_exit/acknowledgements.html 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -6,7 +6,7 @@
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="../index.html" title="Chapter 1. Boost.ScopeExit 1.1.0">
<link rel="up" href="../index.html" title="Chapter 1. Boost.ScopeExit 1.1.0">
-<link rel="prev" href="../BOOST_SCOPE_EXIT_CONFIG_NO_CPP11.html" title="Macro BOOST_SCOPE_EXIT_CONFIG_NO_CPP11">
+<link rel="prev" href="No_Variadic_Macros.html" title="Annex: No Variadic Macros">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
@@ -19,17 +19,20 @@
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="../BOOST_SCOPE_EXIT_CONFIG_NO_CPP11.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a>
+<a accesskey="p" href="No_Variadic_Macros.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="scope_exit.acknowledgements"></a><a class="link" href="acknowledgements.html" title="Acknowledgements">Acknowledgements</a>
</h2></div></div></div>
<p>
- <span class="emphasis"><em>In chronological order.</em></span>
+ Alexander Nasonov is the original library author.
</p>
<p>
- Alexander Nasonov is the original library author.
+ Lorenzo Caminiti added variadic macro support, capture of the object <code class="computeroutput"><span class="identifier">this_</span></code>, empty captures using <code class="computeroutput"><span class="keyword">void</span></code>, and <code class="computeroutput"><span class="identifier">BOOST_SCOPE_EXIT_ALL</span></code>.
+ </p>
+<p>
+ <span class="emphasis"><em>Thanks to the following people (in chronological order).</em></span>
</p>
<p>
Maxim Yegorushkin for sharing code where he used a local struct to clean up
@@ -55,21 +58,18 @@
<p>
Adam Butcher for a workaround to error C2355 when deducing the type of <code class="computeroutput"><span class="keyword">this</span></code> on some MSVC versions.
</p>
-<p>
- Lorenzo Caminiti for variadic macro support, capture of the object <code class="computeroutput"><span class="identifier">this_</span></code>, empty captures using <code class="computeroutput"><span class="keyword">void</span></code>, and <code class="computeroutput"><span class="identifier">BOOST_SCOPE_EXIT_ALL</span></code>.
- </p>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2006-2012 Alexander Nasonov, Lorenzo Caminiti<p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ 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)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="../BOOST_SCOPE_EXIT_CONFIG_NO_CPP11.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a>
+<a accesskey="p" href="No_Variadic_Macros.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a>
</div>
</body>
</html>
Modified: sandbox/local_function/libs/scope_exit/doc/html/scope_exit/annex__alternatives.html
==============================================================================
--- sandbox/local_function/libs/scope_exit/doc/html/scope_exit/annex__alternatives.html (original)
+++ sandbox/local_function/libs/scope_exit/doc/html/scope_exit/annex__alternatives.html 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -6,7 +6,7 @@
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="../index.html" title="Chapter 1. Boost.ScopeExit 1.1.0">
<link rel="up" href="../index.html" title="Chapter 1. Boost.ScopeExit 1.1.0">
-<link rel="prev" href="Tutorial.html" title="Tutorial">
+<link rel="prev" href="../BOOST_SCOPE_EXIT_CONFIG_NO_CPP11.html" title="Macro BOOST_SCOPE_EXIT_CONFIG_NO_CPP11">
<link rel="next" href="No_Variadic_Macros.html" title="Annex: No Variadic Macros">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
@@ -20,34 +20,26 @@
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="Tutorial.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="No_Variadic_Macros.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
+<a accesskey="p" href="../BOOST_SCOPE_EXIT_CONFIG_NO_CPP11.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="No_Variadic_Macros.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="scope_exit.annex__alternatives"></a><a class="link" href="annex__alternatives.html" title="Annex: Alternatives">Annex: Alternatives</a>
</h2></div></div></div>
-<div class="toc"><dl>
-<dt><span class="section">Try-Catch</span></dt>
-<dt><span class="section">RAII</span></dt>
-<dt><span class="section">Scope Guards</span></dt>
-<dt><span class="section"><a href="annex__alternatives.html#scope_exit.annex__alternatives.the_d_programming_language">The
- D Programming Language</a></span></dt>
-<dt><span class="section">C++11 Lambdas</span></dt>
-</dl></div>
<p>
This section presents some alternatives and work related to <a class="link" href="../index.html" title="Chapter 1. Boost.ScopeExit 1.1.0">ScopeExit</a>.
</p>
-<div class="section">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="scope_exit.annex__alternatives.try_catch"></a><a class="link" href="annex__alternatives.html#scope_exit.annex__alternatives.try_catch" title="Try-Catch">Try-Catch</a>
-</h3></div></div></div>
-<p>
- This is an example of using a badly designed <code class="computeroutput"><span class="identifier">file</span></code>
- class. An instance of <code class="computeroutput"><span class="identifier">file</span></code>
- does not close the file in its destructor, a programmer is expected to call
- the <code class="computeroutput"><span class="identifier">close</span></code> member function
- explicitly. For example (see also "try_catch.cpp"
):
- </p>
+<h6>
+<a name="scope_exit.annex__alternatives.h0"></a>
+ <span><a name="scope_exit.annex__alternatives.try_catch"></a></span><a class="link" href="annex__alternatives.html#scope_exit.annex__alternatives.try_catch">Try-Catch</a>
+ </h6>
+<p>
+ This is an example of using a badly designed <code class="computeroutput"><span class="identifier">file</span></code>
+ class. An instance of <code class="computeroutput"><span class="identifier">file</span></code>
+ does not close the file in its destructor, a programmer is expected to call
+ the <code class="computeroutput"><span class="identifier">close</span></code> member function explicitly.
+ For example (see also try_catch.cpp
):
+ </p>
<p>
</p>
<pre class="programlisting"><span class="identifier">file</span> <span class="identifier">passwd</span><span class="special">;</span>
@@ -62,31 +54,31 @@
<span class="special">}</span>
</pre>
<p>
- </p>
+ </p>
<p>
- Note the following issues with this approach:
- </p>
+ Note the following issues with this approach:
+ </p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
- The <code class="computeroutput"><span class="identifier">passwd</span></code> object is
- defined outside of the <code class="computeroutput"><span class="keyword">try</span></code>
- block because this object is required inside the <code class="computeroutput"><span class="keyword">catch</span></code>
- block to close the file.
- </li>
+ The <code class="computeroutput"><span class="identifier">passwd</span></code> object is defined
+ outside of the <code class="computeroutput"><span class="keyword">try</span></code> block because
+ this object is required inside the <code class="computeroutput"><span class="keyword">catch</span></code>
+ block to close the file.
+ </li>
<li class="listitem">
- The <code class="computeroutput"><span class="identifier">passwd</span></code> object is
- not fully constructed until after the <code class="computeroutput"><span class="identifier">open</span></code>
- member function returns.
- </li>
+ The <code class="computeroutput"><span class="identifier">passwd</span></code> object is not
+ fully constructed until after the <code class="computeroutput"><span class="identifier">open</span></code>
+ member function returns.
+ </li>
<li class="listitem">
- If opening throws, the <code class="computeroutput"><span class="identifier">passwd</span><span class="special">.</span><span class="identifier">close</span><span class="special">()</span></code> should not be called, hence the call
- to <code class="computeroutput"><span class="identifier">passwd</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">()</span></code>.
- </li>
+ If opening throws, the <code class="computeroutput"><span class="identifier">passwd</span><span class="special">.</span><span class="identifier">close</span><span class="special">()</span></code> should not be called, hence the call
+ to <code class="computeroutput"><span class="identifier">passwd</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">()</span></code>.
+ </li>
</ul></div>
<p>
- The <a class="link" href="../index.html" title="Chapter 1. Boost.ScopeExit 1.1.0">ScopeExit</a> approach does not have any
- of these issues. For example (see also "try_catch.cpp"
):
- </p>
+ The <a class="link" href="../index.html" title="Chapter 1. Boost.ScopeExit 1.1.0">ScopeExit</a> approach does not have any
+ of these issues. For example (see also try_catch.cpp
):
+ </p>
<p>
</p>
<pre class="programlisting"><span class="keyword">try</span> <span class="special">{</span>
@@ -100,18 +92,17 @@
<span class="special">}</span>
</pre>
<p>
- </p>
-</div>
-<div class="section">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="scope_exit.annex__alternatives.raii"></a><a class="link" href="annex__alternatives.html#scope_exit.annex__alternatives.raii" title="RAII">RAII</a>
-</h3></div></div></div>
-<p>
- RAII
- is absolutely perfect for the <code class="computeroutput"><span class="identifier">file</span></code>
- class introduced above. Use of a properly designed <code class="computeroutput"><span class="identifier">file</span></code>
- class would look like:
- </p>
+ </p>
+<h6>
+<a name="scope_exit.annex__alternatives.h1"></a>
+ <span><a name="scope_exit.annex__alternatives.raii"></a></span><a class="link" href="annex__alternatives.html#scope_exit.annex__alternatives.raii">RAII</a>
+ </h6>
+<p>
+ RAII
+ is absolutely perfect for the <code class="computeroutput"><span class="identifier">file</span></code>
+ class introduced above. Use of a properly designed <code class="computeroutput"><span class="identifier">file</span></code>
+ class would look like:
+ </p>
<pre class="programlisting"><span class="keyword">try</span> <span class="special">{</span>
<span class="identifier">file</span> <span class="identifier">passwd</span><span class="special">(</span><span class="string">"/etc/passwd"</span><span class="special">);</span>
<span class="comment">// ...</span>
@@ -121,18 +112,18 @@
<span class="special">}</span>
</pre>
<p>
- However, using RAII
- to build up a <a href="http://www.research.att.com/~bs/glossary.html#Gstrong-guarantee" target="_top">strong
- guarantee</a> could introduce a lot of non-reusable RAII
- types. For example:
- </p>
+ However, using RAII
+ to build up a <a href="http://www.research.att.com/~bs/glossary.html#Gstrong-guarantee" target="_top">strong
+ guarantee</a> could introduce a lot of non-reusable RAII
+ types. For example:
+ </p>
<pre class="programlisting"><span class="identifier">persons_</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">a_person</span><span class="special">);</span>
<span class="identifier">pop_back_if_not_commit</span> <span class="identifier">pop_back_if_not_commit_guard</span><span class="special">(</span><span class="identifier">commit</span><span class="special">,</span> <span class="identifier">persons_</span><span class="special">);</span>
</pre>
<p>
- The <code class="computeroutput"><span class="identifier">pop_back_if_not_commit</span></code>
- class is either defined out of the scope or as a local class:
- </p>
+ The <code class="computeroutput"><span class="identifier">pop_back_if_not_commit</span></code>
+ class is either defined out of the scope or as a local class:
+ </p>
<pre class="programlisting"><span class="keyword">class</span> <span class="identifier">pop_back_if_not_commit</span> <span class="special">{</span>
<span class="keyword">bool</span> <span class="identifier">commit_</span><span class="special">;</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">person</span><span class="special">>&</span> <span class="identifier">vec_</span><span class="special">;</span>
@@ -143,26 +134,26 @@
<span class="special">};</span>
</pre>
<p>
- In some cases <a href="http://www.research.att.com/~bs/glossary.html#Gstrong-guarantee" target="_top">strong
- guarantee</a> can be accomplished with standard utilities:
- </p>
+ In some cases <a href="http://www.research.att.com/~bs/glossary.html#Gstrong-guarantee" target="_top">strong
+ guarantee</a> can be accomplished with standard utilities:
+ </p>
<pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">auto_ptr</span><span class="special"><</span><span class="identifier">Person</span><span class="special">></span> <span class="identifier">superman_ptr</span><span class="special">(</span><span class="keyword">new</span> <span class="identifier">superman</span><span class="special">());</span>
<span class="identifier">persons_</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">superman_ptr</span><span class="special">.</span><span class="identifier">get</span><span class="special">());</span>
<span class="identifier">superman_ptr</span><span class="special">.</span><span class="identifier">release</span><span class="special">();</span> <span class="comment">// persons_ successfully took ownership</span>
</pre>
<p>
- Or with specialized containers such as <a href="../../../../../libs/ptr_container/doc/ptr_container.html" target="_top">Boost
- Pointer Container Library</a> or <a href="../../../../../libs/multi_index/doc/index.html" target="_top">Boost
- Multi-Index Containers Library</a>.
- </p>
-</div>
-<div class="section">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="scope_exit.annex__alternatives.scope_guards"></a><a class="link" href="annex__alternatives.html#scope_exit.annex__alternatives.scope_guards" title="Scope Guards">Scope Guards</a>
-</h3></div></div></div>
+ Or with specialized containers such as <a href="../../../../../libs/ptr_container/doc/ptr_container.html" target="_top">Boost
+ Pointer Container Library</a> or <a href="../../../../../libs/multi_index/doc/index.html" target="_top">Boost
+ Multi-Index Containers Library</a>.
+ </p>
+<h6>
+<a name="scope_exit.annex__alternatives.h2"></a>
+ <span><a name="scope_exit.annex__alternatives.scope_guards"></a></span><a class="link" href="annex__alternatives.html#scope_exit.annex__alternatives.scope_guards">Scope
+ Guards</a>
+ </h6>
<p>
- Imagine that a new currency rate is introduced before performing a transaction:
- </p>
+ Imagine that a new currency rate is introduced before performing a transaction:
+ </p>
<p>
</p>
<pre class="programlisting"><span class="keyword">bool</span> <span class="identifier">commit</span> <span class="special">=</span> <span class="keyword">false</span><span class="special">;</span>
@@ -174,12 +165,12 @@
<span class="comment">// Transaction...</span>
</pre>
<p>
- </p>
+ </p>
<p>
- If the transaction does not complete, the currency must be erased from <code class="computeroutput"><span class="identifier">rates</span></code>. This can be done with ScopeGuard
- and Boost.Lambda
- (or Boost.Phoenix):
- </p>
+ If the transaction does not complete, the currency must be erased from <code class="computeroutput"><span class="identifier">rates</span></code>. This can be done with ScopeGuard
+ and Boost.Lambda (or
+ Boost.Phoenix):
+ </p>
<pre class="programlisting"><span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">lambda</span><span class="special">;</span>
<span class="identifier">ON_BLOCK_EXIT</span><span class="special">(</span>
@@ -201,32 +192,30 @@
<span class="identifier">commit</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">;</span>
</pre>
<p>
- Note the following issues with this approach:
- </p>
+ Note the following issues with this approach:
+ </p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
- Boost.Lambda
- expressions are hard to write correctly (e.g., overloaded functions must
- be explicitly casted, as demonstrated in the example above).
- </li>
+ Boost.Lambda expressions
+ are hard to write correctly (e.g., overloaded functions must be explicitly
+ casted, as demonstrated in the example above).
+ </li>
<li class="listitem">
- The condition in the <code class="computeroutput"><span class="identifier">if_</span></code>
- expression refers to <code class="computeroutput"><span class="identifier">commit</span></code>
- variable indirectly through the <code class="computeroutput"><span class="identifier">_1</span></code>
- placeholder reducing readability.
- </li>
+ The condition in the <code class="computeroutput"><span class="identifier">if_</span></code>
+ expression refers to <code class="computeroutput"><span class="identifier">commit</span></code>
+ variable indirectly through the <code class="computeroutput"><span class="identifier">_1</span></code>
+ placeholder reducing readability.
+ </li>
<li class="listitem">
- Setting a breakpoint inside <code class="computeroutput"><span class="identifier">if_</span><span class="special">[...]</span></code> requires in-depth knowledge of
- Boost.Lambda
- and debugging techniques.
- </li>
+ Setting a breakpoint inside <code class="computeroutput"><span class="identifier">if_</span><span class="special">[...]</span></code> requires in-depth knowledge of Boost.Lambda and debugging
+ techniques.
+ </li>
</ul></div>
<p>
- This code will look much better with C++11 lambdas:
- </p>
+ This code will look much better with C++11 lambdas:
+ </p>
<pre class="programlisting"><span class="identifier">ON_BLOCK_EXIT</span><span class="special">(</span>
- <span class="special">[</span><span class="identifier">currency_rate_inserted</span><span class="special">,</span> <span class="special">&</span><span class="identifier">commit</span><span class="special">,</span> <span class="special">&</span><span class="identifier">rates</span><span class="special">,</span> <span class="special">&</span><span class="identifier">currency</span><span class="special">]()</span> <span class="special">-></span> <span class="keyword">void</span>
- <span class="special">{</span>
+ <span class="special">[</span><span class="identifier">currency_rate_inserted</span><span class="special">,</span> <span class="special">&</span><span class="identifier">commit</span><span class="special">,</span> <span class="special">&</span><span class="identifier">rates</span><span class="special">,</span> <span class="special">&</span><span class="identifier">currency</span><span class="special">]()</span> <span class="special">{</span>
<span class="keyword">if</span><span class="special">(</span><span class="identifier">currency_rate_inserted</span> <span class="special">&&</span> <span class="special">!</span><span class="identifier">commit</span><span class="special">)</span> <span class="identifier">rates</span><span class="special">.</span><span class="identifier">erase</span><span class="special">(</span><span class="identifier">currency</span><span class="special">);</span>
<span class="special">}</span>
<span class="special">);</span>
@@ -236,9 +225,9 @@
<span class="identifier">commit</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">;</span>
</pre>
<p>
- With <a class="link" href="../index.html" title="Chapter 1. Boost.ScopeExit 1.1.0">ScopeExit</a> we can simply do the following
- (see also "scope_guard.cpp"
):
- </p>
+ With <a class="link" href="../index.html" title="Chapter 1. Boost.ScopeExit 1.1.0">ScopeExit</a> we can simply do the following
+ (see also scope_guard.cpp
):
+ </p>
<p>
</p>
<pre class="programlisting"><span class="identifier">BOOST_SCOPE_EXIT</span><span class="special">(</span><span class="identifier">currency_rate_inserted</span><span class="special">,</span> <span class="special">&</span><span class="identifier">commit</span><span class="special">,</span> <span class="special">&</span><span class="identifier">rates</span><span class="special">,</span> <span class="special">&</span><span class="identifier">currency</span><span class="special">)</span> <span class="special">{</span>
@@ -250,42 +239,39 @@
<span class="identifier">commit</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">;</span>
</pre>
<p>
- </p>
-</div>
-<div class="section">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="scope_exit.annex__alternatives.the_d_programming_language"></a><a class="link" href="annex__alternatives.html#scope_exit.annex__alternatives.the_d_programming_language" title="The D Programming Language">The
- D Programming Language</a>
-</h3></div></div></div>
-<p>
- <a class="link" href="../index.html" title="Chapter 1. Boost.ScopeExit 1.1.0">ScopeExit</a> is similar to scope(exit)
- feature built into the D
- programming language.
- </p>
+ </p>
+<h6>
+<a name="scope_exit.annex__alternatives.h3"></a>
+ <span><a name="scope_exit.annex__alternatives.the_d_programming_language"></a></span><a class="link" href="annex__alternatives.html#scope_exit.annex__alternatives.the_d_programming_language">The D Programming
+ Language</a>
+ </h6>
+<p>
+ <a class="link" href="../index.html" title="Chapter 1. Boost.ScopeExit 1.1.0">ScopeExit</a> is similar to scope(exit)
+ feature built into the D
+ programming language.
+ </p>
<p>
- A curious reader may notice that the library does not implement <code class="computeroutput"><span class="identifier">scope</span><span class="special">(</span><span class="identifier">success</span><span class="special">)</span></code>
- and <code class="computeroutput"><span class="identifier">scope</span><span class="special">(</span><span class="identifier">failure</span><span class="special">)</span></code>
- of the D language.
- Unfortunately, these are not possible in C++ because failure or success conditions
- cannot be determined by calling <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">uncaught_exception</span></code>
- (see Guru of the Week #47
- for more details about <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">uncaught_exception</span></code>
- and if it has any good use at all). However, this is not a big problem because
- these two D's
- constructs can be expressed in terms of scope(exit)
- and a <code class="computeroutput"><span class="keyword">bool</span> <span class="identifier">commit</span></code>
- variable as explained in the <a class="link" href="Tutorial.html" title="Tutorial">Tutorial</a>
- section.
- </p>
-</div>
-<div class="section">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="scope_exit.annex__alternatives.c__11_lambdas"></a><a class="link" href="annex__alternatives.html#scope_exit.annex__alternatives.c__11_lambdas" title="C++11 Lambdas">C++11 Lambdas</a>
-</h3></div></div></div>
+ A curious reader may notice that the library does not implement <code class="computeroutput"><span class="identifier">scope</span><span class="special">(</span><span class="identifier">success</span><span class="special">)</span></code> and <code class="computeroutput"><span class="identifier">scope</span><span class="special">(</span><span class="identifier">failure</span><span class="special">)</span></code> of the D
+ language. Unfortunately, these are not possible in C++ because failure or success
+ conditions cannot be determined by calling <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">uncaught_exception</span></code>
+ (see Guru of the Week #47
+ for more details about <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">uncaught_exception</span></code>
+ and if it has any good use at all). However, this is not a big problem because
+ these two D's
+ constructs can be expressed in terms of scope(exit)
+ and a <code class="computeroutput"><span class="keyword">bool</span> <span class="identifier">commit</span></code>
+ variable as explained in the <a class="link" href="Tutorial.html" title="Tutorial">Tutorial</a>
+ section.
+ </p>
+<h6>
+<a name="scope_exit.annex__alternatives.h4"></a>
+ <span><a name="scope_exit.annex__alternatives.c__11_lambdas"></a></span><a class="link" href="annex__alternatives.html#scope_exit.annex__alternatives.c__11_lambdas">C++11
+ Lambdas</a>
+ </h6>
<p>
- Using C++11 lambdas, it is relatively easy to implement the <a class="link" href="../index.html" title="Chapter 1. Boost.ScopeExit 1.1.0">ScopeExit</a>
- construct. For example (see also "world_lambda.cpp"
):
- </p>
+ Using C++11 lambdas, it is relatively easy to implement the <a class="link" href="../index.html" title="Chapter 1. Boost.ScopeExit 1.1.0">ScopeExit</a>
+ construct. For example (see also world_lambda.cpp
):
+ </p>
<p>
</p>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">functional</span><span class="special">></span>
@@ -311,24 +297,23 @@
<span class="special">}</span>
</pre>
<p>
- </p>
+ </p>
<p>
- However, this library allows to program the <a class="link" href="../index.html" title="Chapter 1. Boost.ScopeExit 1.1.0">ScopeExit</a>
- construct in a way that is portable between C++03 and C++11 compilers.
- </p>
-</div>
+ However, this library allows to program the <a class="link" href="../index.html" title="Chapter 1. Boost.ScopeExit 1.1.0">ScopeExit</a>
+ construct in a way that is portable between C++03 and C++11 compilers.
+ </p>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2006-2012 Alexander Nasonov, Lorenzo Caminiti<p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ 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)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="Tutorial.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="No_Variadic_Macros.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
+<a accesskey="p" href="../BOOST_SCOPE_EXIT_CONFIG_NO_CPP11.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="No_Variadic_Macros.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
Modified: sandbox/local_function/libs/scope_exit/doc/scope_exit.qbk
==============================================================================
--- sandbox/local_function/libs/scope_exit/doc/scope_exit.qbk (original)
+++ sandbox/local_function/libs/scope_exit/doc/scope_exit.qbk 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -11,8 +11,8 @@
[copyright 2006-2012 Alexander Nasonov, Lorenzo Caminiti]
[purpose execute arbitrary code at scope exit]
[license
- Distributed under the Boost Software License, Version 1.0.
- (See accompanying file LICENSE_1_0.txt or copy at
+ 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])
]
[authors
@@ -62,8 +62,8 @@
Nowadays, every C++ developer is familiar with the __RAII__ technique.
It binds resource acquisition and release to initialization and destruction of a variable that holds the resource.
But there are times when writing a special class for such variable is not worth the effort.
-
This is when the __scope_exit__ library comes into play.
+
Programmers can put resource acquisition directly in their code and next to it, they can write code that releases the resource using this library.
For example:
[footnote
@@ -72,7 +72,7 @@
See the __No_Variadic_Macros__ section for more details.
]
-[test_world]
+[world]
Read the __Tutorial__ section to find out how to write programs with __scope_exit__ or jump to the __Reference__ section.
@@ -87,7 +87,7 @@
The library should be usable on any compiler that supports __typeof__ except:
* MSVC 7.1 and 8.0 fail to link if a function with __scope_exit__ is included by multiple translation units.
-Furthermore, on MSVC 7.1 and 8.0 it is possible to capture the object `this_` only with native __typeof__ (and not in __typeof__ emulation mode).
+Furthermore, on MSVC 7.1 and 8.0 it is possible to capture the object `this_` only with native __typeof__ (and not in __typeof_emulation__ mode).
* GCC 3.3 cannot compile __scope_exit__ inside a template (see [@http://lists.boost.org/Archives/boost/2007/02/116235.php] for more details).
The authors tested the library on GCC 3.3, 3.4, 4.1, 4.2, 4.5.3 (with and without C++11 features [^-std=c++0x]), MSVC 8.0, and Intel 10.1 under Linux, Cygwin, and Windows 7.
@@ -103,11 +103,6 @@
The library implementation uses __typeof__ to automatically deduce the types of the __scope_exit__ captured variables (see the __Tutorial__ section).
In order to compile code in __typeof_emulation__ mode, all types should be properly registered with __typeof_REGISTER_TYPE__ or __typeof_REGISTER_TEMPLATE__ macros, or appropriate __typeof__ headers should be included.
-When using comma-separated lists to specify captures (see the __No_Variadic_Macros__ section), make sure that the `BOOST_PP_VARIADICS` macro is defined (either automatically by __pp__ or manually using compiler options `-D`, `/D`, etc).
-[footnote
-It is not sufficient for the `BOOST_NO_VARIADIC_MACROS` macro to be undefined, the `BOOST_PP_VARIADICS` macro must be defined.
-]
-
[endsect]
[endsect]
@@ -118,8 +113,8 @@
[section Capturing Variables]
-Imagine that we want to make many modifications to data members of the `world` class in the `world::add_person` function.
-You start with adding a new `person` object to a vector of persons:
+Imagine that we want to make many modifications to data members of some `world` class in its `world::add_person` member function.
+We start with adding a new `person` object to a vector of persons:
void world::add_person(person const& a_person) {
bool commit = false;
@@ -132,16 +127,16 @@
In particular, the last added person must be deleted from `persons_` if the function throws.
All we need is to define a delayed action (release of a resource) right after the direct action (resource acquisition).
-For example (see also [@../../test/world.cpp `"world.cpp"`]):
+For example (see also [@../../test/world.cpp =world.cpp=]):
-[test_world]
+[world]
-The block below point `(1)` is a __scope_exit__ declaration.
-Unlike point `(1)`, an execution of the __scope_exit__ body will be delayed until the end of the current scope. In this case it will be executed either after point `(4)` or on any exception.
+The block below point =(1)= is a __scope_exit__ declaration.
+Unlike point =(1)=, an execution of the __scope_exit__ body will be delayed until the end of the current scope. In this case it will be executed either after point =(4)= or on any exception.
(On various versions of the GCC compiler, it is necessary to use [macroref BOOST_SCOPE_EXIT_TPL] instead of [macroref BOOST_SCOPE_EXIT] within templates, see later in this section for details.)
The __scope_exit__ declaration starts with the [macroref BOOST_SCOPE_EXIT] macro invocation which accepts a comma-separated list of captured variables (a __pp_seq__ is also accepted here for compilers that do not support variadic macros and for backward compatibility with older versions of this library, see the __No_Variadic_Macros__ section).
-If a capture starts with the ampersand sign `&`, a reference to the captured variable will be available inside the __scope_exit__ body; otherwise, a copy of the variable will be made after the __scope_exit__ declaration at point `(1)` and only the copy will be available inside the body (in this case, the captured variable's type must be `CopyConstructible`).
+If a capture starts with the ampersand sign `&`, a reference to the captured variable will be available inside the __scope_exit__ body; otherwise, a copy of the variable will be made after the __scope_exit__ declaration at point =(1)= and only the copy will be available inside the body (in this case, the captured variable's type must be `CopyConstructible`).
In the example above, the variables `commit` and `persons_` are captured by reference because the final value of the `commit` variable should be used to determine whether to execute rollback actions or not and the action should modify the `persons_` object, not its copy.
This is the most common case but passing a variable by value is sometimes useful as well.
@@ -153,7 +148,7 @@
Using `;` instead of [macroref BOOST_SCOPE_EXIT_END] on C++03 compilers will generate a (possibly cryptic) compiler error.
]
-[warning
+[important
In order to comply with the STL exception safety requirements, the __scope_exit__ body must never throw (because the library implementation executes the body within a destructor).
This is true for all __scope_exit__ macros (including [macroref BOOST_SCOPE_EXIT_TPL] and [macroref BOOST_SCOPE_EXIT_ALL]) on both C++03 and C++11.
]
@@ -162,9 +157,9 @@
We use `person::evolution_` to store a version of the changes and increment it to cancel all rollback actions associated with those changes.
If we pass a current value of `evolution_` stored in the `checkpoint` variable by value, it remains unchanged within the __scope_exit__ body so we can compare it with the final value of `evolution_`.
If the latter was not incremented since we saved it, the rollback action inside the __scope_exit__ body should be executed.
-For example (see also [@../../test/world_checkpoint.cpp `"world_checkpoint.cpp"`]):
+For example (see also [@../../test/world_checkpoint.cpp =world_checkpoint.cpp=]):
-[test_world_checkpoint]
+[world_checkpoint]
When multiple __scope_exit__ blocks are declared within the same enclosing scope, the __scope_exit__ bodies are executed in the reversed order of their declarations.
@@ -174,18 +169,18 @@
Within a member function, it is also possible to capture the object `this`.
However, the special symbol `this_` must be used instead of `this` in the __scope_exit__ declaration and body to capture and access the object.
-For example (see also [@../../test/world_this.cpp `"world_this.cpp"`]):
+For example (see also [@../../test/world_this.cpp =world_this.cpp=]):
-[test_world_this_]
+[world_this_]
On C++11, it is possible (but not required) to directly use `this` instead of the special symbol `this_`.
[footnote
The special symbol `this_` can still be used on C++11 to write portable code that can be used on both C++03 and C++11 compilers.
Unfortunately, using `this` instead of `this_` on C++03 compilers leads to undefined behaviour (it will likely generate a compiler error but that is not guaranteed).
]
-For example (see also [@../../test/world_this.cpp `"world_this.cpp"`]):
+For example (see also [@../../test/world_this.cpp =world_this.cpp=]):
-[test_world_this]
+[world_this]
It is never possible to capture the object `this_` (or `this`) by reference because C++ does not allow to take a reference to `this`.
If the enclosing member function is constant then the captured object will also be constant, otherwise the captured object will be mutable.
@@ -194,14 +189,15 @@
[section Capturing No Variable]
-It is possible to declare a __scope_exit__ block that captures no variable.
-In this case, the list of captured variables is replaced by the `void` keyword (similarly to the C syntax that allows to declare a function with no parameter using `result_type func(void);`).
+It is possible to declare __scope_exit__ code that captures no variable.
+In this case, the list of captured variables is replaced by the `void` keyword (similarly to the C syntax that allows to declare a function with no parameter using [^['result-type function-name]]`(void)`).
[footnote
+*Rationale.*
Unfortunately, it is not possible to simply invoke the __scope_exit__ macro with no parameters `BOOST_SCOPE_EXIT()` because the preprocessor cannot detect emptiness of a macro parameter when the parameter can start with a non-alphanumeric symbol (which is the case when capturing a variable by reference `&variable`).
]
-For example, this can be useful when the __scope_exit__ body only needs to access global variables (see also [@../../test/world_void.cpp `"world_void.cpp"`]):
+For example, this can be useful when the __scope_exit__ body only needs to access global variables (see also [@../../test/world_void.cpp =world_void.cpp=]):
-[test_world_void]
+[world_void]
This same syntax is supported for both compilers with and without variadic macro support.
@@ -211,16 +207,17 @@
On C++11 compliers, it is also possible to capture all the variables in scope without naming them one by one using the special macro [macroref BOOST_SCOPE_EXIT_ALL] instead of [macroref BOOST_SCOPE_EXIT].
[footnote
+*Rationale.*
The [macroref BOOST_SCOPE_EXIT_ALL] macro is only defined on C++11 compilers.
Using [macroref BOOST_SCOPE_EXIT_ALL] on C++03 compilers will generate a (possibly cryptic) compiler error.
-Note that a new macro [macroref BOOST_SCOPE_EXIT_ALL] needed to be introduced instead of reusing [macroref BOOST_SCOPE_EXIT] because `BOOST_SCOPE_EXIT(&)` and `BOOST_SCOPE_EXIT(=)` could not be distinguished from `BOOST_SCOPE_EXIT(void)` or `BOOST_SCOPE_EXIT(this_)` using the preprocessor because the symbols `&` and `=` are neither prefxied or postfixed by alphanumeric tokens (this is not an issue for [macroref BOOST_SCOPE_EXIT_ALL] which always has `&` or `=` as the first capture so the first capture token is never compared with neither `void` of `this_` for this macro).
+Note that a new macro [macroref BOOST_SCOPE_EXIT_ALL] needed to be introduced instead of reusing [macroref BOOST_SCOPE_EXIT] because `BOOST_SCOPE_EXIT(&)` and `BOOST_SCOPE_EXIT(=)` could not be distinguished from `BOOST_SCOPE_EXIT(void)` or `BOOST_SCOPE_EXIT(this_)` using the preprocessor because the symbols `&` and `=` are neither prefxied or postfixed by alphanumeric tokens (this is not an issue for [macroref BOOST_SCOPE_EXIT_ALL] which always has `&` or `=` as the first capture so the first capture token is never compared with neither `void` or `this_` for this macro).
]
Following the same syntax adopted by C++11 lambdas, the [macroref BOOST_SCOPE_EXIT_ALL] macro accepts a comma-separated list of captures which must start with either `&` or `=` to capture all variables in scope respectively by reference or by value (note that no variable name is specified by these leading captures).
Additional captures of specific variables can follow the leading `&` or `=` and they will override the default reference or value captures.
-For example (see also [@../../test/world_checkpoint_all.cpp `"world_checkpoint_all.cpp"`]):
+For example (see also [@../../test/world_checkpoint_all.cpp =world_checkpoint_all.cpp=]):
-[test_world_checkpoint_all]
+[world_checkpoint_all]
The first __scope_exit__ declaration captures all variables in scope by reference but `checkpoint` and `this_` which are explicitly captured by value (in particular, `p` and `persons_` are captured by reference).
The second __scope_exit__ declaration instead captures all variables in scope by value but `p` which is captured by reference (in particular, `checkpoint`, `prev_id`, and `this` are captured by value).
@@ -230,12 +227,12 @@
[section GCC Template Workaround]
Various versions of the GCC compiler do not compile [macroref BOOST_SCOPE_EXIT] inside templates (see the __Reference__ section for more information).
+As a workaround, [macroref BOOST_SCOPE_EXIT_TPL] should be used instead of [macroref BOOST_SCOPE_EXIT] in these cases:
[footnote
GCC versions compliant with C++11 do not present this issue and given that [macroref BOOST_SCOPE_EXIT_ALL] is only available on C++11 compilers, there is no need for a `BOOST_SCOPE_EXIT_ALL_TPL` macro.
]
-As a workaround, [macroref BOOST_SCOPE_EXIT_TPL] should be used instead of [macroref BOOST_SCOPE_EXIT] in these cases:
-[test_world_tpl]
+[world_tpl]
The [macroref BOOST_SCOPE_EXIT_TPL] macro has the exact same syntax of [macroref BOOST_SCOPE_EXIT].
@@ -243,17 +240,19 @@
[endsect]
+[xinclude reference.xml]
+
[section Annex: Alternatives]
This section presents some alternatives and work related to __scope_exit__.
-[section Try-Catch]
+[h5 Try-Catch]
This is an example of using a badly designed `file` class.
An instance of `file` does not close the file in its destructor, a programmer is expected to call the `close` member function explicitly.
-For example (see also [@../../example/try_catch.cpp `"try_catch.cpp"`]):
+For example (see also [@../../example/try_catch.cpp =try_catch.cpp=]):
-[example_try_catch_bad]
+[try_catch_bad]
Note the following issues with this approach:
@@ -263,13 +262,11 @@
* If opening throws, the `passwd.close()` should not be called, hence the call to `passwd.is_open()`.
The __scope_exit__ approach does not have any of these issues.
-For example (see also [@../../example/try_catch.cpp `"try_catch.cpp"`]):
+For example (see also [@../../example/try_catch.cpp =try_catch.cpp=]):
-[example_try_catch_good]
-
-[endsect]
+[try_catch_good]
-[section RAII]
+[h5 RAII]
__RAII__ is absolutely perfect for the `file` class introduced above.
Use of a properly designed `file` class would look like:
@@ -307,13 +304,12 @@
Or with specialized containers such as __ptr_container__ or __multi_index__.
-[endsect]
-[section Scope Guards]
+[h5 Scope Guards]
Imagine that a new currency rate is introduced before performing a transaction:
-[example_scope_guard_decl]
+[scope_guard_decl]
If the transaction does not complete, the currency must be erased from `rates`.
This can be done with __scope_guard__ and __lambda__ (or __phoenix__):
@@ -347,8 +343,7 @@
This code will look much better with C++11 lambdas:
ON_BLOCK_EXIT(
- [currency_rate_inserted, &commit, &rates, ¤cy]() -> void
- {
+ [currency_rate_inserted, &commit, &rates, ¤cy]() {
if(currency_rate_inserted && !commit) rates.erase(currency);
}
);
@@ -357,13 +352,11 @@
commit = true;
-With __scope_exit__ we can simply do the following (see also [@../../example/scope_guard.cpp `"scope_guard.cpp"`]):
-
-[example_scope_guard_exit]
+With __scope_exit__ we can simply do the following (see also [@../../example/scope_guard.cpp =scope_guard.cpp=]):
-[endsect]
+[scope_guard_exit]
-[section The D Programming Language]
+[h5 The D Programming Language]
__scope_exit__ is similar to __D_scope_exit__ feature built into the __D__ programming language.
@@ -371,77 +364,70 @@
Unfortunately, these are not possible in C++ because failure or success conditions cannot be determined by calling `std::uncaught_exception` (see [@http://www.gotw.ca/gotw/047.htm Guru of the Week #47] for more details about `std::uncaught_exception` and if it has any good use at all).
However, this is not a big problem because these two __D__'s constructs can be expressed in terms of __D_scope_exit__ and a `bool commit` variable as explained in the __Tutorial__ section.
-[endsect]
-
-[section C++11 Lambdas]
+[h5 C++11 Lambdas]
Using C++11 lambdas, it is relatively easy to implement the __scope_exit__ construct.
-For example (see also [@../../test/world_lambda.cpp `"world_lambda.cpp"`]):
+For example (see also [@../../test/world_lambda.cpp =world_lambda.cpp=]):
-[test_world_lambda]
+[world_lambda]
However, this library allows to program the __scope_exit__ construct in a way that is portable between C++03 and C++11 compilers.
[endsect]
-[endsect]
-
[section:No_Variadic_Macros Annex: No Variadic Macros]
This section presents an alternative syntax for compilers without variadic macro support.
-[section Sequence Syntax]
+[h5 Sequence Syntax]
Most modern compilers support variadic macros (notably, these include GCC, MSVC, and all C++11 compilers).
However, in the rare case that programmers need to use this library on a complier without variaidc macros, this library also allows to specify the capture list using a __pp_seq__ where tokens are separated by round parenthesis `()`:
(capture1) (capture2) ... // All compilers.
-Instead of a comma-separated list that we have seen so far which requires variadic macros:
+Instead of the comma-separated list that we have seen so far which requires variadic macros:
capture1, capture2, ... // Only compilers with variadic macros.
-For example, the following syntax is accepted on all compilers with and without variadic macros (see also [@../../test/world_seq.cpp `"world_seq.cpp"`]):
+For example, the following syntax is accepted on all compilers with and without variadic macros (see also [@../../test/world_seq.cpp =world_seq.cpp=]):
-[test_world_seq]
+[world_seq]
Furthermore, older versions of this library used to only support the __pp_seq__ syntax so the above syntax is also supported for backward compatibility.
-However, in the current version of this library and on compilers with variadic macros, the syntax we have seen so far is preferred because more readable (see also [@../../test/world.cpp `"world.cpp"`]):
+However, in the current version of this library and on compilers with variadic macros, the comma-separated syntax we have seen so far is preferred because more readable (see also [@../../test/world.cpp =world.cpp=]):
-[test_world]
+[world]
Note how the same macros accept both syntaxes on compilers with variadic macros and only the __pp_seq__ syntax on compilers without variadic macros.
-Finally, an empty capture list is always specified using `void` on compilers with and without variaidc macros.
+Finally, an empty capture list is always specified using `void` on compilers with and without variaidc macros (see also [@../../test/world_void.cpp =world_void.cpp=]):
-[endsect]
+[world_void]
-[section Examples]
+[h5 Examples]
The following is a list of most of the examples presented in this documentation reprogrammed using the __pp_seq__ syntax instead of the comma-separated list:
[table
[ [Files] ]
- [ [[@../../test/world_checkpoint_seq.cpp "world_checkpoint_seq.cpp"]] ]
- [ [[@../../test/world_this_seq.cpp "world_this_seq.cpp"]] ]
- [ [[@../../test/world_checkpoint_all_seq.cpp "world_checkpoint_all_seq.cpp"]] ]
- [ [[@../../test/world_tpl_seq.cpp "world_tpl_seq.cpp"]] ]
- [ [[@../../example/try_catch_seq.cpp "try_catch_seq.cpp"]] ]
- [ [[@../../example/scope_guard_seq.cpp "scope_guard_seq.cpp"]] ]
+ [ [[@../../test/world_checkpoint_seq.cpp =world_checkpoint_seq.cpp=]] ]
+ [ [[@../../test/world_this_seq.cpp =world_this_seq.cpp=]] ]
+ [ [[@../../test/world_checkpoint_all_seq.cpp =world_checkpoint_all_seq.cpp=]] ]
+ [ [[@../../test/world_tpl_seq.cpp =world_tpl_seq.cpp=]] ]
+ [ [[@../../example/try_catch_seq.cpp =try_catch_seq.cpp=]] ]
+ [ [[@../../example/scope_guard_seq.cpp =scope_guard_seq.cpp=]] ]
]
[endsect]
-[endsect]
-
-
-[xinclude reference.xml]
-
[section Acknowledgements]
-['In chronological order.]
-
Alexander Nasonov is the original library author.
+Lorenzo Caminiti added variadic macro support, capture of the object `this_`, empty captures using `void`, and `BOOST_SCOPE_EXIT_ALL`.
+
+/Thanks to the following people (in chronological order)./
+
Maxim Yegorushkin for sharing code where he used a local struct to clean up resources.
Andrei Alexandrescu for pointing out the __D_scope_exit__ construct of the __D__ programming language.
@@ -456,7 +442,5 @@
Adam Butcher for a workaround to error C2355 when deducing the type of `this` on some MSVC versions.
-Lorenzo Caminiti for variadic macro support, capture of the object `this_`, empty captures using `void`, and `BOOST_SCOPE_EXIT_ALL`.
-
[endsect]
Modified: sandbox/local_function/libs/scope_exit/test/Jamfile.v2
==============================================================================
--- sandbox/local_function/libs/scope_exit/test/Jamfile.v2 (original)
+++ sandbox/local_function/libs/scope_exit/test/Jamfile.v2 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -7,56 +7,57 @@
import testing ;
-project : requirements
- <library>/boost/test//boost_test_exec_monitor
- <library>/boost//unit_test_framework
- <link>static
-;
-
-test-suite world_tests :
- [ run world.cpp ]
- [ run world_seq.cpp ]
-
- [ run world_void.cpp ]
-
- [ run world_this.cpp ]
- [ run world_this_seq.cpp ]
-
- [ run world_tpl.cpp ]
- [ run world_tpl_seq.cpp ]
-
- [ run world_checkpoint.cpp ]
- [ run world_checkpoint_seq.cpp ]
-
- [ run world_checkpoint_all.cpp ]
- [ run world_checkpoint_all_seq.cpp ]
-
- [ run world_lambda.cpp ]
-;
-
-test-suite native_tests :
- [ run native.cpp : : : <define>BOOST_TYPEOF_NATIVE ]
- [ run native_tpl.cpp : : : <define>BOOST_TYPEOF_NATIVE ]
- [ run native_this.cpp : : : <define>BOOST_TYPEOF_NATIVE ]
- [ compile-fail native_const_error.cpp : <define>BOOST_TYPEOF_NATIVE ]
- [ compile-fail native_cv_error.cpp : <define>BOOST_TYPEOF_NATIVE ]
- # Following test is known to fail on MSVC 7.1 and 8.0.
- [ run native_tu_test.cpp native_tu1.cpp native_tu2.cpp : : :
- <define>BOOST_TYPEOF_NATIVE ]
-;
-
-test-suite emulation_tests :
- [ run native.cpp : : : <define>BOOST_TYPEOF_EMULATION : emulation : ]
- [ run native_tpl.cpp : : : <define>BOOST_TYPEOF_EMULATION :
- emulation_tpl : ]
- [ run native_this.cpp : : : <define>BOOST_TYPEOF_EMULATION :
- emulation_this : ]
- [ compile-fail native_const_error.cpp : <define>BOOST_TYPEOF_EMULATION :
- emulation_const_error : ]
- [ compile-fail native_cv_error.cpp : <define>BOOST_TYPEOF_EMULATION :
- emulation_cv_error : ]
- # Following test is known to fail on MSVC 7.1 and 8.0.
- [ run native_tu_test.cpp native_tu1.cpp native_tu2.cpp : : :
- <define>BOOST_TYPEOF_EMULATION : emulation_tu_test : ]
-;
+project
+ : requirements
+ <library>/boost/test//boost_test_exec_monitor
+ <library>/boost//unit_test_framework
+ <link>static
+ ;
+
+test-suite world_tests
+ : [ run world.cpp ]
+ [ run world_seq.cpp ]
+
+ [ run world_void.cpp ]
+
+ [ run world_this.cpp ]
+ [ run world_this_seq.cpp ]
+
+ [ run world_tpl.cpp ]
+ [ run world_tpl_seq.cpp ]
+
+ [ run world_checkpoint.cpp ]
+ [ run world_checkpoint_seq.cpp ]
+
+ [ run world_checkpoint_all.cpp ]
+ [ run world_checkpoint_all_seq.cpp ]
+
+ [ run world_lambda.cpp ]
+ ;
+
+test-suite native_tests
+ : [ run native.cpp : : : <define>BOOST_TYPEOF_NATIVE ]
+ [ run native_tpl.cpp : : : <define>BOOST_TYPEOF_NATIVE ]
+ [ run native_this.cpp : : : <define>BOOST_TYPEOF_NATIVE ]
+ [ compile-fail native_const_error.cpp : <define>BOOST_TYPEOF_NATIVE ]
+ [ compile-fail native_cv_error.cpp : <define>BOOST_TYPEOF_NATIVE ]
+ # Following test is known to fail on MSVC 7.1 and 8.0.
+ [ run native_tu_test.cpp native_tu1.cpp native_tu2.cpp : : :
+ <define>BOOST_TYPEOF_NATIVE ]
+ ;
+
+test-suite emulation_tests
+ : [ run native.cpp : : : <define>BOOST_TYPEOF_EMULATION : emulation : ]
+ [ run native_tpl.cpp : : : <define>BOOST_TYPEOF_EMULATION :
+ emulation_tpl : ]
+ [ run native_this.cpp : : : <define>BOOST_TYPEOF_EMULATION :
+ emulation_this : ]
+ [ compile-fail native_const_error.cpp : <define>BOOST_TYPEOF_EMULATION :
+ emulation_const_error : ]
+ [ compile-fail native_cv_error.cpp : <define>BOOST_TYPEOF_EMULATION :
+ emulation_cv_error : ]
+ # Following test is known to fail on MSVC 7.1 and 8.0.
+ [ run native_tu_test.cpp native_tu1.cpp native_tu2.cpp : : :
+ <define>BOOST_TYPEOF_EMULATION : emulation_tu_test : ]
+ ;
Modified: sandbox/local_function/libs/utility/identity_type/doc/html/index.html
==============================================================================
--- sandbox/local_function/libs/utility/identity_type/doc/html/index.html (original)
+++ sandbox/local_function/libs/utility/identity_type/doc/html/index.html 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -24,7 +24,7 @@
That is because the <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span></code> type passed as the first macro parameter
contains a comma <code class="computeroutput"><span class="special">,</span></code> not wrapped
by round parenthesis <code class="computeroutput"><span class="special">()</span></code>. The preprocessor
- interprets that unwrapped comma as separation between macro parameters concluding
+ interprets that unwrapped comma as a separation between macro parameters concluding
that a total of three (and not two) parameters are passed to the macro in the
following order:
</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
@@ -37,12 +37,12 @@
Note that, differently from the compiler, the preprocessor only recognizes
round parameters <code class="computeroutput"><span class="special">()</span></code>. Angular
<code class="computeroutput"><span class="special"><></span></code> or squared <code class="computeroutput"><span class="special">[]</span></code> parenthesis are not used by the preprocessor
- in parsing the macro parameters.
+ when parsing the macro parameters.
</p></div><div class="section" title="Solution"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boost_utility_identitytype.solution"></a><a class="link" href="#boost_utility_identitytype.solution" title="Solution">Solution</a></h2></div></div></div><p>
- In some cases, it might be possible to workaround the issue above by avoiding
- to pass the type expression to the macro all together. For example, in some
- cases a <code class="computeroutput"><span class="keyword">typedef</span></code> can be used to
- specify the type expression with the commas outside the macro (see also <a class="ulink" href="../../test/var_ok.cpp" target="_top"><code class="literal">var_ok.cpp</code></a>):
+ In some cases, it might be possible to workaround this issue by avoiding to
+ pass the type expression to the macro all together. For example, in some cases
+ a <code class="computeroutput"><span class="keyword">typedef</span></code> can be used to specify
+ the type expression with the commas outside the macro (see also <a class="ulink" href="../../test/var.cpp" target="_top"><code class="literal">var.cpp</code></a>):
</p><p>
</p><pre class="programlisting"><span class="keyword">typedef</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="keyword">int</span><span class="special">,</span> <span class="keyword">char</span><span class="special">></span> <span class="identifier">map_type</span><span class="special">;</span>
<span class="identifier">VAR</span><span class="special">(</span> <span class="identifier">map_type</span><span class="special">,</span> <span class="number">3</span> <span class="special">);</span> <span class="comment">// OK.</span>
@@ -52,7 +52,7 @@
<code class="computeroutput"><a class="link" href="#header.boost.utility.identity_type_hpp" title="Header <boost/utility/identity_type.hpp>">boost/utility/identity_type.hpp</a></code>
defines a macro <code class="computeroutput"><a class="link" href="#BOOST_IDENTITY_TYPE" title="Macro BOOST_IDENTITY_TYPE">BOOST_IDENTITY_TYPE</a></code>
which can be used to workaround the issue while keeping the type expression
- as one of the macro parameters (see also <a class="ulink" href="../../test/var_ok.cpp" target="_top"><code class="literal">var_ok.cpp</code></a>).
+ as one of the macro parameters (see also <a class="ulink" href="../../test/var.cpp" target="_top"><code class="literal">var.cpp</code></a>).
</p><p>
</p><pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">utility</span><span class="special">/</span><span class="identifier">identity_type</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
@@ -61,13 +61,13 @@
</p><p>
This macro expands to an expression that evaluates (at compile-time) to the
specified type. The specified type is never split into multiple macro parameters
- because it is always wrapped by a set of extra round parenthesis <code class="computeroutput"><span class="special">()</span></code>. In fact, a total of two set of round parenthesis
+ because it is always wrapped by a set of extra round parenthesis <code class="computeroutput"><span class="special">()</span></code>. In fact, a total of two sets of round parenthesis
must be used: The parenthesis to invoke the macro <code class="computeroutput"><span class="identifier">BOOST_IDENTITY_TYPE</span><span class="special">(...)</span></code> plus the inner parenthesis to wrap the
- type within <code class="computeroutput"><span class="identifier">BOOST_IDENTITY_TYPE</span><span class="special">((...))</span></code>.
+ type passed to the macro <code class="computeroutput"><span class="identifier">BOOST_IDENTITY_TYPE</span><span class="special">((...))</span></code>.
</p><p>
This macro works on any <a class="ulink" href="http://www.open-std.org/JTC1/SC22/WG21/docs/standards" target="_top">C++03</a>
- compiler (because it does not require <a class="ulink" href="http://en.wikipedia.org/wiki/Variadic_macro" target="_top">variadic
- macro</a> support). <sup>[<a name="boost_utility_identitytype.solution.f0" href="#ftn.boost_utility_identitytype.solution.f0" class="footnote">1</a>]</sup>
+ compiler (because it does not use <a class="ulink" href="http://en.wikipedia.org/wiki/Variadic_macro" target="_top">variadic
+ macros</a>). <sup>[<a name="boost_utility_identitytype.solution.f0" href="#ftn.boost_utility_identitytype.solution.f0" class="footnote">1</a>]</sup>
</p></div><div class="section" title="Templates"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boost_utility_identitytype.templates"></a><a class="link" href="#boost_utility_identitytype.templates" title="Templates">Templates</a></h2></div></div></div><p>
This macro must be prefixed by <code class="computeroutput"><span class="keyword">typename</span></code>
when used within templates. For example, let's program a macro that declares
@@ -120,13 +120,11 @@
to it.
</p><p>
Let's program a macro that performs a static assertion on a <a class="ulink" href="http://en.wikipedia.org/wiki/Template_metaprogramming" target="_top">Template
- Meta-Programming</a> (TMP) meta-function (similarly to <a class="ulink" href="http://www.boost.org/doc/libs/1_36_0/libs/mpl/doc/refmanual/assert.html" target="_top">Boost.MPL
- <code class="computeroutput"><span class="identifier">BOOST_MPL_ASSERT</span></code></a>).
- The <code class="computeroutput"><a class="link" href="#BOOST_IDENTITY_TYPE" title="Macro BOOST_IDENTITY_TYPE">BOOST_IDENTITY_TYPE</a></code> macro
- can be used to pass a meta-function with multiple template parameters to the
- assert macro (so to handle the commas separating the template parameters).
- In this case, if the meta-function is an abstract type, it needs to be manipulated
- adding and removing a reference to it (see also <a class="ulink" href="../../test/tmp_assert.cpp" target="_top"><code class="literal">tmp_assert.cpp</code></a>):
+ Meta-Programming</a> (TMP) meta-function (similarly to Boost.MPL <a class="ulink" href="http://www.boost.org/doc/libs/1_36_0/libs/mpl/doc/refmanual/assert.html" target="_top"><code class="computeroutput"><span class="identifier">BOOST_MPL_ASSERT</span></code></a>). The <code class="computeroutput"><a class="link" href="#BOOST_IDENTITY_TYPE" title="Macro BOOST_IDENTITY_TYPE">BOOST_IDENTITY_TYPE</a></code> macro can be used
+ to pass a meta-function with multiple template parameters to the assert macro
+ (so to handle the commas separating the template parameters). In this case,
+ if the meta-function is an abstract type, it needs to be manipulated adding
+ and removing a reference to it (see also <a class="ulink" href="../../test/tmp_assert.cpp" target="_top"><code class="literal">tmp_assert.cpp</code></a>):
</p><p>
</p><pre class="programlisting"><span class="preprocessor">#define</span> <span class="identifier">TMP_ASSERT</span><span class="special">(</span><span class="identifier">metafunction</span><span class="special">)</span> <span class="special">\</span>
<span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">(</span><span class="identifier">metafunction</span><span class="special">::</span><span class="identifier">value</span><span class="special">)</span>
@@ -149,7 +147,7 @@
</pre><p>
</p></div><div class="section" title="Annex: Usages"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boost_utility_identitytype.annex__usages"></a><a class="link" href="#boost_utility_identitytype.annex__usages" title="Annex: Usages">Annex: Usages</a></h2></div></div></div><p>
The <code class="computeroutput"><a class="link" href="#BOOST_IDENTITY_TYPE" title="Macro BOOST_IDENTITY_TYPE">BOOST_IDENTITY_TYPE</a></code> macro
- can be used either in call of the user-defined macro (as shown by the examples
+ can be used either in the call of the user-defined macro (as shown by the examples
so far), or internally to the definition of the user macro. When <code class="computeroutput"><a class="link" href="#BOOST_IDENTITY_TYPE" title="Macro BOOST_IDENTITY_TYPE">BOOST_IDENTITY_TYPE</a></code> is used internally,
the call of the user macro will only have to specify the extra parenthesis
(see also <a class="ulink" href="../../test/tmp_assert.cpp" target="_top"><code class="literal">tmp_assert.cpp</code></a>):
@@ -163,18 +161,18 @@
</pre><p>
</p><p>
However, note that the user will <span class="emphasis"><em>always</em></span> have to specify
- the extra parenthesis even when the macro parameter contains no comma:
+ the extra parenthesis even when the macro parameters contain no comma:
</p><p>
</p><pre class="programlisting"><span class="identifier">TMP_ASSERT_PAREN</span><span class="special">((</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">is_const</span><span class="special"><</span><span class="keyword">int</span> <span class="keyword">const</span><span class="special">></span> <span class="special">));</span> <span class="comment">// Always extra `()`.</span>
<span class="identifier">TMP_ASSERT</span><span class="special">(</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">is_const</span><span class="special"><</span><span class="keyword">int</span> <span class="keyword">const</span><span class="special">></span> <span class="special">);</span> <span class="comment">// No extra `()` and no macro.</span>
</pre><p>
</p><p>
- In some cases, using the macro internally might provide the best syntax to
- the user. For example, this is the case for <code class="computeroutput"><span class="identifier">BOOST_MPL_ASSERT</span></code>
- because the large majority of template meta-programming expressions contain
- unwrapped commas so it is less confusing for the user to always specify the
- extra parenthesis <code class="computeroutput"><span class="special">((...))</span></code> instead
- of using <code class="computeroutput"><a class="link" href="#BOOST_IDENTITY_TYPE" title="Macro BOOST_IDENTITY_TYPE">BOOST_IDENTITY_TYPE</a></code>:
+ In some cases, using <code class="computeroutput"><a class="link" href="#BOOST_IDENTITY_TYPE" title="Macro BOOST_IDENTITY_TYPE">BOOST_IDENTITY_TYPE</a></code>
+ internally might provide the best syntax for the user. For example, this is
+ the case for <code class="computeroutput"><span class="identifier">BOOST_MPL_ASSERT</span></code>
+ because the majority of template meta-programming expressions contain unwrapped
+ commas so it is less confusing for the user to always specify the extra parenthesis
+ <code class="computeroutput"><span class="special">((...))</span></code> instead of using <code class="computeroutput"><a class="link" href="#BOOST_IDENTITY_TYPE" title="Macro BOOST_IDENTITY_TYPE">BOOST_IDENTITY_TYPE</a></code>:
</p><pre class="programlisting"><span class="identifier">BOOST_MPL_ASSERT</span><span class="special">((</span> <span class="comment">// Natural syntax.</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">and_</span><span class="special"><</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">is_const</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span>
@@ -182,9 +180,9 @@
<span class="special">></span>
<span class="special">));</span>
</pre><p>
- However, in other cases it might be preferable to not require the extra parenthesis
- in normal cases and handle commas as special cases using the <code class="computeroutput"><a class="link" href="#BOOST_IDENTITY_TYPE" title="Macro BOOST_IDENTITY_TYPE">BOOST_IDENTITY_TYPE</a></code>.
- For example, this is the case for <code class="computeroutput"><span class="identifier">BOOST_LOCAL_FUNCTION</span></code>
+ However, in other situations it might be preferable to not require the extra
+ parenthesis in common cases and handle commas as special cases using the <code class="computeroutput"><a class="link" href="#BOOST_IDENTITY_TYPE" title="Macro BOOST_IDENTITY_TYPE">BOOST_IDENTITY_TYPE</a></code>. For example, this
+ is the case for <code class="computeroutput"><span class="identifier">BOOST_LOCAL_FUNCTION</span></code>
for which always requiring the extra parenthesis <code class="computeroutput"><span class="special">((...))</span></code>
around the types would lead to an unnatural syntax for the local function parameter
types:
@@ -216,7 +214,7 @@
<a class="link" href="#BOOST_IDENTITY_TYPE" title="Macro BOOST_IDENTITY_TYPE">BOOST_IDENTITY_TYPE</a>(parenthesized_type)</pre><div class="refentry" title="Macro BOOST_IDENTITY_TYPE"><a name="BOOST_IDENTITY_TYPE"></a><div class="titlepage"></div><div class="refnamediv"><h2><span class="refentrytitle">Macro BOOST_IDENTITY_TYPE</span></h2><p>BOOST_IDENTITY_TYPE — This macro allows to wrap the specified type expression within extra round parenthesis so the type can be passed as a single macro parameter even if it contains commas (not already wrapped within round parenthesis). </p></div><div class="refsynopsisdiv" title="Synopsis"><h2>Synopsis</h2><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="#header.boost.utility.identity_type_hpp" title="Header <boost/utility/identity_type.hpp>">boost/utility/identity_type.hpp</a>>
-</span>BOOST_IDENTITY_TYPE(parenthesized_type)</pre></div><div class="refsect1" title="Description"><a name="id476452"></a><h2>Description</h2><p><span class="bold"><strong>Parameters:</strong></span> </p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td><span class="bold"><strong><code class="computeroutput">parenthesized_type</code></strong></span></td><td>The type expression to be passed as macro parameter wrapped by a single set of round parenthesis <code class="computeroutput">(...)</code>. This type expression can contain an arbitrary number of commas. </td></tr></tbody></table></div><p>
+</span>BOOST_IDENTITY_TYPE(parenthesized_type)</pre></div><div class="refsect1" title="Description"><a name="id513593"></a><h2>Description</h2><p><span class="bold"><strong>Parameters:</strong></span> </p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td><span class="bold"><strong><code class="computeroutput">parenthesized_type</code></strong></span></td><td>The type expression to be passed as macro parameter wrapped by a single set of round parenthesis <code class="computeroutput">(...)</code>. This type expression can contain an arbitrary number of commas. </td></tr></tbody></table></div><p>
</p><p>This macro works on any C++03 compiler (it does not require variadic macros).</p><p>This macro must be prefixed by <code class="computeroutput">typename</code> when used within templates. However, the compiler will not be able to automatically determine function template parameters when they are wrapped with this macro (these parameters need to be explicitly specified when calling the function template).</p><p>On some compilers (like GCC), using this macro on an abstract types requires to add and remove a reference to the type. </p></div></div></div></div><div class="footnotes"><br><hr width="100" align="left"><div class="footnote"><p><sup>[<a id="ftn.boost_utility_identitytype.solution.f0" href="#boost_utility_identitytype.solution.f0" class="para">1</a>] </sup>
Using variadic macros, it would be possible to use a single set of parenthesis
<code class="computeroutput"><span class="identifier">BOOST_IDENTITY_TYPE</span><span class="special">(</span></code><span class="emphasis"><em>type</em></span><code class="computeroutput"><span class="special">)</span></code> instead of two <code class="computeroutput"><span class="identifier">BOOST_IDENTITY_TYPE</span><span class="special">((</span></code><span class="emphasis"><em>type</em></span><code class="computeroutput"><span class="special">))</span></code>
Modified: sandbox/local_function/libs/utility/identity_type/doc/identity_type.qbk
==============================================================================
--- sandbox/local_function/libs/utility/identity_type/doc/identity_type.qbk (original)
+++ sandbox/local_function/libs/utility/identity_type/doc/identity_type.qbk 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -21,7 +21,7 @@
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_ok.cpp]
+[import ../test/var.cpp]
[import ../test/template.cpp]
[import ../test/tmp_assert.cpp]
@@ -39,33 +39,33 @@
]
That is because the `std::map` type passed as the first macro parameter contains a comma `,` not wrapped by round parenthesis `()`.
-The preprocessor interprets that unwrapped comma as separation between macro parameters concluding that a total of three (and not two) parameters are passed to the macro in the following order:
+The preprocessor interprets that unwrapped comma as a separation between macro parameters concluding that a total of three (and not two) parameters are passed to the macro in the following order:
# `std::map<int`
# `char>`
# `2`
Note that, differently from the compiler, the preprocessor only recognizes round parameters `()`.
-Angular `<>` or squared `[]` parenthesis are not used by the preprocessor in parsing the macro parameters.
+Angular `<>` or squared `[]` parenthesis are not used by the preprocessor when parsing the macro parameters.
[endsect]
[section Solution]
-In some cases, it might be possible to workaround the issue above by avoiding to pass the type expression to the macro all together.
-For example, in some cases a `typedef` can be used to specify the type expression with the commas outside the macro (see also [@../../test/var_ok.cpp =var_ok.cpp=]):
+In some cases, it might be possible to workaround this issue by avoiding to pass the type expression to the macro all together.
+For example, in some cases a `typedef` can be used to specify the type expression with the commas outside the macro (see also [@../../test/var.cpp =var.cpp=]):
[var_typedef]
-When this is not possible or desired (e.g., see the function template `f` in the section below), the library header [headerref boost/utility/identity_type.hpp] defines a macro [macroref BOOST_IDENTITY_TYPE] which can be used to workaround the issue while keeping the type expression as one of the macro parameters (see also [@../../test/var_ok.cpp =var_ok.cpp=]).
+When this is not possible or desired (e.g., see the function template `f` in the section below), the library header [headerref boost/utility/identity_type.hpp] defines a macro [macroref BOOST_IDENTITY_TYPE] which can be used to workaround the issue while keeping the type expression as one of the macro parameters (see also [@../../test/var.cpp =var.cpp=]).
[var_ok]
This macro expands to an expression that evaluates (at compile-time) to the specified type.
The specified type is never split into multiple macro parameters because it is always wrapped by a set of extra round parenthesis `()`.
-In fact, a total of two set of round parenthesis must be used: The parenthesis to invoke the macro `BOOST_IDENTITY_TYPE(...)` plus the inner parenthesis to wrap the type within `BOOST_IDENTITY_TYPE((...))`.
+In fact, a total of two sets of round parenthesis must be used: The parenthesis to invoke the macro `BOOST_IDENTITY_TYPE(...)` plus the inner parenthesis to wrap the type passed to the macro `BOOST_IDENTITY_TYPE((...))`.
-This macro works on any [@http://www.open-std.org/JTC1/SC22/WG21/docs/standards C++03] compiler (because it does not require [@http://en.wikipedia.org/wiki/Variadic_macro variadic macro] support).
+This macro works on any [@http://www.open-std.org/JTC1/SC22/WG21/docs/standards C++03] compiler (because it does not use [@http://en.wikipedia.org/wiki/Variadic_macro variadic macros]).
[footnote
Using variadic macros, it would be possible to use a single set of parenthesis `BOOST_IDENTITY_TYPE(`/type/`)` instead of two `BOOST_IDENTITY_TYPE((`/type/`))` but variadic macros are not part of C++03 (even if nowadays they are supported by most modern compilers and they are also part of C++11).
]
@@ -95,7 +95,7 @@
On some compilers (e.g., GCC), using this macro on abstract types (i.e., a class with one or more pure virtual functions) generates a compiler error.
This can be worked around by manipulating the type adding and removing a reference to it.
-Let's program a macro that performs a static assertion on a [@http://en.wikipedia.org/wiki/Template_metaprogramming Template Meta-Programming] (TMP) meta-function (similarly to [@http://www.boost.org/doc/libs/1_36_0/libs/mpl/doc/refmanual/assert.html Boost.MPL `BOOST_MPL_ASSERT`]).
+Let's program a macro that performs a static assertion on a [@http://en.wikipedia.org/wiki/Template_metaprogramming Template Meta-Programming] (TMP) meta-function (similarly to Boost.MPL [@http://www.boost.org/doc/libs/1_36_0/libs/mpl/doc/refmanual/assert.html `BOOST_MPL_ASSERT`]).
The [macroref BOOST_IDENTITY_TYPE] macro can be used to pass a meta-function with multiple template parameters to the assert macro (so to handle the commas separating the template parameters).
In this case, if the meta-function is an abstract type, it needs to be manipulated adding and removing a reference to it (see also [@../../test/tmp_assert.cpp =tmp_assert.cpp=]):
@@ -105,17 +105,17 @@
[section Annex: Usages]
-The [macroref BOOST_IDENTITY_TYPE] macro can be used either in call of the user-defined macro (as shown by the examples so far), or internally to the definition of the user macro.
+The [macroref BOOST_IDENTITY_TYPE] macro can be used either in the call of the user-defined macro (as shown by the examples so far), or internally to the definition of the user macro.
When [macroref BOOST_IDENTITY_TYPE] is used internally, the call of the user macro will only have to specify the extra parenthesis (see also [@../../test/tmp_assert.cpp =tmp_assert.cpp=]):
[tmp_assert_alternative]
-However, note that the user will /always/ have to specify the extra parenthesis even when the macro parameter contains no comma:
+However, note that the user will /always/ have to specify the extra parenthesis even when the macro parameters contain no comma:
[tmp_assert_alternative_always]
-In some cases, using the macro internally might provide the best syntax to the user.
-For example, this is the case for `BOOST_MPL_ASSERT` because the large majority of template meta-programming expressions contain unwrapped commas so it is less confusing for the user to always specify the extra parenthesis `((...))` instead of using [macroref BOOST_IDENTITY_TYPE]:
+In some cases, using [macroref BOOST_IDENTITY_TYPE] internally might provide the best syntax for the user.
+For example, this is the case for `BOOST_MPL_ASSERT` because the majority of template meta-programming expressions contain unwrapped commas so it is less confusing for the user to always specify the extra parenthesis `((...))` instead of using [macroref BOOST_IDENTITY_TYPE]:
BOOST_MPL_ASSERT(( // Natural syntax.
boost::mpl::and_<
@@ -124,7 +124,7 @@
>
));
-However, in other cases it might be preferable to not require the extra parenthesis in normal cases and handle commas as special cases using the [macroref BOOST_IDENTITY_TYPE].
+However, in other situations it might be preferable to not require the extra parenthesis in common cases and handle commas as special cases using the [macroref BOOST_IDENTITY_TYPE].
For example, this is the case for `BOOST_LOCAL_FUNCTION` for which always requiring the extra parenthesis `((...))` around the types would lead to an unnatural syntax for the local function parameter types:
int BOOST_LOCAL_FUNCTION( ((int)) x, ((int)) y ) { // Unnatural syntax.
Modified: sandbox/local_function/libs/utility/identity_type/index.html
==============================================================================
--- sandbox/local_function/libs/utility/identity_type/index.html (original)
+++ sandbox/local_function/libs/utility/identity_type/index.html 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -6,7 +6,7 @@
<body>
Automatic redirection failed, click this
<a href="doc/html/index.html">link</a> <hr>
- <p>© Copyright Lorenzo Caminiti, 2012</p>
+ <p>© Copyright Lorenzo Caminiti, 2009-2012</p>
<p>Distributed under the Boost Software License, Version 1.0. (See
accompanying file <a href="../../../LICENSE_1_0.txt">
LICENSE_1_0.txt</a> or copy at
Modified: sandbox/local_function/libs/utility/identity_type/test/tmp_assert.cpp
==============================================================================
--- sandbox/local_function/libs/utility/identity_type/test/tmp_assert.cpp (original)
+++ sandbox/local_function/libs/utility/identity_type/test/tmp_assert.cpp 2012-01-31 19:02:50 EST (Tue, 31 Jan 2012)
@@ -5,8 +5,8 @@
// http://www.boost.org/LICENSE_1_0.txt)
#include <boost/utility/identity_type.hpp>
-#include <boost/type_traits/is_const.hpp>
#include <boost/static_assert.hpp>
+#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/add_reference.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <map>
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