|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r71947 - in sandbox/local: boost/detail/preprocessor/keyword/facility boost/local boost/local/aux_/function_macros/code_ boost/local/function boost/utility boost/utility/aux_ libs/local/doc/html libs/local/doc/html/boost/local/function libs/local/doc/html/boost_local libs/local/doc/qbk libs/local/example
From: lorcaminiti_at_[hidden]
Date: 2011-05-14 15:27:30
Author: lcaminiti
Date: 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
New Revision: 71947
URL: http://svn.boost.org/trac/boost/changeset/71947
Log:
Finalized docs.
Binary files modified:
sandbox/local/libs/local/example/profile.xls
sandbox/local/libs/local/example/profile_legend.png
Text files modified:
sandbox/local/boost/detail/preprocessor/keyword/facility/remove.hpp | 1
sandbox/local/boost/local/aux_/function_macros/code_/binding.hpp | 2
sandbox/local/boost/local/aux_/function_macros/code_/deduce_result_type.hpp | 3
sandbox/local/boost/local/aux_/function_macros/code_/functor.hpp | 2
sandbox/local/boost/local/block.hpp | 14
sandbox/local/boost/local/config.hpp | 46 ++-
sandbox/local/boost/local/exit.hpp | 4
sandbox/local/boost/local/function.hpp | 29 +-
sandbox/local/boost/local/function/overload.hpp | 22 +
sandbox/local/boost/utility/aux_/identity.hpp | 13
sandbox/local/boost/utility/identity.hpp | 42 ++
sandbox/local/libs/local/doc/html/BOOST_IDENTITY_TYPE.html | 7
sandbox/local/libs/local/doc/html/BOOST_IDENTITY_VALUE.html | 17 +
sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK.html | 8
sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK_END.html | 2
sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK_TPL.html | 2
sandbox/local/libs/local/doc/html/BOOST_LOCAL_CONFIG_COMPLIANT.html | 9
sandbox/local/libs/local/doc/html/BOOST_LOCAL_CONFIG_FUNCTION_ARITY_MAX.html | 4
sandbox/local/libs/local/doc/html/BOOST_LOCAL_CONFIG_OVERLOAD_MAX.html | 6
sandbox/local/libs/local/doc/html/BOOST_LOCAL_CONFIG_THIS_PARAM_NAME.html | 6
sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT.html | 6
sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT_END.html | 2
sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT_TPL.html | 2
sandbox/local/libs/local/doc/html/BOOST_LOCAL_FUNCTION_NAME.html | 11
sandbox/local/libs/local/doc/html/BOOST_LOCAL_FUNCTION_PARAMS.html | 6
sandbox/local/libs/local/doc/html/BOOST_LOCAL_FUNCTION_PARAMS_TPL.html | 2
sandbox/local/libs/local/doc/html/BOOST_LOCAL_TYPEOF.html | 2
sandbox/local/libs/local/doc/html/boost/local/function/overload.html | 28 +-
sandbox/local/libs/local/doc/html/boost_local/Acknowledgments.html | 42 ++
sandbox/local/libs/local/doc/html/boost_local/Advanced_Topics.html | 38 +-
sandbox/local/libs/local/doc/html/boost_local/Alternatives.html | 165 +++++++++----
sandbox/local/libs/local/doc/html/boost_local/Examples.html | 19
sandbox/local/libs/local/doc/html/boost_local/Implementation.html | 489 +++++++++++++++++++++------------------
sandbox/local/libs/local/doc/html/boost_local/Release_Notes.html | 65 ++++-
sandbox/local/libs/local/doc/html/boost_local/Tutorial.html | 128 ++++++---
sandbox/local/libs/local/doc/html/index.html | 2
sandbox/local/libs/local/doc/html/reference.html | 7
sandbox/local/libs/local/doc/qbk/acknowledgements.qbk | 16
sandbox/local/libs/local/doc/qbk/advanced_topics.qbk | 6
sandbox/local/libs/local/doc/qbk/alternatives.qbk | 98 +++++--
sandbox/local/libs/local/doc/qbk/examples.qbk | 6
sandbox/local/libs/local/doc/qbk/implementation.qbk | 66 +---
sandbox/local/libs/local/doc/qbk/local.qbk | 3
sandbox/local/libs/local/doc/qbk/release_notes.qbk | 21 +
sandbox/local/libs/local/doc/qbk/tutorial.qbk | 21 +
sandbox/local/libs/local/example/Jamfile.jam | 4
sandbox/local/libs/local/example/factorial_impl.cpp | 151 +++++++-----
sandbox/local/libs/local/example/tparam_trick.cpp | 5
48 files changed, 988 insertions(+), 662 deletions(-)
Modified: sandbox/local/boost/detail/preprocessor/keyword/facility/remove.hpp
==============================================================================
--- sandbox/local/boost/detail/preprocessor/keyword/facility/remove.hpp (original)
+++ sandbox/local/boost/detail/preprocessor/keyword/facility/remove.hpp 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
@@ -9,6 +9,7 @@
#include <boost/preprocessor/control/iif.hpp>
#include <boost/preprocessor/tuple/eat.hpp>
+#include <boost/preprocessor/facilities/expand.hpp>
#include <boost/preprocessor/cat.hpp>
// `is_front_macro(tokens)` is 1 iff `tokens` start with keyword to remove.
Modified: sandbox/local/boost/local/aux_/function_macros/code_/binding.hpp
==============================================================================
--- sandbox/local/boost/local/aux_/function_macros/code_/binding.hpp (original)
+++ sandbox/local/boost/local/aux_/function_macros/code_/binding.hpp 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
@@ -12,7 +12,7 @@
#include "../../scope_exit/scope_exit.hpp" // Use this lib's ScopeExit impl.
#include "../../preprocessor/sign/params_any_bind.hpp"
#include "../../preprocessor/sign/param_any_bind.hpp"
-#include <boost/type_traits.hpp>
+#include <boost/type_traits/remove_reference.hpp>
#include <boost/preprocessor/control/iif.hpp>
#include <boost/preprocessor/control/expr_iif.hpp>
#include <boost/preprocessor/list/adt.hpp> // For `IS_CONS`.
Modified: sandbox/local/boost/local/aux_/function_macros/code_/deduce_result_type.hpp
==============================================================================
--- sandbox/local/boost/local/aux_/function_macros/code_/deduce_result_type.hpp (original)
+++ sandbox/local/boost/local/aux_/function_macros/code_/deduce_result_type.hpp 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
@@ -9,7 +9,8 @@
#include "../../symbol.hpp"
#include "../../scope_exit/scope_exit.hpp" // Use this lib's ScopeExit impl.
-#include <boost/type_traits.hpp>
+#include <boost/type_traits/remove_pointer.hpp>
+#include <boost/type_traits/function_traits.hpp>
#include <boost/preprocessor/control/iif.hpp>
#include <boost/preprocessor/facilities/is_empty.hpp>
Modified: sandbox/local/boost/local/aux_/function_macros/code_/functor.hpp
==============================================================================
--- sandbox/local/boost/local/aux_/function_macros/code_/functor.hpp (original)
+++ sandbox/local/boost/local/aux_/function_macros/code_/functor.hpp 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
@@ -18,7 +18,7 @@
#include "../../../config.hpp"
#include <boost/detail/preprocessor/keyword/auto.hpp>
#include <boost/detail/preprocessor/keyword/register.hpp>
-#include <boost/type_traits.hpp>
+#include <boost/type_traits/add_const.hpp>
#include <boost/preprocessor/punctuation/comma_if.hpp>
#include <boost/preprocessor/logical/bitand.hpp>
#include <boost/preprocessor/logical/bitand.hpp>
Modified: sandbox/local/boost/local/block.hpp
==============================================================================
--- sandbox/local/boost/local/block.hpp (original)
+++ sandbox/local/boost/local/block.hpp 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
@@ -5,8 +5,8 @@
// copy at http://www.boost.org/LICENSE_1_0.txt).
/** @file
- * @brief Local blocks allow to program code that is executed accessing some of
- * the variables in scope as constants.
+ * @brief Local blocks allow to program code that is executed "in place" while
+ * accessing some of the variables in scope as constants.
*/
#ifndef BOOST_LOCAL_BLOCK_HPP_
@@ -24,7 +24,7 @@
*
* This macro must be used within a declarative context, it must be followed by
* the local block body code and then by the @RefMacro{BOOST_LOCAL_BLOCK_END}
- * macro (see the Tutorial section):
+ * macro (see the @RefSect{Tutorial} section):
* @code
* { // Some declarative context.
* ...
@@ -65,7 +65,7 @@
* <c>[token]</c> means either <c>token</c> or nothing (i.e.\, <c>token</c> is
* optional).
*
- * On C99 and later compilers which support variadic macros\, the above
+ * On C99 and later compilers that support variadic macros\, the above
* grammar can be modified as follow to define the <em>variadic macro
* syntax</em> that can also be used to specify the variables in scope to
* bind:
@@ -82,10 +82,10 @@
* on C++ compilers that support variadic macros so it should be used with
* care in order to avoid portability issues.
*
- * Finally\, on C++ compilers which support empty macro parameters\, the above
+ * Finally\, on C++ compilers that support empty macro parameters\, the above
* grammars can be modified as follow to define the <em>empty macro
- * syntax</em> that can can also be used to specify an empty list of variables
- * to bind:
+ * syntax</em> that can also be used to specify an empty list of variables to
+ * bind:
* @code
* void_list:
* ()
Modified: sandbox/local/boost/local/config.hpp
==============================================================================
--- sandbox/local/boost/local/config.hpp (original)
+++ sandbox/local/boost/local/config.hpp 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
@@ -22,7 +22,7 @@
* used by this library. Using variadic macros and empty macro parameters
* allows this library to provide the <em>variadic macro</em> and <em>empty
* macro</em> syntaxes which some programmers might find more readable than the
- * <em>sequencing macro</em> syntax (see
+ * <em>sequencing macro</em> syntax (see the @RefSect{Tutorial} section,
* @RefMacro{BOOST_LOCAL_FUNCTION_PARAMS}, @RefMacro{BOOST_LOCAL_BLOCK}, and
* @RefMacro{BOOST_LOCAL_EXIT}). If this configuration macro is defined then
* only the sequencing macro syntax is allowed (regardless of whether the
@@ -31,18 +31,19 @@
* @Warning The variadic and empty macro syntaxes are not supported by all C++
* compilers so they should be used with care to avoid portability issues
* (and this configuration macro can be defined to disable them).
- *
- * Variadic macros, are supported by most recent compilers (like MSVC and
- * GCC) and they were first introduced by the C99 standard but they are not
- * part of the official ISO C++ standard. Empty macro parameters are also
- * supported by the C99 standards but they are not supported by all modern
- * compilers (for example, they are not supported by MSVC).
- *
- * Furthermore, if this macro is defined the library will not take advantage of
- * compilers (like C++0x compilers) that allow to pass local types as template
- * parameters in order to generate code that has more chances to be optimized
- * by the compiler for faster run-times (i.e., inlining the local function
- * calls, see the @RefSect2{Advanced_Topics, Advanced Topics} section).
+ * Variadic macros, are supported by most recent compilers (like MSVC and
+ * GCC), they were first introduced by the C99 standard, they are part of the
+ * C++0x standard, but they are not part of the official ISO C++ standard.
+ * Empty macro parameters are also supported by the C99 standards and they are
+ * part of the C++0x standard, but they are not supported by all modern
+ * compilers (for example, they are not supported by MSVC).
+ *
+ * Furthermore, if this macro is defined then the library will not take advantage of
+ * compilers that allow to pass local types as template parameters (e.g., MSVC
+ * and C++0x compilers) in order to generate code that has more chances to be
+ * optimized by the compiler for faster run-times (i.e., inlining the local
+ * function calls, see the @RefSect2{Advanced_Topics, Advanced Topics}
+ * section).
*
* @Note This library internally uses Boost.Typeof to automatically deduce
* the bound variable types. The macro symbol <a href='http://www.boost.org/doc/libs/1_46_1/doc/html/typeof/refe.html#typeof.compl'><c>BOOST_TYPEOF_COMPLIANT</c></a>
@@ -68,10 +69,10 @@
* If programmers leave this configuration macro undefined, its default
* value is <c>5</c>.
*
- * This only refers to the number of local function parameters and not to the
+ * This only applies to the number of local function parameters and not to the
* number of bound variables in scope (the limit on the number of bound
* variables is instead the maximum size allowed for a Boost.Preprocessor
- * sequences).
+ * sequence).
*
* @Warning Increasing this number will increase compilation time.
*
@@ -83,14 +84,15 @@
#endif
/**
- * @brief The number of times a function can be overloaded.
+ * @brief The number of function types that can be overloaded by the
+ * @RefClass{boost::local::function::overload} functor.
*
* If programmers leave this configuration macro undefined, its default
* value is <c>6</c>.
*
- * This number must be greater or equal than 2 (because a single function
- * cannot be overloaded by itself) otherwise the library will generate a
- * compile-time error.
+ * This number must be greater or equal than 2 (because at least two function
+ * types are needed to define an overloaded call operator) otherwise the
+ * library will generate a compile-time error.
*
* @Warning Increasing this number will increase compilation time when the
* header file <c>"boost/local/function/overload.hpp"</c> is included.
@@ -107,10 +109,12 @@
/**
* @brief The name of the special symbol used to access the bound object
- * <c>this</c>.
+ * <c>this</c> within the body of the local constructs.
*
* If programmers leave this configuration macro undefined, the default
- * symbol used is <c>this_</c>.
+ * symbol used is <c>this_</c> (this default symbol follows Boost's conventions
+ * to postfix with an underscore symbols that refer to C++ keywords -- the
+ * <c>this</c> keyword in this case).
*
* @Warning Programmers should not define this macro unless it is absolutely
* necessary (e.g., to avoid name clashes with another library which cannot be
Modified: sandbox/local/boost/local/exit.hpp
==============================================================================
--- sandbox/local/boost/local/exit.hpp (original)
+++ sandbox/local/boost/local/exit.hpp 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
@@ -67,7 +67,7 @@
* <c>[token]</c> means either <c>token</c> or nothing (i.e.\, <c>token</c> is
* optional).
*
- * On C99 and later compilers which support variadic macros\, the above
+ * On C99 and later compilers that support variadic macros\, the above
* grammar can be modified as follow to define the <em>variadic macro
* syntax</em> that can also be used to specify the variables in scope to
* bind:
@@ -84,7 +84,7 @@
* on C++ compilers that support variadic macros so it should be used with
* care in order to avoid portability issues.
*
- * Finally\, on C++ compilers which support empty macro parameters\, the above
+ * Finally\, on C++ compilers that support empty macro parameters\, the above
* grammars can be modified as follow to define the <em>empty macro
* syntax</em> that can can also be used to specify an empty list of variables
* to bind:
Modified: sandbox/local/boost/local/function.hpp
==============================================================================
--- sandbox/local/boost/local/function.hpp (original)
+++ sandbox/local/boost/local/function.hpp 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
@@ -6,7 +6,7 @@
/** @file
* @brief Local functions allows to program functions locally within the scope
- * where they are needed (within enclosing functions, etc).
+ * where they are needed.
*/
#ifndef BOOST_LOCAL_FUNCTION_HPP_
@@ -78,7 +78,7 @@
* <c>[token]</c> means either <c>token</c> or nothing (i.e.\, <c>token</c> is
* optional).
*
- * On C99 and later compilers which support variadic macros\, the above
+ * On C99 and later compilers that support variadic macros\, the above
* grammar can be modified as follow to define the <em>variadic macro
* syntax</em> that can also be used to specify the local functions
* parameters:
@@ -97,7 +97,7 @@
* on C++ compilers that support variadic macros so it should be used with
* care in order to avoid portability issues.
*
- * Finally\, on C++ compilers which support empty macro parameters\, the above
+ * Finally\, on C++ compilers that support empty macro parameters\, the above
* grammars can be modified as follow to define the <em>empty macro
* syntax</em> that can can also be used to specify an empty parameter list:
* @code
@@ -173,25 +173,26 @@
* This macro must follow the local function body code block <c>{ ... }</c> as
* shown in the @RefMacro{BOOST_LOCAL_FUNCTION_PARAMS} documentation.
*
- * The local function name can be prefixed by the "keyword" <c>inline</c>:
+ * The local function name can be prefixed by the "keyword" <c>inline</c>
+ * (see the @RefSect2{Advanced_Topics, Advanced Topics} section):
* @code
* ... BOOST_LOCAL_FUNCTION_NAME(inline name)
* @endcode
* This increases the chances that the compiler will be able to inline the
* local function calls (thus reducing their run-time).
- * However, inlined local functions cannot be passed as template parameters
- * (on ISO C++ compliant compilers, see
- * @RefMacro{BOOST_LOCAL_CONFIG_COMPLIANT}, but they can be passed as template
- * parameters on C++0x compilers).
- * Furthermore, inlined local functions cannot be assigned to other functors
- * like <c>boost::function</c>.
+ * However, inlined local functions cannot be passed as template parameters or
+ * assigned to other functors like <c>boost::function</c> (that is true on ISO
+ * C++ compilers, see @RefMacro{BOOST_LOCAL_CONFIG_COMPLIANT}, but inlined
+ * local functions can instead be passed as template parameters on C++0x
+ * compilers).
* On C++0x compilers, there is no need to declare a local function lined
* because this library will automatically use C++0x specific features to
* inline the local function while always allowing to pass it as a template
* parameter.
*
* The local function name can also be prefixed by the "keyword"
- * <c>recursive</c>:
+ * <c>recursive</c> (see the @RefSect2{Advanced_Topics, Advanced Topics}
+ * section):
* @code
* ... BOOST_LOCAL_FUNCTION_NAME(recursive name)
* @endcode
@@ -210,9 +211,9 @@
* Advanced Topics} section).
* 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 (i.e.\, it is not possible to
- * overload local function declarations\, see the @RefSect2{Advanced_Topics\,
- * Advanced Topics} section).
+ * declared within the same enclosing scope (use the
+ * @RefClass{boost::local::function::overload} functor to overload local
+ * functions\, see the @RefSect2{Advanced_Topics\, Advanced Topics} section).
* }
* @EndParams
*
Modified: sandbox/local/boost/local/function/overload.hpp
==============================================================================
--- sandbox/local/boost/local/function/overload.hpp (original)
+++ sandbox/local/boost/local/function/overload.hpp 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
@@ -134,13 +134,23 @@
#else // DOXY: Doxygen documentation only.
+/** @file
+ * @brief Defines a functor that can be used to overload the call operator of
+ * a set of specified functors.
+ */
+
namespace boost { namespace local { namespace function {
/**
* @brief Functor to overload local functions and other functors.
*
* This functor aggregates together calls to functions of all the specified
- * types.
+ * function types <c>F0</c>, <c>F1</c>, etc.
+ * Each function type must be specified following the Boost.Function preferred
+ * syntax:
+ * @code
+ * ResultType (ArgumentType0, ArgumgnetType1, ...)
+ * @endcode
*
* The maximum number of overloaded function types is specified by the
* @RefMacro{BOOST_LOCAL_CONFIG_OVERLOAD_MAX} configuration macro.
@@ -150,7 +160,7 @@
*
* @See @RefSect2{Advanced_Topics, Advanced Topics} section,
* @RefMacro{BOOST_LOCAL_CONFIG_OVERLOAD_MAX},
- * @RefMacro{BOOST_LOCAL_CONFIG_OVERLOAD_MAX}.
+ * @RefMacro{BOOST_LOCAL_CONFIG_OVERLOAD_MAX}, Boost.Function.
*/
template<typename F0, typename F1, ...>
class overload {
@@ -165,8 +175,8 @@
overload(const boost::function<F0>&, const boost::function<F1>&, ...);
/**
- * @brief Call operator matching the signature of the first specified
- * functor.
+ * @brief Call operator matching the signature of the function type
+ * specified as first.
*
* This will in turn invoke the call operator of the first functor that was
* passed to the constructor.
@@ -174,8 +184,8 @@
result_type<F0> operator()(arg0_type<F0>, arg1_type<F0>, ...) const;
/**
- * @brief Call operator matching the signature of the second specified
- * functor.
+ * @brief Call operator matching the signature of the function type
+ * specified as second.
*
* This will in turn invoke the call operator of the second functor that
* was passed to the constructor.
Modified: sandbox/local/boost/utility/aux_/identity.hpp
==============================================================================
--- sandbox/local/boost/utility/aux_/identity.hpp (original)
+++ sandbox/local/boost/utility/aux_/identity.hpp 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
@@ -7,15 +7,16 @@
#ifndef BOOST_AUX_IDENTITY_HPP_
#define BOOST_AUX_IDENTITY_HPP_
-namespace boost { namespace aux {
+#include <boost/type_traits/add_reference.hpp>
-// Identity for type expressions.
-template<typename F> struct identity_type {}; // Empty so cannot be used.
-template<typename T> struct identity_type< void (T) > { typedef T type; };
+namespace boost { namespace aux {
// Identity for value expressions (call overhead should be optimized away).
-template<typename T> inline T const& identity_value(T const& value)
- { return value; }
+template<typename T>
+inline typename boost::add_reference<T>::type identity_value(
+ typename boost::add_reference<T>::type value) {
+ return value;
+}
}} // namespace boost::aux
Modified: sandbox/local/boost/utility/identity.hpp
==============================================================================
--- sandbox/local/boost/utility/identity.hpp (original)
+++ sandbox/local/boost/utility/identity.hpp 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
@@ -10,7 +10,8 @@
*
* @Note The only way (at least as far as the authors know) to pass an
* arbitrary number of commas within macro parameters without explicitly
- * indicating the number of commas is to wrap the parameter within round
+ * indicating the number of commas (and without using variadic macros which
+ * are not part of the ISO C++ standard) is to wrap the expression within round
* parenthesis that are not replaced by macro expansion and then to remove the
* extra parenthesis at compile-time (for type expressions) or at run-time
* (for value expressions).
@@ -21,11 +22,12 @@
#define BOOST_IDENTITY_HPP_
#include "aux_/identity.hpp"
+#include <boost/type_tratis/function_traits.hpp>
/**
* @brief This macro wraps the specified type expression within extra
* parenthesis so the type can be passed as a single macro parameter even if
- * it contains commas.
+ * it contains commas (not already wrapped within round parenthesis).
*
* This macro expands to an expression that can be passed as a single macro
* parameter even if it contains commas and that evaluates to the specified
@@ -34,9 +36,9 @@
*
* For example <c>BOOST_IDENTITY_TYPE((std::map<int, double>))</c> can be
* passed as a single macro parameter when instead
- * <c>std::map<int, double></c> cannot (because it contains a comma not wrapped
- * by round parenthesis so it will be interpreted as two separate macro
- * parameters by the preprocessor).
+ * <c>std::map<int, double></c> cannot (because <c>std::map<int, double></c>
+ * contains a comma not wrapped by round parenthesis so it will be interpreted
+ * as two separate macro parameters by the preprocessor).
*
* @Params
* @Param{parenthesized_type,
@@ -46,16 +48,20 @@
* }
* @EndParams
*
+ * @Note This macro works on ISO C++ compilers (it does not require variadic
+ * macros). It expands to code equivalent to
+ * <c>boost::function_traits<void parenthesized_type>::arg1_type</c>.
+ *
* @See @RefSect2{Advanced_Topics, Advanced Topics} section.
*/
#define BOOST_IDENTITY_TYPE(parenthesized_type) \
/* must NOT prefix this with `::` to work with parenthesized syntax */ \
- boost::aux::identity_type< void parenthesized_type >::type
+ boost::function_tratis< void parenthesized_type >::arg1_type
/**
* @brief This macro wraps the specified value expression within extra
* parenthesis so the value can be passed as a single macro parameter even if
- * it contains commas.
+ * it contains commas (not already wrapped within round parenthesis).
*
* This macro expands to an expression that can be passed as a single macro
* parameter even if it contains commas and that evaluates to the specified
@@ -64,9 +70,10 @@
*
* For example <c>BOOST_IDENTITY_VALUE((key_sizeof<int, double>::value))</c>
* can be passed as a single macro parameter when instead
- * <c>key_sizeof<int, double>::value</c> cannot (because it contains a comma
- * not wrapped by round parenthesis so it will be interpreted as two separate
- * macro parameters by the preprocessor).
+ * <c>key_sizeof<int, double>::value</c> cannot (because
+ * <c>key_sizeof<int, double>::value</c> contains a comma not wrapped by round
+ * parenthesis so it will be interpreted as two separate macro parameters by
+ * the preprocessor).
*
* @Params
* @Param{parenthesize_value,
@@ -76,6 +83,21 @@
* }
* @EndParams
*
+ * @Note This macro works on ISO C++ compilers (it does not require variadic
+ * macros). This macro expands to code equivalent to
+ * <c>boost::aux::identity_value parenthesized_value</c> where:
+ * @code
+ * namespace boost { namespace aux {
+ *
+ * template<typename T>
+ * inline typename boost::add_reference<T>::type identity_value(
+ * typename boost::add_reference<T>::type value) {
+ * return value;
+ * }
+ *
+ * }} // namespace boost::aux
+ * @endcode
+ *
* @See @RefSect2{Advanced_Topics, Advanced Topics} section.
*/
#define BOOST_IDENTITY_VALUE(parenthesized_value) \
Modified: sandbox/local/libs/local/doc/html/BOOST_IDENTITY_TYPE.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_IDENTITY_TYPE.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_IDENTITY_TYPE.html 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
@@ -26,16 +26,16 @@
<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 wraps the specified type expression within extra parenthesis so the type can be passed as a single macro parameter even if it contains commas. </p>
+<p>BOOST_IDENTITY_TYPE — This macro wraps the specified type expression within extra 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>
<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.utility.identity_hpp" title="Header <boost/utility/identity.hpp>">boost/utility/identity.hpp</a>>
</span>BOOST_IDENTITY_TYPE(parenthesized_type)</pre></div>
<div class="refsect1">
-<a name="id925518"></a><h2>Description</h2>
+<a name="id925908"></a><h2>Description</h2>
<p>This macro expands to an expression that can be passed as a single macro parameter even if it contains commas and that evaluates to the specified type at compile-time (see the <a class="link" href="boost_local/Advanced_Topics.html" title="Advanced Topics"> Advanced Topics</a> section).</p>
-<p>For example <code class="computeroutput">BOOST_IDENTITY_TYPE((std::map<int, double>))</code> can be passed as a single macro parameter when instead <code class="computeroutput">std::map<int, double></code> cannot (because it contains a comma not wrapped by round parenthesis so it will be interpreted as two separate macro parameters by the preprocessor).</p>
+<p>For example <code class="computeroutput">BOOST_IDENTITY_TYPE((std::map<int, double>))</code> can be passed as a single macro parameter when instead <code class="computeroutput">std::map<int, double></code> cannot (because <code class="computeroutput">std::map<int, double></code> contains a comma not wrapped by round parenthesis so it will be interpreted as two separate macro parameters by the preprocessor).</p>
<p><span class="bold"><strong>Parameters:</strong></span> </p>
<div class="informaltable"><table class="table">
<colgroup>
@@ -49,6 +49,7 @@
</table></div>
<p>
</p>
+<p><span class="bold"><strong>Note:</strong></span> This macro works on ISO C++ compilers (it does not require variadic macros). It expands to code equivalent to <code class="computeroutput">boost::function_traits<void parenthesized_type>::arg1_type</code>.</p>
<p><span class="bold"><strong>See:</strong></span> <a class="link" href="boost_local/Advanced_Topics.html" title="Advanced Topics"> Advanced Topics</a> section. </p>
</div>
</div>
Modified: sandbox/local/libs/local/doc/html/BOOST_IDENTITY_VALUE.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_IDENTITY_VALUE.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_IDENTITY_VALUE.html 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
@@ -26,16 +26,16 @@
<a name="BOOST_IDENTITY_VALUE"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Macro BOOST_IDENTITY_VALUE</span></h2>
-<p>BOOST_IDENTITY_VALUE — This macro wraps the specified value expression within extra parenthesis so the value can be passed as a single macro parameter even if it contains commas. </p>
+<p>BOOST_IDENTITY_VALUE — This macro wraps the specified value expression within extra parenthesis so the value can be passed as a single macro parameter even if it contains commas (not already wrapped within round parenthesis). </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.utility.identity_hpp" title="Header <boost/utility/identity.hpp>">boost/utility/identity.hpp</a>>
</span>BOOST_IDENTITY_VALUE(parenthesized_value)</pre></div>
<div class="refsect1">
-<a name="id925659"></a><h2>Description</h2>
+<a name="id926075"></a><h2>Description</h2>
<p>This macro expands to an expression that can be passed as a single macro parameter even if it contains commas and that evaluates to the specified value at run-time (see the <a class="link" href="boost_local/Advanced_Topics.html" title="Advanced Topics"> Advanced Topics</a> section).</p>
-<p>For example <code class="computeroutput">BOOST_IDENTITY_VALUE((key_sizeof<int, double>::value))</code> can be passed as a single macro parameter when instead <code class="computeroutput">key_sizeof<int, double>::value</code> cannot (because it contains a comma not wrapped by round parenthesis so it will be interpreted as two separate macro parameters by the preprocessor).</p>
+<p>For example <code class="computeroutput">BOOST_IDENTITY_VALUE((key_sizeof<int, double>::value))</code> can be passed as a single macro parameter when instead <code class="computeroutput">key_sizeof<int, double>::value</code> cannot (because <code class="computeroutput">key_sizeof<int, double>::value</code> contains a comma not wrapped by round parenthesis so it will be interpreted as two separate macro parameters by the preprocessor).</p>
<p><span class="bold"><strong>Parameters:</strong></span> </p>
<div class="informaltable"><table class="table">
<colgroup>
@@ -49,6 +49,17 @@
</table></div>
<p>
</p>
+<p><span class="bold"><strong>Note:</strong></span> This macro works on ISO C++ compilers (it does not require variadic macros). This macro expands to code equivalent to <code class="computeroutput">boost::aux::identity_value parenthesized_value</code> where: </p>
+<pre class="programlisting"> <span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">aux</span> <span class="special">{</span>
+
+ <span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+ <span class="keyword">inline</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">add_reference</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span><span class="special">::</span><span class="identifier">type</span> <span class="identifier">identity_value</span><span class="special">(</span>
+ <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">add_reference</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span><span class="special">::</span><span class="identifier">type</span> <span class="identifier">value</span><span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">value</span><span class="special">;</span>
+ <span class="special">}</span>
+
+ <span class="special">}</span><span class="special">}</span> <span class="comment">// namespace boost::aux</span>
+</pre>
<p><span class="bold"><strong>See:</strong></span> <a class="link" href="boost_local/Advanced_Topics.html" title="Advanced Topics"> Advanced Topics</a> section. </p>
</div>
</div>
Modified: sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK.html 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
@@ -33,8 +33,8 @@
</span>BOOST_LOCAL_BLOCK(bindings)</pre></div>
<div class="refsect1">
-<a name="id919852"></a><h2>Description</h2>
-<p>This macro must be used within a declarative context, it must be followed by the local block body code and then by the <code class="computeroutput"><a class="link" href="BOOST_LOCAL_BLOCK_END.html" title="Macro BOOST_LOCAL_BLOCK_END">BOOST_LOCAL_BLOCK_END</a></code> macro (see the Tutorial section): </p>
+<a name="id920108"></a><h2>Description</h2>
+<p>This macro must be used within a declarative context, it must be followed by the local block body code and then by the <code class="computeroutput"><a class="link" href="BOOST_LOCAL_BLOCK_END.html" title="Macro BOOST_LOCAL_BLOCK_END">BOOST_LOCAL_BLOCK_END</a></code> macro (see the <a class="link" href="boost_local/Tutorial.html" title="Tutorial">Tutorial</a> section): </p>
<pre class="programlisting"> <span class="special">{</span> <span class="comment">// Some declarative context.</span>
<span class="special">...</span>
<span class="identifier">BOOST_LOCAL_BLOCK</span><span class="special">(</span><span class="identifier">bindings</span><span class="special">)</span> <span class="special">{</span>
@@ -62,11 +62,11 @@
<span class="special">(</span><span class="identifier">bound_parameter1</span><span class="special">)</span> <span class="special">(</span><span class="identifier">bound_parameter2</span><span class="special">)</span> <span class="special">...</span>
<span class="identifier">bound_parameter</span><span class="special">:</span>
<span class="special">[</span><span class="keyword">const</span><span class="special">]</span> <span class="identifier">bind</span> <span class="special">[</span><span class="special">(</span><span class="identifier">variable_type</span><span class="special">)</span><span class="special">]</span> <span class="special">[</span><span class="special">&</span><span class="special">]</span> <span class="identifier">variable_name</span>
-</pre> Where the following lexical conventions have been used: <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 (i.e., <code class="computeroutput">token</code> is optional).On C99 and later compilers which support variadic macros, the above grammar can be modified as follow to define the <span class="emphasis"><em>variadic macro syntax</em></span> that can also be used to specify the variables in scope to bind: <pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"> <span class="identifier">void_list</span><span class="special">:</span>
+</pre> Where the following lexical conventions have been used: <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 (i.e., <code class="computeroutput">token</code> is optional).On C99 and later compilers that support variadic macros, the above grammar can be modified as follow to define the <span class="emphasis"><em>variadic macro syntax</em></span> that can also be used to specify the variables in scope to bind: <pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"> <span class="identifier">void_list</span><span class="special">:</span>
<span class="keyword">void</span>
<span class="identifier">bound_list</span><span class="special">:</span>
<span class="identifier">bound_parameter1</span><span class="special">,</span> <span class="identifier">bound_parameter2</span><span class="special">,</span> <span class="special">...</span>
-</pre> Note that the variadic macro syntax uses commas <code class="computeroutput">,</code> instead of parenthesis <code class="computeroutput">()</code> to separate the parameters and therefore resembles the usual C++ function parameter declaration syntax more closely than the sequencing macro syntax. However, the variadic macro syntax will only work on C++ compilers that support variadic macros so it should be used with care in order to avoid portability issues.Finally, on C++ compilers which support empty macro parameters, the above grammars can be modified as follow to define the <span class="emphasis"><em>empty macro syntax</em></span> that can can also be used to specify an empty list of variables to bind: <pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"> <span class="identifier">void_list</span><span class="special">:</span>
+</pre> Note that the variadic macro syntax uses commas <code class="computeroutput">,</code> instead of parenthesis <code class="computeroutput">()</code> to separate the parameters and therefore resembles the usual C++ function parameter declaration syntax more closely than the sequencing macro syntax. However, the variadic macro syntax will only work on C++ compilers that support variadic macros so it should be used with care in order to avoid portability issues.Finally, on C++ compilers that support empty macro parameters, the above grammars can be modified as follow to define the <span class="emphasis"><em>empty macro syntax</em></span> that can also be used to specify an empty list of variables to bind: <pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"> <span class="identifier">void_list</span><span class="special">:</span>
<span class="special">(</span><span class="special">)</span>
</pre> Note that the empty macro parameter syntax uses the usual C++ syntax to specify empty bound variable list but it will only work on compilers that support empty macro parameters so it should be used with care in order to avoid portability issues. </td>
</tr></tbody>
Modified: sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK_END.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK_END.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK_END.html 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_BLOCK_END</pre></div>
<div class="refsect1">
-<a name="id920697"></a><h2>Description</h2>
+<a name="id920962"></a><h2>Description</h2>
<p>This macro must follow the local block body code <code class="computeroutput">{ ... }</code> as shown in the <code class="computeroutput"><a class="link" href="BOOST_LOCAL_BLOCK.html" title="Macro BOOST_LOCAL_BLOCK">BOOST_LOCAL_BLOCK</a></code> documentation.</p>
<p><span class="bold"><strong>Note:</strong></span> This macro cannot be used multiple times on the same line because it internally uses the line number <code class="computeroutput">__LINE__</code> to generate unique identifiers.</p>
<p><span class="bold"><strong>See:</strong></span> <code class="computeroutput"><a class="link" href="BOOST_LOCAL_BLOCK.html" title="Macro BOOST_LOCAL_BLOCK">BOOST_LOCAL_BLOCK</a></code>, <a class="link" href="boost_local/Tutorial.html" title="Tutorial">Tutorial</a> section. </p>
Modified: sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK_TPL.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK_TPL.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK_TPL.html 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_BLOCK_TPL(bindings)</pre></div>
<div class="refsect1">
-<a name="id920623"></a><h2>Description</h2>
+<a name="id920888"></a><h2>Description</h2>
<p><span class="bold"><strong>See:</strong></span> <code class="computeroutput"><a class="link" href="BOOST_LOCAL_BLOCK.html" title="Macro BOOST_LOCAL_BLOCK">BOOST_LOCAL_BLOCK</a></code>, <a class="link" href="boost_local/Tutorial.html" title="Tutorial">Tutorial</a> section. </p>
</div>
</div>
Modified: sandbox/local/libs/local/doc/html/BOOST_LOCAL_CONFIG_COMPLIANT.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_LOCAL_CONFIG_COMPLIANT.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_LOCAL_CONFIG_COMPLIANT.html 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
@@ -33,12 +33,11 @@
</span>BOOST_LOCAL_CONFIG_COMPLIANT</pre></div>
<div class="refsect1">
-<a name="id920870"></a><h2>Description</h2>
+<a name="id921134"></a><h2>Description</h2>
<p>If programmers leave this configuration macro undefined, its default value is to be left not defined.</p>
-<p>If this macro is defined, variadic macros and empty macro parameters are not used by this library. Using variadic macros and empty macro parameters allows this library to provide the <span class="emphasis"><em>variadic macro</em></span> and <span class="emphasis"><em>empty macro</em></span> syntaxes which some programmers might find more readable than the <span class="emphasis"><em>sequencing macro</em></span> syntax (see <code class="computeroutput"><a class="link" href="BOOST_LOCAL_FUNCTION_PARAMS.html" title="Macro BOOST_LOCAL_FUNCTION_PARAMS">BOOST_LOCAL_FUNCTION_PARAMS</a></code>, <code class="computeroutput"><a class="link" href="BOOST_LOCAL_BLOCK.html" title="Macro BOOST_LOCAL_BLOCK">BOOST_LOCAL_BLOCK</a></code>, and <code class="computeroutput"><a class="link" href="BOOST_LOCAL_EXIT.html" title="Macro BOOST_LOCAL_EXIT">BOOST_LOCAL_EXIT</a></code>). If this configuration macro is defined then only the sequencing macro syntax is allowed (regardless of whether the compiler supports variadic and e
mpty macros or not).</p>
-<p><span class="bold"><strong>Warning:</strong></span> The variadic and empty macro syntaxes are not supported by all C++ compilers so they should be used with care to avoid portability issues (and this configuration macro can be defined to disable them).</p>
-<p>Variadic macros, are supported by most recent compilers (like MSVC and GCC) and they were first introduced by the C99 standard but they are not part of the official ISO C++ standard. Empty macro parameters are also supported by the C99 standards but they are not supported by all modern compilers (for example, they are not supported by MSVC).</p>
-<p>Furthermore, if this macro is defined the library will not take advantage of compilers (like C++0x compilers) that allow to pass local types as template parameters in order to generate code that has more chances to be optimized by the compiler for faster run-times (i.e., inlining the local function calls, see the <a class="link" href="boost_local/Advanced_Topics.html" title="Advanced Topics"> Advanced Topics</a> section).</p>
+<p>If this macro is defined, variadic macros and empty macro parameters are not used by this library. Using variadic macros and empty macro parameters allows this library to provide the <span class="emphasis"><em>variadic macro</em></span> and <span class="emphasis"><em>empty macro</em></span> syntaxes which some programmers might find more readable than the <span class="emphasis"><em>sequencing macro</em></span> syntax (see the <a class="link" href="boost_local/Tutorial.html" title="Tutorial">Tutorial</a> section, <code class="computeroutput"><a class="link" href="BOOST_LOCAL_FUNCTION_PARAMS.html" title="Macro BOOST_LOCAL_FUNCTION_PARAMS">BOOST_LOCAL_FUNCTION_PARAMS</a></code>, <code class="computeroutput"><a class="link" href="BOOST_LOCAL_BLOCK.html" title="Macro BOOST_LOCAL_BLOCK">BOOST_LOCAL_BLOCK</a></code>, and <code class="computeroutput"><a class="link" href="BOOST_LOCAL_EXIT.html" title="Macro BOOST_LOCAL_EXIT">BOOST_LOCAL_EXIT</a></code>). If this configuration macro is defined then only the s
equencing macro syntax is allowed (regardless of whether the compiler supports variadic and empty macros or not).</p>
+<p><span class="bold"><strong>Warning:</strong></span> The variadic and empty macro syntaxes are not supported by all C++ compilers so they should be used with care to avoid portability issues (and this configuration macro can be defined to disable them). Variadic macros, are supported by most recent compilers (like MSVC and GCC), they were first introduced by the C99 standard, they are part of the C++0x standard, but they are not part of the official ISO C++ standard. Empty macro parameters are also supported by the C99 standards and they are part of the C++0x standard, but they are not supported by all modern compilers (for example, they are not supported by MSVC).</p>
+<p>Furthermore, if this macro is defined then the library will not take advantage of compilers that allow to pass local types as template parameters (e.g., MSVC and C++0x compilers) in order to generate code that has more chances to be optimized by the compiler for faster run-times (i.e., inlining the local function calls, see the <a class="link" href="boost_local/Advanced_Topics.html" title="Advanced Topics"> Advanced Topics</a> section).</p>
<p><span class="bold"><strong>Note:</strong></span> This library internally uses Boost.Typeof to automatically deduce the bound variable types. The macro symbol BOOST_TYPEOF_COMPLIANT
needs to be defined separately from this configuration macro if programmers do not want to use non ISO C++ standard support for type deduction operations.</p>
<p><span class="bold"><strong>See:</strong></span> <a class="link" href="boost_local/Tutorial.html" title="Tutorial">Tutorial</a> section, <a class="link" href="boost_local/Advanced_Topics.html" title="Advanced Topics"> Advanced Topics</a> section, <a class="link" href="boost_local/Getting_Started.html" title="Getting Started"> Getting Started</a> section. </p>
</div>
Modified: sandbox/local/libs/local/doc/html/BOOST_LOCAL_CONFIG_FUNCTION_ARITY_MAX.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_LOCAL_CONFIG_FUNCTION_ARITY_MAX.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_LOCAL_CONFIG_FUNCTION_ARITY_MAX.html 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
@@ -33,9 +33,9 @@
</span>BOOST_LOCAL_CONFIG_FUNCTION_ARITY_MAX</pre></div>
<div class="refsect1">
-<a name="id921075"></a><h2>Description</h2>
+<a name="id921350"></a><h2>Description</h2>
<p>If programmers leave this configuration macro undefined, its default value is <code class="computeroutput">5</code>.</p>
-<p>This only refers to the number of local function parameters and not to the number of bound variables in scope (the limit on the number of bound variables is instead the maximum size allowed for a Boost.Preprocessor sequences).</p>
+<p>This only applies to the number of local function parameters and not to the number of bound variables in scope (the limit on the number of bound variables is instead the maximum size allowed for a Boost.Preprocessor sequence).</p>
<p><span class="bold"><strong>Warning:</strong></span> Increasing this number will increase compilation time.</p>
<p><span class="bold"><strong>See:</strong></span> <a class="link" href="boost_local/Tutorial.html" title="Tutorial">Tutorial</a> section, <a class="link" href="boost_local/Getting_Started.html" title="Getting Started"> Getting Started</a> section. </p>
</div>
Modified: sandbox/local/libs/local/doc/html/BOOST_LOCAL_CONFIG_OVERLOAD_MAX.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_LOCAL_CONFIG_OVERLOAD_MAX.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_LOCAL_CONFIG_OVERLOAD_MAX.html 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
@@ -26,16 +26,16 @@
<a name="BOOST_LOCAL_CONFIG_OVERLOAD_MAX"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Macro BOOST_LOCAL_CONFIG_OVERLOAD_MAX</span></h2>
-<p>BOOST_LOCAL_CONFIG_OVERLOAD_MAX — The number of times a function can be overloaded. </p>
+<p>BOOST_LOCAL_CONFIG_OVERLOAD_MAX — The number of function types that can be overloaded by the <code class="computeroutput"><a class="link" href="boost/local/function/overload.html" title="Class template overload">boost::local::function::overload</a></code> functor. </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.local.config_hpp" title="Header <boost/local/config.hpp>">boost/local/config.hpp</a>>
</span>BOOST_LOCAL_CONFIG_OVERLOAD_MAX</pre></div>
<div class="refsect1">
-<a name="id921171"></a><h2>Description</h2>
+<a name="id921459"></a><h2>Description</h2>
<p>If programmers leave this configuration macro undefined, its default value is <code class="computeroutput">6</code>.</p>
-<p>This number must be greater or equal than 2 (because a single function cannot be overloaded by itself) otherwise the library will generate a compile-time error.</p>
+<p>This number must be greater or equal than 2 (because at least two function types are needed to define an overloaded call operator) otherwise the library will generate a compile-time error.</p>
<p><span class="bold"><strong>Warning:</strong></span> Increasing this number will increase compilation time when the header file <code class="computeroutput">"boost/local/function/overload.hpp"</code> is included.</p>
<p><span class="bold"><strong>See:</strong></span> <a class="link" href="boost_local/Advanced_Topics.html" title="Advanced Topics"> Advanced Topics</a> section, <a class="link" href="boost_local/Getting_Started.html" title="Getting Started"> Getting Started</a> section. </p>
</div>
Modified: sandbox/local/libs/local/doc/html/BOOST_LOCAL_CONFIG_THIS_PARAM_NAME.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_LOCAL_CONFIG_THIS_PARAM_NAME.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_LOCAL_CONFIG_THIS_PARAM_NAME.html 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
@@ -26,15 +26,15 @@
<a name="BOOST_LOCAL_CONFIG_THIS_PARAM_NAME"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Macro BOOST_LOCAL_CONFIG_THIS_PARAM_NAME</span></h2>
-<p>BOOST_LOCAL_CONFIG_THIS_PARAM_NAME — The name of the special symbol used to access the bound object <code class="computeroutput">this</code>. </p>
+<p>BOOST_LOCAL_CONFIG_THIS_PARAM_NAME — The name of the special symbol used to access the bound object <code class="computeroutput">this</code> within the body of the local constructs. </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.local.config_hpp" title="Header <boost/local/config.hpp>">boost/local/config.hpp</a>>
</span>BOOST_LOCAL_CONFIG_THIS_PARAM_NAME</pre></div>
<div class="refsect1">
-<a name="id921282"></a><h2>Description</h2>
-<p>If programmers leave this configuration macro undefined, the default symbol used is <code class="computeroutput">this_</code>.</p>
+<a name="id921571"></a><h2>Description</h2>
+<p>If programmers leave this configuration macro undefined, the default symbol used is <code class="computeroutput">this_</code> (this default symbol follows Boost's conventions to postfix with an underscore symbols that refer to C++ keywords -- the <code class="computeroutput">this</code> keyword in this case).</p>
<p><span class="bold"><strong>Warning:</strong></span> Programmers should not define this macro unless it is absolutely necessary (e.g., to avoid name clashes with another library which cannot be changed). Changing the symbol <code class="computeroutput">this_</code> effectively changes the public API of this library.</p>
<p><span class="bold"><strong>See:</strong></span> <a class="link" href="boost_local/Tutorial.html" title="Tutorial">Tutorial</a> section, <a class="link" href="boost_local/Getting_Started.html" title="Getting Started"> Getting Started</a> section. </p>
</div>
Modified: sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT.html 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_EXIT(binding_list)</pre></div>
<div class="refsect1">
-<a name="id921431"></a><h2>Description</h2>
+<a name="id921730"></a><h2>Description</h2>
<p>This macro must be used within a declarative context, it must be followed by the local exit body code and then by the <code class="computeroutput"><a class="link" href="BOOST_LOCAL_EXIT_END.html" title="Macro BOOST_LOCAL_EXIT_END">BOOST_LOCAL_EXIT_END</a></code> macro (see the <a class="link" href="boost_local/Tutorial.html" title="Tutorial">Tutorial</a> section): </p>
<pre class="programlisting"> <span class="special">{</span> <span class="comment">// Some declarative context.</span>
<span class="special">...</span>
@@ -62,11 +62,11 @@
<span class="special">(</span><span class="identifier">bound_parameter1</span><span class="special">)</span> <span class="special">(</span><span class="identifier">bound_parameter2</span><span class="special">)</span> <span class="special">...</span>
<span class="identifier">bound_parameter</span><span class="special">:</span>
<span class="special">[</span><span class="keyword">const</span><span class="special">]</span> <span class="identifier">bind</span> <span class="special">[</span><span class="special">(</span><span class="identifier">variable_type</span><span class="special">)</span><span class="special">]</span> <span class="special">[</span><span class="special">&</span><span class="special">]</span> <span class="identifier">variable_name</span>
-</pre> Where the following lexical conventions have been used: <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 (i.e., <code class="computeroutput">token</code> is optional).On C99 and later compilers which support variadic macros, the above grammar can be modified as follow to define the <span class="emphasis"><em>variadic macro syntax</em></span> that can also be used to specify the variables in scope to bind: <pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"> <span class="identifier">void_list</span><span class="special">:</span>
+</pre> Where the following lexical conventions have been used: <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 (i.e., <code class="computeroutput">token</code> is optional).On C99 and later compilers that support variadic macros, the above grammar can be modified as follow to define the <span class="emphasis"><em>variadic macro syntax</em></span> that can also be used to specify the variables in scope to bind: <pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"> <span class="identifier">void_list</span><span class="special">:</span>
<span class="keyword">void</span>
<span class="identifier">bound_list</span><span class="special">:</span>
<span class="identifier">bound_parameter1</span><span class="special">,</span> <span class="identifier">bound_parameter2</span><span class="special">,</span> <span class="special">...</span>
-</pre> Note that the variadic macro syntax uses commas <code class="computeroutput">,</code> instead of parenthesis <code class="computeroutput">()</code> to separate the parameters and therefore resembles the usual C++ function parameter declaration syntax more closely than the sequencing macro syntax. However, the variadic macro syntax will only work on C++ compilers that support variadic macros so it should be used with care in order to avoid portability issues.Finally, on C++ compilers which support empty macro parameters, the above grammars can be modified as follow to define the <span class="emphasis"><em>empty macro syntax</em></span> that can can also be used to specify an empty list of variables to bind: <pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"> <span class="identifier">void_list</span><span class="special">:</span>
+</pre> Note that the variadic macro syntax uses commas <code class="computeroutput">,</code> instead of parenthesis <code class="computeroutput">()</code> to separate the parameters and therefore resembles the usual C++ function parameter declaration syntax more closely than the sequencing macro syntax. However, the variadic macro syntax will only work on C++ compilers that support variadic macros so it should be used with care in order to avoid portability issues.Finally, on C++ compilers that support empty macro parameters, the above grammars can be modified as follow to define the <span class="emphasis"><em>empty macro syntax</em></span> that can can also be used to specify an empty list of variables to bind: <pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"> <span class="identifier">void_list</span><span class="special">:</span>
<span class="special">(</span><span class="special">)</span>
</pre> Note that the empty macro parameter syntax uses the usual C++ syntax to specify empty bound variable list but it will only work on compilers that support empty macro parameters so it should be used with care in order to avoid portability issues. </td>
</tr></tbody>
Modified: sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT_END.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT_END.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT_END.html 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_EXIT_END</pre></div>
<div class="refsect1">
-<a name="id922288"></a><h2>Description</h2>
+<a name="id922587"></a><h2>Description</h2>
<p>This macro must follow the local exit body code <code class="computeroutput">{ ... }</code> as shown in the <code class="computeroutput"><a class="link" href="BOOST_LOCAL_EXIT.html" title="Macro BOOST_LOCAL_EXIT">BOOST_LOCAL_EXIT</a></code> documentation.</p>
<p><span class="bold"><strong>Note:</strong></span> This macro cannot be used multiple times on the same line because it internally uses the line number <code class="computeroutput">__LINE__</code> to generate unique identifiers.</p>
<p><span class="bold"><strong>See:</strong></span> <code class="computeroutput"><a class="link" href="BOOST_LOCAL_EXIT.html" title="Macro BOOST_LOCAL_EXIT">BOOST_LOCAL_EXIT</a></code>, <a class="link" href="boost_local/Tutorial.html" title="Tutorial">Tutorial</a> section. </p>
Modified: sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT_TPL.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT_TPL.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT_TPL.html 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_EXIT_TPL(binding_list)</pre></div>
<div class="refsect1">
-<a name="id922214"></a><h2>Description</h2>
+<a name="id922513"></a><h2>Description</h2>
<p><span class="bold"><strong>See:</strong></span> <code class="computeroutput"><a class="link" href="BOOST_LOCAL_EXIT.html" title="Macro BOOST_LOCAL_EXIT">BOOST_LOCAL_EXIT</a></code>, <a class="link" href="boost_local/Tutorial.html" title="Tutorial">Tutorial</a> section. </p>
</div>
</div>
Modified: sandbox/local/libs/local/doc/html/BOOST_LOCAL_FUNCTION_NAME.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_LOCAL_FUNCTION_NAME.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_LOCAL_FUNCTION_NAME.html 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
@@ -33,13 +33,13 @@
</span>BOOST_LOCAL_FUNCTION_NAME(name)</pre></div>
<div class="refsect1">
-<a name="id923547"></a><h2>Description</h2>
+<a name="id923845"></a><h2>Description</h2>
<p>This macro must follow the local function body code block <code class="computeroutput">{ ... }</code> as shown in the <code class="computeroutput"><a class="link" href="BOOST_LOCAL_FUNCTION_PARAMS.html" title="Macro BOOST_LOCAL_FUNCTION_PARAMS">BOOST_LOCAL_FUNCTION_PARAMS</a></code> documentation.</p>
-<p>The local function name can be prefixed by the "keyword" <code class="computeroutput">inline</code>: </p>
+<p>The local function name can be prefixed by the "keyword" <code class="computeroutput">inline</code> (see the <a class="link" href="boost_local/Advanced_Topics.html" title="Advanced Topics"> Advanced Topics</a> section): </p>
<pre class="programlisting"> <span class="special">...</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="keyword">inline</span> <span class="identifier">name</span><span class="special">)</span>
</pre>
-<p> This increases the chances that the compiler will be able to inline the local function calls (thus reducing their run-time). However, inlined local functions cannot be passed as template parameters (on ISO C++ compliant compilers, see <code class="computeroutput"><a class="link" href="BOOST_LOCAL_CONFIG_COMPLIANT.html" title="Macro BOOST_LOCAL_CONFIG_COMPLIANT">BOOST_LOCAL_CONFIG_COMPLIANT</a></code>, but they can be passed as template parameters on C++0x compilers). Furthermore, inlined local functions cannot be assigned to other functors like <code class="computeroutput">boost::function</code>. On C++0x compilers, there is no need to declare a local function lined because this library will automatically use C++0x 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 prefixed by the "keyword" <code class="computeroutput">recursive</code>: </p>
+<p> This increases the chances that the compiler will be able to inline the local function calls (thus reducing their run-time). However, inlined local functions cannot be passed as template parameters or assigned to other functors like <code class="computeroutput">boost::function</code> (that is true on ISO C++ compilers, see <code class="computeroutput"><a class="link" href="BOOST_LOCAL_CONFIG_COMPLIANT.html" title="Macro BOOST_LOCAL_CONFIG_COMPLIANT">BOOST_LOCAL_CONFIG_COMPLIANT</a></code>, but inlined local functions can instead be passed as template parameters on C++0x compilers). On C++0x compilers, there is no need to declare a local function lined because this library will automatically use C++0x 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 prefixed by the "keyword" <code class="computeroutput">recursive</code> (see the <a class="link" href="boost_local/Advanced_Topics.html" title="Advanced Topics"> Advanced Topics</a> section): </p>
<pre class="programlisting"> <span class="special">...</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">recursive</span> <span class="identifier">name</span><span class="special">)</span>
</pre>
<p> 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 inlined).</p>
@@ -52,8 +52,7 @@
<tbody><tr>
<td><span class="bold"><strong><code class="computeroutput">name</code></strong></span></td>
<td>The name of the local function. The local function name can be prefixed by the "keyword" <code class="computeroutput">inline</code> to declare the local function inlined or by the "keyword" <code class="computeroutput">recursive</code> to declare the local function recursive (see the <a class="link" href="boost_local/Advanced_Topics.html" title="Advanced Topics">
- Advanced Topics</a> section). 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 (i.e., it is not possible to overload local function declarations, see the <a class="link" href="boost_local/Advanced_Topics.html" title="Advanced Topics">
- Advanced Topics</a> section). </td>
+ Advanced Topics</a> section). 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 (use the <code class="computeroutput"><a class="link" href="boost/local/function/overload.html" title="Class template overload">boost::local::function::overload</a></code> functor to overload local functions, see the <a class="link" href="boost_local/Advanced_Topics.html" title="Advanced Topics"> Advanced Topics</a> section). </td>
</tr></tbody>
</table></div>
<p>
Modified: sandbox/local/libs/local/doc/html/BOOST_LOCAL_FUNCTION_PARAMS.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_LOCAL_FUNCTION_PARAMS.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_LOCAL_FUNCTION_PARAMS.html 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_FUNCTION_PARAMS(parameters)</pre></div>
<div class="refsect1">
-<a name="id922455"></a><h2>Description</h2>
+<a name="id922754"></a><h2>Description</h2>
<p>This macro must be used within a declarative context, it must follow the local function result type, it must be followed by the local function body code and then by the <code class="computeroutput"><a class="link" href="BOOST_LOCAL_FUNCTION_NAME.html" title="Macro BOOST_LOCAL_FUNCTION_NAME">BOOST_LOCAL_FUNCTION_NAME</a></code> macro (see the <a class="link" href="boost_local/Tutorial.html" title="Tutorial">Tutorial</a> and <a class="link" href="boost_local/Advanced_Topics.html" title="Advanced Topics"> Advanced Topics</a> sections): </p>
<pre class="programlisting"> <span class="special">{</span> <span class="comment">// Some declarative context.</span>
<span class="special">...</span>
@@ -70,13 +70,13 @@
<span class="keyword">default</span> <span class="identifier">default_vale_expression</span>
<span class="identifier">bound_parameter</span><span class="special">:</span>
<span class="special">[</span><span class="keyword">const</span><span class="special">]</span> <span class="identifier">bind</span> <span class="special">[</span><span class="special">(</span><span class="identifier">variable_type</span><span class="special">)</span><span class="special">]</span> <span class="special">[</span><span class="special">&</span><span class="special">]</span> <span class="identifier">variable_name</span>
-</pre> Where the following lexical conventions have been used: <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 (i.e., <code class="computeroutput">token</code> is optional).On C99 and later compilers which support variadic macros, the above grammar can be modified as follow to define the <span class="emphasis"><em>variadic macro syntax</em></span> that can also be used to specify the local functions parameters: <pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"> <span class="identifier">void_list</span><span class="special">:</span>
+</pre> Where the following lexical conventions have been used: <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 (i.e., <code class="computeroutput">token</code> is optional).On C99 and later compilers that support variadic macros, the above grammar can be modified as follow to define the <span class="emphasis"><em>variadic macro syntax</em></span> that can also be used to specify the local functions parameters: <pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"> <span class="identifier">void_list</span><span class="special">:</span>
<span class="keyword">void</span>
<span class="identifier">parameter_list</span><span class="special">:</span>
<span class="identifier">parameter1</span><span class="special">,</span> <span class="identifier">parameter2</span><span class="special">,</span> <span class="special">...</span>
<span class="identifier">default_parameter_value</span><span class="special">:</span>
<span class="special">,</span> <span class="identifier">default_value</span>
-</pre> Note that the variadic macro syntax uses commas <code class="computeroutput">,</code> instead of parenthesis <code class="computeroutput">()</code> to separate the parameters and therefore resembles the usual C++ function parameter declaration syntax more closely than the sequencing macro syntax. However, the variadic macro syntax will only work on C++ compilers that support variadic macros so it should be used with care in order to avoid portability issues.Finally, on C++ compilers which support empty macro parameters, the above grammars can be modified as follow to define the <span class="emphasis"><em>empty macro syntax</em></span> that can can also be used to specify an empty parameter list: <pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"> <span class="identifier">void_list</span><span class="special">:</span>
+</pre> Note that the variadic macro syntax uses commas <code class="computeroutput">,</code> instead of parenthesis <code class="computeroutput">()</code> to separate the parameters and therefore resembles the usual C++ function parameter declaration syntax more closely than the sequencing macro syntax. However, the variadic macro syntax will only work on C++ compilers that support variadic macros so it should be used with care in order to avoid portability issues.Finally, on C++ compilers that support empty macro parameters, the above grammars can be modified as follow to define the <span class="emphasis"><em>empty macro syntax</em></span> that can can also be used to specify an empty parameter list: <pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"> <span class="identifier">void_list</span><span class="special">:</span>
<span class="special">(</span><span class="special">)</span>
</pre> Note that the empty macro parameter syntax uses the usual C++ syntax to specify empty function parameter list but it will only work on compilers that support empty macro parameters so it should be used with care in order to avoid portability issues. </td>
</tr></tbody>
Modified: sandbox/local/libs/local/doc/html/BOOST_LOCAL_FUNCTION_PARAMS_TPL.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_LOCAL_FUNCTION_PARAMS_TPL.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_LOCAL_FUNCTION_PARAMS_TPL.html 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_FUNCTION_PARAMS_TPL(parameters)</pre></div>
<div class="refsect1">
-<a name="id923472"></a><h2>Description</h2>
+<a name="id923771"></a><h2>Description</h2>
<p><span class="bold"><strong>See:</strong></span> <code class="computeroutput"><a class="link" href="BOOST_LOCAL_FUNCTION_PARAMS.html" title="Macro BOOST_LOCAL_FUNCTION_PARAMS">BOOST_LOCAL_FUNCTION_PARAMS</a></code>, <a class="link" href="boost_local/Tutorial.html" title="Tutorial">Tutorial</a> section. </p>
</div>
</div>
Modified: sandbox/local/libs/local/doc/html/BOOST_LOCAL_TYPEOF.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_LOCAL_TYPEOF.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_LOCAL_TYPEOF.html 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_TYPEOF(bound_variable_name)</pre></div>
<div class="refsect1">
-<a name="id925190"></a><h2>Description</h2>
+<a name="id925586"></a><h2>Description</h2>
<p>The type is fully qualified in that it contains the extra constant and reference qualifiers when they are specified for binding by constant and by reference. For example, if a variable named <code class="computeroutput">t</code> of type <code class="computeroutput">T</code> is: </p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>Bound by value using <code class="computeroutput">bind t</code> then <code class="computeroutput">BOOST_LOCAL_TYPEOF(t)</code> is <code class="computeroutput">T</code>. </p></li>
Modified: sandbox/local/libs/local/doc/html/boost/local/function/overload.html
==============================================================================
--- sandbox/local/libs/local/doc/html/boost/local/function/overload.html (original)
+++ sandbox/local/libs/local/doc/html/boost/local/function/overload.html 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
@@ -35,35 +35,37 @@
<span class="keyword">class</span> <a class="link" href="overload.html" title="Class template overload">overload</a> <span class="special">{</span>
<span class="keyword">public</span><span class="special">:</span>
<span class="comment">// <a class="link" href="overload.html#boost.local.function.overloadconstruct-copy-destruct">construct/copy/destruct</a></span>
- <a class="link" href="overload.html#id429786-bb"><span class="identifier">overload</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">F0</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">F1</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>
+ <a class="link" href="overload.html#id432165-bb"><span class="identifier">overload</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">F0</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">F1</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="overload.html#id429708-bb">public member functions</a></span>
- <span class="identifier">result_type</span><span class="special"><</span> <span class="identifier">F0</span> <span class="special">></span> <a class="link" href="overload.html#id429712-bb"><span class="keyword">operator</span><span class="special">(</span><span class="special">)</span></a><span class="special">(</span><span class="identifier">arg0_type</span><span class="special"><</span> <span class="identifier">F0</span> <span class="special">></span><span class="special">,</span> <span class="identifier">arg1_type</span><span class="special"><</span> <span class="identifier">F0</span> <span class="special">></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">result_type</span><span class="special"><</span> <span class="identifier">F1</span> <span class="special">></span> <a class="link" href="overload.html#id429749-bb"><span class="keyword">operator</span><span class="special">(</span><span class="special">)</span></a><span class="special">(</span><span class="identifier">arg0_type</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="identifier">F1</span> <span class="special">></span><span class="special">,</span> <span class="special">...</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
+ <span class="comment">// <a class="link" href="overload.html#id432086-bb">public member functions</a></span>
+ <span class="identifier">result_type</span><span class="special"><</span> <span class="identifier">F0</span> <span class="special">></span> <a class="link" href="overload.html#id432090-bb"><span class="keyword">operator</span><span class="special">(</span><span class="special">)</span></a><span class="special">(</span><span class="identifier">arg0_type</span><span class="special"><</span> <span class="identifier">F0</span> <span class="special">></span><span class="special">,</span> <span class="identifier">arg1_type</span><span class="special"><</span> <span class="identifier">F0</span> <span class="special">></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">result_type</span><span class="special"><</span> <span class="identifier">F1</span> <span class="special">></span> <a class="link" href="overload.html#id432128-bb"><span class="keyword">operator</span><span class="special">(</span><span class="special">)</span></a><span class="special">(</span><span class="identifier">arg0_type</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="identifier">F1</span> <span class="special">></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="id924552"></a><h2>Description</h2>
-<p>This functor aggregates together calls to functions of all the specified types.</p>
+<a name="id924884"></a><h2>Description</h2>
+<p>This functor aggregates together calls to functions of all the specified function types <code class="computeroutput">F0</code>, <code class="computeroutput">F1</code>, etc. Each function type must be specified following the Boost.Function preferred syntax: </p>
+<pre class="programlisting"> <span class="identifier">ResultType</span> <span class="special">(</span><span class="identifier">ArgumentType0</span><span class="special">,</span> <span class="identifier">ArgumgnetType1</span><span class="special">,</span> <span class="special">...</span><span class="special">)</span>
+</pre>
<p>The maximum number of overloaded function types is specified by the <code class="computeroutput"><a class="link" href="../../../BOOST_LOCAL_CONFIG_OVERLOAD_MAX.html" title="Macro BOOST_LOCAL_CONFIG_OVERLOAD_MAX">BOOST_LOCAL_CONFIG_OVERLOAD_MAX</a></code> configuration macro. The maximum number of function parameters for each of the specified function type is specified by the <code class="computeroutput"><a class="link" href="../../../BOOST_LOCAL_CONFIG_OVERLOAD_MAX.html" title="Macro BOOST_LOCAL_CONFIG_OVERLOAD_MAX">BOOST_LOCAL_CONFIG_OVERLOAD_MAX</a></code> configuration macro.</p>
-<p><span class="bold"><strong>See:</strong></span> <a class="link" href="../../../boost_local/Advanced_Topics.html" title="Advanced Topics"> Advanced Topics</a> section, <code class="computeroutput"><a class="link" href="../../../BOOST_LOCAL_CONFIG_OVERLOAD_MAX.html" title="Macro BOOST_LOCAL_CONFIG_OVERLOAD_MAX">BOOST_LOCAL_CONFIG_OVERLOAD_MAX</a></code>, <code class="computeroutput"><a class="link" href="../../../BOOST_LOCAL_CONFIG_OVERLOAD_MAX.html" title="Macro BOOST_LOCAL_CONFIG_OVERLOAD_MAX">BOOST_LOCAL_CONFIG_OVERLOAD_MAX</a></code>. </p>
+<p><span class="bold"><strong>See:</strong></span> <a class="link" href="../../../boost_local/Advanced_Topics.html" title="Advanced Topics"> Advanced Topics</a> section, <code class="computeroutput"><a class="link" href="../../../BOOST_LOCAL_CONFIG_OVERLOAD_MAX.html" title="Macro BOOST_LOCAL_CONFIG_OVERLOAD_MAX">BOOST_LOCAL_CONFIG_OVERLOAD_MAX</a></code>, <code class="computeroutput"><a class="link" href="../../../BOOST_LOCAL_CONFIG_OVERLOAD_MAX.html" title="Macro BOOST_LOCAL_CONFIG_OVERLOAD_MAX">BOOST_LOCAL_CONFIG_OVERLOAD_MAX</a></code>, Boost.Function. </p>
<div class="refsect2">
-<a name="id924631"></a><h3>
+<a name="id925028"></a><h3>
<a name="boost.local.function.overloadconstruct-copy-destruct"></a><code class="computeroutput">overload</code>
public
construct/copy/destruct</h3>
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
-<pre class="literallayout"><a name="id429786-bb"></a><span class="identifier">overload</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">F0</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">F1</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 overloading functor. <p>Any functor that can be converted to a <code class="computeroutput">boost::function</code> funcotr can be specified (local functions, functio
n pointers, other functors, etc). </p>
+<pre class="literallayout"><a name="id432165-bb"></a><span class="identifier">overload</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">F0</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">F1</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 overloading functor. <p>Any functor that can be converted to a <code class="computeroutput">boost::function</code> funcotr can be specified (local functions, functio
n pointers, other functors, etc). </p>
</li></ol></div>
</div>
<div class="refsect2">
-<a name="id924807"></a><h3>
-<a name="id429708-bb"></a><code class="computeroutput">overload</code> public member functions</h3>
+<a name="id925203"></a><h3>
+<a name="id432086-bb"></a><code class="computeroutput">overload</code> public member functions</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
-<pre class="literallayout"><span class="identifier">result_type</span><span class="special"><</span> <span class="identifier">F0</span> <span class="special">></span> <a name="id429712-bb"></a><span class="keyword">operator</span><span class="special">(</span><span class="special">)</span><span class="special">(</span><span class="identifier">arg0_type</span><span class="special"><</span> <span class="identifier">F0</span> <span class="special">></span><span class="special">,</span> <span class="identifier">arg1_type</span><span class="special"><</span> <span class="identifier">F0</span> <span class="special">></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 first specified functor. <p>This will in turn invoke the call operator of the first functor that was passed to the constructor. </p>
+<pre class="literallayout"><span class="identifier">result_type</span><span class="special"><</span> <span class="identifier">F0</span> <span class="special">></span> <a name="id432090-bb"></a><span class="keyword">operator</span><span class="special">(</span><span class="special">)</span><span class="special">(</span><span class="identifier">arg0_type</span><span class="special"><</span> <span class="identifier">F0</span> <span class="special">></span><span class="special">,</span> <span class="identifier">arg1_type</span><span class="special"><</span> <span class="identifier">F0</span> <span class="special">></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 first. <p>This will in turn invoke the call operator of the first functor that was passed to the constructor. </p>
</li>
<li class="listitem">
-<pre class="literallayout"><span class="identifier">result_type</span><span class="special"><</span> <span class="identifier">F1</span> <span class="special">></span> <a name="id429749-bb"></a><span class="keyword">operator</span><span class="special">(</span><span class="special">)</span><span class="special">(</span><span class="identifier">arg0_type</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="identifier">F1</span> <span class="special">></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 second specified functor. <p>This will in turn invoke the call operator of the second functor that was passed to the constructor. </p>
+<pre class="literallayout"><span class="identifier">result_type</span><span class="special"><</span> <span class="identifier">F1</span> <span class="special">></span> <a name="id432128-bb"></a><span class="keyword">operator</span><span class="special">(</span><span class="special">)</span><span class="special">(</span><span class="identifier">arg0_type</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="identifier">F1</span> <span class="special">></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 second. <p>This will in turn invoke the call operator of the second functor that was passed to the constructor. </p>
</li>
</ol></div>
</div>
Modified: sandbox/local/libs/local/doc/html/boost_local/Acknowledgments.html
==============================================================================
--- sandbox/local/libs/local/doc/html/boost_local/Acknowledgments.html (original)
+++ sandbox/local/libs/local/doc/html/boost_local/Acknowledgments.html 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
@@ -31,13 +31,22 @@
and development of this library.
</p>
<p>
- Thanks to Steven Watanabe and Vicente Botet for suggesting to use Boost.ScopeExit
- binding to emulate local functions (in the context of constant-correct checking
- of block invariants).
- </p>
-<p>
- Thanks to Alexander Nasonov for clarifying how Boost.ScopeExit
- binding could be used to implement local functions.
+ Many thanks to Steven Watanabe and Vicente Botet for suggesting to me to use
+ 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
+ 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>
+<p>
+ Many thanks to Gregory Crosswhite for using Boost.Local
+ in one of his projects.
+ </p>
+<p>
+ Thanks to David Abrahams, Vicente Botet, et al. for suggesting to provide the
+ <a href="http://lists.boost.org/Archives/boost/2011/02/176712.php" target="_top">variadic
+ macro syntax</a> on compilers that support variadic macros.
</p>
<p>
Thanks to Pierre Morcello for suggesting to use <code class="computeroutput"><span class="keyword">return</span><span class="special">;</span></code> to exit local blocks (in the context of a
@@ -47,12 +56,25 @@
binding (even if this library was not developed using such a code).
</p>
<p>
- Thanks to John Bytheway for refining the authors' technique that allows this
- library to pass local functions as template parameters.
+ Thanks to John Bytheway for checking the authors' virtual functor technique
+ that originally allowed this library to pass local functions as template parameters.
</p>
<p>
Thanks to Jeffrey Lee Hellrung for suggesting the use of the "keyword"
- <code class="computeroutput"><span class="identifier">bind</span></code> to bind variables in scope.
+ <code class="computeroutput"><span class="identifier">bind</span></code> to bind variables in scope
+ and for suggesting to use <code class="computeroutput"><span class="identifier">bind</span><span class="special">(</span><span class="identifier">type</span><span class="special">)</span></code>
+ to optionally specify the bound variable type (instead of using Boost.Typeof).
+ Thanks to Vicente Botet for suggesting to provide <code class="computeroutput"><a class="link" href="../BOOST_LOCAL_TYPEOF.html" title="Macro BOOST_LOCAL_TYPEOF">BOOST_LOCAL_TYPEOF</a></code>
+ to access the bound variable type.
+ </p>
+<p>
+ Thanks to Mathias Gaunard for suggesting to implement <code class="computeroutput"><a class="link" href="../boost/local/function/overload.html" title="Class template overload">boost::local::function::overload</a></code>
+ and for providing an early version of it.
+ </p>
+<p>
+ Thanks to Steven Watanabe, Vicente Botet, Michael Caisse, Yechezkel Mett, Joel
+ de Guzman, Thomas Heller, et al. for helping with the <a class="link" href="Alternatives.html" title="Appendix: Alternatives">Alternatives</a>
+ section and with the profiling of the different alternatives.
</p>
<p>
Finally, many thanks to the entire Boost
Modified: sandbox/local/libs/local/doc/html/boost_local/Advanced_Topics.html
==============================================================================
--- sandbox/local/libs/local/doc/html/boost_local/Advanced_Topics.html (original)
+++ sandbox/local/libs/local/doc/html/boost_local/Advanced_Topics.html 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
@@ -86,7 +86,7 @@
<p>
In addition, local function parameter types cannot start with non-alphanumeric
symbols (alphanumeric symbols are <code class="computeroutput"><span class="identifier">A</span><span class="special">-</span><span class="identifier">Z</span></code>, <code class="computeroutput"><span class="identifier">a</span><span class="special">-</span><span class="identifier">z</span></code>,
- and <code class="computeroutput"><span class="number">0</span><span class="special">-</span><span class="number">9</span></code>). <sup>[<a name="id881778" href="#ftn.id881778" class="footnote">16</a>]</sup> The library will generate (cryptic) preprocessor errors if a
+ and <code class="computeroutput"><span class="number">0</span><span class="special">-</span><span class="number">9</span></code>). <sup>[<a name="id882033" href="#ftn.id882033" class="footnote">18</a>]</sup> The library will generate (cryptic) preprocessor errors if a
parameter type starts with a non-alphanumeric symbol.
</p>
<p>
@@ -225,7 +225,7 @@
<li class="listitem">
Parenthesis to wrap the type expression (and therefore any commas <code class="computeroutput"><span class="special">,</span></code> that it contains) passed as parameter
to the <code class="computeroutput"><a class="link" href="../BOOST_IDENTITY_TYPE.html" title="Macro BOOST_IDENTITY_TYPE">BOOST_IDENTITY_TYPE</a></code>
- macro. <sup>[<a name="id883215" href="#ftn.id883215" class="footnote">17</a>]</sup>
+ macro. <sup>[<a name="id883470" href="#ftn.id883470" class="footnote">19</a>]</sup>
</li>
</ol></div>
<div class="note"><table border="0" summary="Note">
@@ -1179,7 +1179,7 @@
<pre class="programlisting"><span class="identifier">bind</span><span class="special">(</span><span class="emphasis"><em>variable-type</em></span><span class="special">)</span> <span class="emphasis"><em>variable-name</em></span> <span class="comment">// Bind by value with explicit type.</span>
<span class="identifier">bind</span><span class="special">(</span><span class="emphasis"><em>variable-type</em></span><span class="special">)&</span> <span class="emphasis"><em>variable-name</em></span> <span class="comment">// Bind by reference with explicit type.</span>
<span class="keyword">const</span> <span class="identifier">bind</span><span class="special">(</span><span class="emphasis"><em>variable-type</em></span><span class="special">)</span> <span class="emphasis"><em>variable-name</em></span> <span class="comment">// Bind by constant value with explicit type.</span>
-<span class="keyword">const</span> <span class="identifier">bind</span><span class="special">(</span><span class="emphasis"><em>variable-type</em></span><span class="special">)&</span> <span class="emphasis"><em>variable-name</em></span> <span class="comment">// Bind by constant value with explicit type.</span>
+<span class="keyword">const</span> <span class="identifier">bind</span><span class="special">(</span><span class="emphasis"><em>variable-type</em></span><span class="special">)&</span> <span class="emphasis"><em>variable-name</em></span> <span class="comment">// Bind by constant reference with explicit type.</span>
<span class="identifier">bind</span><span class="special">(</span><span class="emphasis"><em>class-type</em></span><span class="special">*)</span> <span class="keyword">this</span> <span class="comment">// Bind object `this` with type.</span>
<span class="keyword">const</span> <span class="identifier">bind</span><span class="special">(</span><span class="emphasis"><em>class-type</em></span><span class="special">*)</span> <span class="keyword">this</span> <span class="comment">// Bind object `this` by constant with type.</span>
</pre>
@@ -1358,7 +1358,7 @@
the <a class="link" href="Alternatives.html" title="Appendix: Alternatives">Alternatives</a> section).
However, inlined local functions have the limitation that they cannot be
assigned to other functors (like <code class="computeroutput">boost::function</code>)
- and they cannot be passed as template parameters. <sup>[<a name="id903826" href="#ftn.id903826" class="footnote">18</a>]</sup> On C++0x compilers, <code class="computeroutput"><span class="keyword">inline</span></code>
+ and they cannot be passed as template parameters. <sup>[<a name="id904081" href="#ftn.id904081" class="footnote">20</a>]</sup> On C++0x compilers, <code class="computeroutput"><span class="keyword">inline</span></code>
has no effect because this library will automatically generate code that
uses C++0x specific features to inline the local function calls whenever
possible even if the local function is not declared inlined (unless the
@@ -1800,7 +1800,7 @@
functor can be constructed from any function type that can be converted to
a <code class="computeroutput">boost::function</code>
type (i.e., local functions but also function pointers and other function
- objects). <sup>[<a name="id912714" href="#ftn.id912714" class="footnote">19</a>]</sup> The <code class="computeroutput"><a class="link" href="../boost/local/function/overload.html" title="Class template overload">boost::local::function::overload</a></code>
+ objects). <sup>[<a name="id912970" href="#ftn.id912970" class="footnote">21</a>]</sup> The <code class="computeroutput"><a class="link" href="../boost/local/function/overload.html" title="Class template overload">boost::local::function::overload</a></code>
functor provides overloaded call operators <code class="computeroutput"><span class="keyword">operator</span><span class="special">()</span></code> that match the signatures of all the specified
function types.
</p>
@@ -2080,7 +2080,7 @@
<p>
Local function parameters support the storage classifiers as usual in ISO
C++. The <code class="computeroutput"><span class="keyword">auto</span></code> storage classifier
- is specified as: <sup>[<a name="id917328" href="#ftn.id917328" class="footnote">20</a>]</sup>
+ is specified as: <sup>[<a name="id917584" href="#ftn.id917584" class="footnote">22</a>]</sup>
</p>
<pre class="programlisting"><span class="keyword">auto</span> <span class="emphasis"><em>parameter-type parameter-name</em></span>
</pre>
@@ -2310,7 +2310,7 @@
<td>
<p>
This is not supported because local functions are not member functions.
- <sup>[<a name="id918580" href="#ftn.id918580" class="footnote">a</a>]</sup>
+ <sup>[<a name="id918835" href="#ftn.id918835" class="footnote">a</a>]</sup>
</p>
</td>
</tr>
@@ -2409,11 +2409,11 @@
</td>
</tr>
</tbody>
-<tbody class="footnotes"><tr><td colspan="3"><div class="footnote"><p><sup>[<a id="ftn.id918580" href="#id918580" class="para">a</a>] </sup>
- <span class="bold"><strong>Rationale.</strong></span> In theory, it would
- be possible for a local functor class to inherit from another
- local functor class. However, this "inheritance" feature
- is not implemented because it seems of <a href="http://lists.boost.org/Archives/boost/2010/09/170895.php" target="_top">no
+<tbody class="footnotes"><tr><td colspan="3"><div class="footnote"><p><sup>[<a id="ftn.id918835" href="#id918835" class="para">a</a>] </sup>
+ <span class="bold"><strong>Rationale.</strong></span> It would be possible
+ to make a local function class inherit from another local function
+ class. However, this "inheritance" feature is not implemented
+ because it seemed of <a href="http://lists.boost.org/Archives/boost/2010/09/170895.php" target="_top">no
use</a> given that local functions can be bound to one another
thus they can simply call each other directly without recurring
to dynamic binding or base function call.
@@ -2425,7 +2425,7 @@
</h6>
<p>
Local functions cannot be operators. Naming a local function <code class="computeroutput"><span class="keyword">operator</span><span class="special">...</span></code>
- will generate a compile-time error. <sup>[<a name="id918926" href="#ftn.id918926" class="footnote">21</a>]</sup>
+ will generate a compile-time error. <sup>[<a name="id919181" href="#ftn.id919181" class="footnote">23</a>]</sup>
</p>
<p>
For example, the following code will <span class="bold"><strong>not</strong></span>
@@ -2477,21 +2477,21 @@
</div>
<div class="footnotes">
<br><hr width="100" align="left">
-<div class="footnote"><p><sup>[<a id="ftn.id881778" href="#id881778" class="para">16</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id882033" href="#id882033" class="para">18</a>] </sup>
<span class="bold"><strong>Rationale.</strong></span> This limitation derives from
the fact that <code class="computeroutput"><a class="link" href="../BOOST_LOCAL_FUNCTION_PARAMS.html" title="Macro BOOST_LOCAL_FUNCTION_PARAMS">BOOST_LOCAL_FUNCTION_PARAMS</a></code>
uses preprocessor token concatenation to inspect the parameter type token
to see if the token is a parameter or a bound variable. The C++ preprocessor
does not allow to concatenate non-alphanumeric tokens.
</p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id883215" href="#id883215" class="para">17</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id883470" href="#id883470" class="para">19</a>] </sup>
<span class="bold"><strong>Rationale.</strong></span> Using variadic macros,
this extra set of parenthesis could be eliminated requiring only the
parenthesis to invoke the <code class="computeroutput"><a class="link" href="../BOOST_IDENTITY_TYPE.html" title="Macro BOOST_IDENTITY_TYPE">BOOST_IDENTITY_TYPE</a></code>
macro. However, this feature is currently not implemented and the double
parenthesis are always needed when invoking this macro.
</p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id903826" href="#id903826" class="para">18</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id904081" href="#id904081" class="para">20</a>] </sup>
<span class="bold"><strong>Rationale.</strong></span> This library uses an indirect
function call via a function pointer in order to pass the local function
as a template parameter (see the <a class="link" href="Implementation.html" title="Appendix: Implementation">Implementation</a>
@@ -2505,7 +2505,7 @@
be inlined on C++0x compilers (even when the local function is not declared
inlined).
</p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id912714" href="#id912714" class="para">19</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id912970" href="#id912970" class="para">21</a>] </sup>
The <code class="computeroutput"><a class="link" href="../boost/local/function/overload.html" title="Class template overload">boost::local::function::overload</a></code>
functor can aggregate any functor and it is not at all specific to local
functions. Therefore, it might be preferable to move <code class="computeroutput"><a class="link" href="../boost/local/function/overload.html" title="Class template overload">boost::local::function::overload</a></code>
@@ -2513,7 +2513,7 @@
to Boost.Function
and to rename it as <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span><span class="special">::</span><span class="identifier">overload</span></code>.
</p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id917328" href="#id917328" class="para">20</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id917584" href="#id917584" class="para">22</a>] </sup>
The <code class="computeroutput"><span class="keyword">auto</span></code> storage classifier
is part of the ISO C++ standard and therefore supported by this library.
However, the meaning and usage of the <code class="computeroutput"><span class="keyword">auto</span></code>
@@ -2521,7 +2521,7 @@
storage classifier with the usual care in order to avoid writing ISO C++
code that might not work on C++0x.
</p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id918926" href="#id918926" class="para">21</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id919181" href="#id919181" class="para">23</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
Modified: sandbox/local/libs/local/doc/html/boost_local/Alternatives.html
==============================================================================
--- sandbox/local/libs/local/doc/html/boost_local/Alternatives.html (original)
+++ sandbox/local/libs/local/doc/html/boost_local/Alternatives.html 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
@@ -76,7 +76,7 @@
<th>
<p>
<a href="http://en.wikipedia.org/wiki/C%2B%2B0x#Lambda_functions_and_expressions" target="_top">C++0x
- lambda</a> (not ISO C++)
+ Lambda</a> (not ISO C++)
</p>
</th>
<th>
@@ -132,7 +132,7 @@
<tr>
<td>
<p>
- <span class="emphasis"><em>Can be defined using regular C++ statements</em></span>
+ <span class="emphasis"><em>Can be defined using C++ statement syntax</em></span>
</p>
</td>
<td>
@@ -161,12 +161,14 @@
</td>
<td>
<p>
- No.
+ No (it uses C++ <a href="http://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/Expression-template" target="_top">expression
+ template</a> syntax).
</p>
</td>
<td>
<p>
- No.
+ No (it uses C++ <a href="http://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/Expression-template" target="_top">expression
+ template</a> syntax).
</p>
</td>
</tr>
@@ -258,21 +260,21 @@
<td>
<p>
Yes. The variable names are repeated in the function declaration
- so they can be bound by value, constant value, reference, and constant
- reference (the object <code class="computeroutput"><span class="keyword">this</span></code>
+ so they can be bound by value, by constant value, by reference,
+ and by constant reference (the object <code class="computeroutput"><span class="keyword">this</span></code>
can also be bound).
</p>
</td>
<td>
<p>
No. Programmers must manually manage functor member variables and
- their explicit types to access variables in scope.
+ explicitly specify their types to access variables in scope.
</p>
</td>
<td>
<p>
No. Programmers must manually manage functor member variables and
- their explicit types to access variables in scope.
+ explicitly specify their types to access variables in scope.
</p>
</td>
<td>
@@ -282,7 +284,7 @@
at once) so they can be bound by constant value and by reference
(the object <code class="computeroutput"><span class="keyword">this</span></code> can
also be bound). However, variables cannot be bound by constant
- references and non-constant value.
+ references and non-constant value (see below).
</p>
</td>
<td>
@@ -292,8 +294,8 @@
</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
+ 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>
@@ -338,6 +340,71 @@
</tr>
</tbody>
</table></div>
+<a name="boost_local.Alternatives.local_functions.comparison_with__ulink_url__http___en_wikipedia_org_wiki_c_2b_2b0x_lambda_functions_and_expressions__c__0x_lambda__ulink__functions"></a><h6>
+<a name="boost_local.Alternatives.local_functions.comparison_with__ulink_url__http___en_wikipedia_org_wiki_c_2b_2b0x_lambda_functions_and_expressions__c__0x_lambda__ulink__functions-heading"></a>
+ <a class="link" href="Alternatives.html#boost_local.Alternatives.local_functions.comparison_with__ulink_url__http___en_wikipedia_org_wiki_c_2b_2b0x_lambda_functions_and_expressions__c__0x_lambda__ulink__functions">Comparison
+ with <a href="http://en.wikipedia.org/wiki/C%2B%2B0x#Lambda_functions_and_expressions" target="_top">C++0x
+ Lambda</a> Functions</a>
+ </h6>
+<p>
+ <a href="http://en.wikipedia.org/wiki/C%2B%2B0x#Lambda_functions_and_expressions" target="_top">C++0x
+ lambda</a> functions have most of the features that Boost.Local
+ local functions have, key pro and cons of the two approaches are:
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem">
+ <a href="http://en.wikipedia.org/wiki/C%2B%2B0x#Lambda_functions_and_expressions" target="_top">C++0x
+ lambda</a> functions can be defined within expressions while Boost.Local
+ local functions can only be defined within declarations.
+ </li>
+<li class="listitem">
+ <a href="http://en.wikipedia.org/wiki/C%2B%2B0x#Lambda_functions_and_expressions" target="_top">C++0x
+ lambda</a> functions are only supported by the C++0x standard so
+ they are not supported by all C++ compilers. Boost.Local
+ local functions use only ISO C++ compliant features so they are supported
+ on all C++ compliant compilers.
+ </li>
+<li class="listitem">
+ <a href="http://en.wikipedia.org/wiki/C%2B%2B0x#Lambda_functions_and_expressions" target="_top">C++0x
+ lambda</a> 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, <a href="http://en.wikipedia.org/wiki/C%2B%2B0x#Lambda_functions_and_expressions" target="_top">C++0x
+ lambda</a> functions can bind a variable by constant only if the
+ variable is copyable and the binding will require a potentially expensive
+ copy operation. For example:
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">x</span><span class="special">:</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">noncopyable</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="comment">// Cannot bind `x` by value because non copyable</span>
+ <span class="comment">// but if bind by reference `&x` then `x` is no</span>
+ <span class="comment">// longer constant within the lambda function.</span>
+ <span class="special">[</span><span class="identifier">x</span><span class="special">]()</span> <span class="special">{</span>
+ <span class="special">}();</span>
+
+ <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ Or:
+ </p>
+<pre class="programlisting"><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">double</span><span class="special">></span> <span class="identifier">v</span><span class="special">(</span><span class="number">1000000</span><span class="special">);</span>
+
+ <span class="comment">// Need to bind `v` by value to make it constant</span>
+ <span class="comment">// within the lambda function but that requires</span>
+ <span class="comment">// the expensive copy of a vector of 1000000 elements.</span>
+ <span class="special">[</span><span class="identifier">v</span><span class="special">]()</span> <span class="special">{</span>
+ <span class="special">}();</span>
+
+ <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ Both constant reference and non-constant value binding are instead supported
+ by Boost.Local.
+ </p>
<a name="boost_local.Alternatives.local_functions.examples"></a><h6>
<a name="boost_local.Alternatives.local_functions.examples-heading"></a>
<a class="link" href="Alternatives.html#boost_local.Alternatives.local_functions.examples">Examples</a>
@@ -478,7 +545,7 @@
</p>
<p>
Or using C++ global functors (but these do not allow to define the function
- locally so they are not an alternative implementation of local functions):
+ locally so they are not a real alternative implementation of local functions):
</p>
<p>
@@ -522,7 +589,7 @@
</p>
<p>
Or using <a href="http://en.wikipedia.org/wiki/C%2B%2B0x#Lambda_functions_and_expressions" target="_top">C++0x
- lambda</a> functions (but not part of ISO C++ standard):
+ lambda</a> functions (but not part of the ISO C++ standard):
</p>
<p>
@@ -634,7 +701,7 @@
</h6>
<p>
The following tables compare run-time, binary size, and compile-time for
- the different alternatives to local functions.
+ the different alternatives presented for local functions.
</p>
<p>
Overall, this library has compile-times and generates binary sizes similar
@@ -645,14 +712,15 @@
<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.1 with C++0x features enabled, see also [N2657])
- this library generates optimized code that runs as fast as the fastest of
- the other approaches (see "Boost.Local"
+ this library automatically generates optimized code that runs as fast as
+ the fastest of the other approaches (see "Boost.Local"
below). When this library local function is specified <code class="computeroutput"><span class="keyword">inline</span></code>
(see "Boost.Local
- Inline For-Loop" below) its run-times are always comparable to both
- the "Local Functor" and "Global Functor" approaches (for
- all these approaches, the local function cannot be portably passed as template
- parameter, see [N2657],
+ Inline For-Loop" 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>
@@ -663,38 +731,35 @@
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../doc/src/images/note.png"></td>
<th align="left">Note</th>
</tr>
-<tr><td align="left" valign="top">
-<p>
- The run-time performance of this library local function is explained because
- on ISO C++ compliant compilers (e.g., GCC 4.3.4) this library needs to
- use a function pointer in order to pass the local functor class as a template
- parameter (see [N2657]
+<tr><td align="left" valign="top"><p>
+ The run-time performances of this library local functions are explained
+ because on ISO C++ compliant compilers (e.g., GCC 4.3.4) this library needs
+ to use a function pointer in order to pass the local function class as
+ a template parameter (see [N2657]
and the <a class="link" href="Implementation.html" title="Appendix: Implementation">Implementation</a>
section). For all tested compilers, this function pointer prevents the
- compiler optimization algorithms from inlining all the function calls.
- Instead, the functor objects used by other approaches like "Boost.Lambda"
+ compiler optimization algorithms from inlining the local function calls.
+ Instead, the functors used by other approaches like "Boost.Lambda"
and "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 8.0 or GCC 4.51 with C++0x features enabled) because this library
+ MSVC 8.0 or GCC 4.5.1 with C++0x features enabled) because this library
does not have to use the extra function pointer to implement the local
- function call.
- </p>
-<p>
- This run-time performance cost on ISO C++ 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, 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.
- </p>
-</td></tr>
+ function call (it directly passes the local class type as template parameter).
+ </p></td></tr>
</table></div>
<p>
+ This run-time performance cost on ISO C++ 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, 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.
+ </p>
+<p>
Finally, note that only a very simple local function body with just a single
- instruction was used for the anaylsis presented here (see the profile program
+ instruction was used for the anaylsis presented here (see the <code class="computeroutput"><span class="identifier">profile_</span><span class="special">...</span></code>
source files linked below). The authors have not studied how this library
and the other approaches will perform with respect to each other when a more
complex set of instructions is programmed for the local function body (e.g.,
@@ -724,7 +789,7 @@
together 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 source files at profile_boost_local.cpp
,
+ (see source files profile_boost_local.cpp
,
<a href="../../../example/profile_boost_local_inline.cpp" target="_top"><code class="literal">profile_boost_local_inline.cpp</code></a>,
<a href="../../../example/profile_local_functor.cpp" target="_top"><code class="literal">profile_local_functor.cpp</code></a>,
<a href="../../../example/profile_global_functor.cpp" target="_top"><code class="literal">profile_global_functor.cpp</code></a>,
@@ -778,8 +843,8 @@
<colgroup><col></colgroup>
<thead><tr><th>
<p>
- MSVC 8.0 With "Local Types as Template Parameters" on
- Windows XP
+ MSVC 8.0 With "Local Types as Template Parameters" (Without
+ C++0x Lambdas) on Windows XP
</p>
</th></tr></thead>
<tbody>
@@ -802,7 +867,8 @@
<colgroup><col></colgroup>
<thead><tr><th>
<p>
- GCC 4.3.4 With No C++0x Features on Cygwin
+ GCC 4.3.4 With ISO C++ Only (Without C++0x Lambdas and Without
+ "Local Types as Template Parameters) on Cygwin
</p>
</th></tr></thead>
<tbody>
@@ -829,7 +895,8 @@
</h3></div></div></div>
<p>
The authors know of no other library or C++ language feature that supports
- local blocks (i.e., with the ability to bind by constant value or reference).
+ local blocks (i.e., with the ability to bind by constant value or constant
+ reference).
</p>
</div>
<div class="section">
@@ -837,8 +904,8 @@
<a name="boost_local.Alternatives.local_exits"></a><a class="link" href="Alternatives.html#boost_local.Alternatives.local_exits" title="Local Exits">Local Exits</a>
</h3></div></div></div>
<p>
- This library local exits provide a functionality very similar to the one
- provided by Boost.ScopeExit
+ This library local exits provide functionalities very similar to the ones
+ already provided by Boost.ScopeExit
but with the following additional features:
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
Modified: sandbox/local/libs/local/doc/html/boost_local/Examples.html
==============================================================================
--- sandbox/local/libs/local/doc/html/boost_local/Examples.html (original)
+++ sandbox/local/libs/local/doc/html/boost_local/Examples.html 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
@@ -292,11 +292,12 @@
<p>
Similarly to Boost.ScopeExit,
local exits essentially emulate the <a href="http://www.digitalmars.com/d/2.0/statement.html" target="_top">scope
- exits</a> provided by the <a href="http://d.digitalmars.com" target="_top">D Programming
- Language</a>. Local exits can also be used to emulate D's <a href="http://www.digitalmars.com/d/2.0/statement.html" target="_top">scope
- success</a> and <a href="http://www.digitalmars.com/d/2.0/statement.html" target="_top">scope
- failure</a> statements using a local variable that is set when an error
- occurs. For example, using error codes:
+ exit</a> statement provided by the <a href="http://d.digitalmars.com" target="_top">D
+ Programming Language</a>. Local exits can also be used to emulate D's
+ scope success
+ and scope failure
+ statements using a local variable that is set when an error occurs. For example,
+ using error codes:
</p>
<div class="informaltable"><table class="table">
<colgroup>
@@ -742,12 +743,12 @@
The GCC compiler supports local functions under the name of <a href="http://gcc.gnu.org/onlinedocs/gcc/Nested-Functions.html" target="_top">nested
functions</a>. Nested functions are exclusively a C extension of the
GCC compiler, they are not supported for C++ not even by the GCC compiler,
- and they are not part of any C++ standard (ISO C++, C99, C++0x, etc) nor
- they are supported by other compilers like MSVC.
+ and they are not part of any C or C++ standard (ISO C++, C99, C++0x, etc)
+ nor they are supported by other compilers like MSVC.
</p>
<p>
- The following examples rework the GCC nested function examples using this
- library local functions.
+ The following examples implement the examples from the GCC nested function
+ documentation using this library local functions.
</p>
<div class="informaltable"><table class="table">
<colgroup>
Modified: sandbox/local/libs/local/doc/html/boost_local/Implementation.html
==============================================================================
--- sandbox/local/libs/local/doc/html/boost_local/Implementation.html (original)
+++ sandbox/local/libs/local/doc/html/boost_local/Implementation.html 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
@@ -27,219 +27,50 @@
<a name="boost_local.Implementation"></a><a class="link" href="Implementation.html" title="Appendix: Implementation">Appendix: Implementation</a>
</h2></div></div></div>
<div class="toc"><dl>
-<dt><span class="section">Local Functions</span></dt>
<dt><span class="section"><a href="Implementation.html#boost_local.Implementation.local_classes_as_template_parameters">Local
Classes as Template Parameters</a></span></dt>
+<dt><span class="section">Parsing Macros</span></dt>
<dt><span class="section">Local Blocks</span></dt>
<dt><span class="section">Local Exits</span></dt>
-<dt><span class="section">Parsing Macros</span></dt>
+<dt><span class="section">Local Functions</span></dt>
</dl></div>
<p>
This section lists source code that should provide a general idea on how this
library is implemented.
</p>
<p>
- The code listed here should only be used as a reference in trying to understand
- the library implementation and source code. There is no guarantee that the
- library implementation will use exactly the code listed here. Refer to the
- code comments in the library source files for the reasons behind the specific
- instructions listed here.
+ The code listed here can be used by curious readers and library maintainers
+ as a reference in trying to understand this library source files at <code class="computeroutput"><span class="string">"boost/local/..."</span></code>. There is absolutely
+ no guarantee that the library implementation uses the exact the code listed
+ here.
</p>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
-<a name="boost_local.Implementation.local_functions"></a><a class="link" href="Implementation.html#boost_local.Implementation.local_functions" title="Local Functions">Local Functions</a>
-</h3></div></div></div>
-<p>
- The expansion of the local function macros of the <code class="computeroutput"><span class="identifier">factorial</span></code>
- example presented in the <a class="link" href="Advanced_Topics.html" title="Advanced Topics">Advanced
- Topics</a> section generates code equivalent to the following:
- </p>
-<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_l
ocal_auxXdeduce_result_wrap21</span><span class="special">;</span>
- <span class="keyword">typedef</span> <span class="identifier">boost_local_auxXdeduce_result_wrap21</span><span class="special">::</span><span class="identifier">type</span> <span class="identifier">boost_local_auxXdeduce_result_capture21</span><span class="special">;</span>
- <span class="keyword">struct</span> <span class="identifier">boost_local_auxXdeduce_result_params21</span> <span class="special">{</span>
- <span class="keyword">typedef</span> <span class="identifier">boost_local_auxXdeduce_result_capture21</span> <span class="identifier">function_ptr_type</span><span class="special">;</span>
- <span class="special">};</span>
- <span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">remove_pointer</span><span class="special"><</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 technique).</span>
- <span class="keyword">typedef</span> <span class="keyword">void</span> <span class="special">(*</span><span class="identifier">boost_se_tag_0_21</span><span class="special">)(</span><span class="keyword">int</span> <span class="special">&</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="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="special">;</span>
- <span class="identifier">boost_local_auxXargs</span><span class="special">.</span><span class="identifier">value</span> <span class="special">=</span> <span class="special">&</span><span class="identifier">boost_local_auxXparams21</span><span class="special">;</span>
-
- <span class="comment">// LOCAL FUNCTOR</span>
- <span class="keyword">class</span> <span class="identifier">boost_local_auxXfunctor21</span><span class="special">:</span>
- <span class="comment">// Base abstract class is used to later assign this local functor to `boost::local::function` so the local function can be passed as a template parameter (polymorphism ensures that the correct `operator()` as implemented by this class is called when this object is used as an `abstract_function` by `boost::local::function`).</span>
- <span class="keyword">public</span> <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">local</span><span class="special">::</span><span class="identifier">aux</span><span class="special">::</span><span class="identifier">abstract_function</span><span class="special"><</span><span class="identifier">boost_local_auxXresult_type21</span> <span class="special">(</span><span class="keyword">int</span> <span class="identifier">n</span><span class="special">,</span> <span class="keyword">bool</span> <span class="identifier">recursion</span><span class="special">),</span> <span class="number">1</span><span class="special">></span> <span class="special">{</span>
- <span class="keyword">typedef</span> <span class="identifier">boost_local_auxXresult_type21</span> <span class="special">(</span><span class="identifier">boost_local_auxXfunction_type</span><span class="special">)(</span><span class="keyword">int</span> <span class="identifier">n</span> <span class="special">,</span> <span class="keyword">bool</span> <span class="identifier">recursion</span><span class="special">);</span>
- <span class="keyword">public</span><span class="special">:</span>
- <span class="comment">// Take a generic pointer so it can be invoked by the `NAME` macro even if it expands on a different line number.</span>
- <span class="keyword">explicit</span> <span class="identifier">boost_local_auxXfunctor21</span><span class="special">(</span><span class="keyword">void</span><span class="special">*</span> <span class="identifier">binding_data</span><span class="special">):</span>
- <span class="identifier">boost_local_auxXbinds</span><span class="special">(</span><span class="keyword">static_cast</span><span class="special"><</span><span class="identifier">boost_se_params_t_21</span><span class="special">*>(</span><span class="identifier">binding_data</span><span class="special">))</span> <span class="special">{</span>
- <span class="identifier">boost_local_auxXinit_recursion</span><span class="special">();</span>
- <span class="special">}</span>
-
- <span class="comment">// Implement `operator()` for all parameters and any combination of default parameter.</span>
- <span class="identifier">boost_local_auxXresult_type21</span> <span class="keyword">operator</span><span class="special">()(</span>
- <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_traits</span><span class="special"><</span><span class="identifier">boost_local_auxXfunction_type</span><span class="special">>::</span><span class="identifier">arg1_type</span> <span class="identifier">arg1</span><span class="special">,</span>
- <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_traits</span><span class="special"><</span><span class="identifier">boost_local_auxXfunction_type</span><span class="special">>::</span><span class="identifier">arg2_type</span> <span class="identifier">arg2</span><span class="special">)</span> <span class="special">{</span>
- <span class="comment">// Actual parameter names are not known to the macro syntax separately from their types so generic names `arg...` must be used (and therefore the parameter types are extracted from the function type).</span>
- <span class="keyword">return</span> <span class="identifier">boost_local_auxXbody</span><span class="special">(</span><span class="identifier">boost_local_auxXbinds</span><span class="special">-></span><span class="identifier">boost_se_param_0_21</span><span class="special">.</span><span class="identifier">value</span><span class="special">,</span> <span class="identifier">boost_local_auxXbinds</span><span class="special">-></span><span class="identifier">se_this</span><span class="special">,</span> <span class="identifier">arg1</span><span class="special">,</span> <span class="identifier">arg2</span><span class="special">);</span>
- <span class="special">}</span>
- <span class="identifier">boost_local_auxXresult_type21</span> <span class="keyword">operator</span><span class="special">()(</span>
- <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_traits</span><span class="special"><</span><span class="identifier">boost_local_auxXfunction_type</span><span class="special">>::</span><span class="identifier">arg1_type</span> <span class="identifier">arg1</span><span class="special">)</span> <span class="special">{</span>
- <span class="keyword">return</span> <span class="identifier">boost_local_auxXbody</span><span class="special">(</span><span class="identifier">boost_local_auxXbinds</span><span class="special">-></span><span class="identifier">boost_se_param_0_21</span><span class="special">.</span><span class="identifier">value</span><span class="special">,</span> <span class="identifier">boost_local_auxXbinds</span><span class="special">-></span><span class="identifier">se_this</span><span class="special">,</span> <span class="identifier">arg1</span><span class="special">);</span>
- <span class="special">}</span>
-
- <span class="keyword">private</span><span class="special">:</span>
- <span class="comment">// Local function functor type (for a later declaration).</span>
- <span class="keyword">typedef</span> <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">local</span><span class="special">::</span><span class="identifier">function</span><span class="special"><</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="comment">// Define the deduced types for using `BOOST_LOCAL_TYPEOF` from within the local function body (the `&` is kept because the bound parameter name is not known to the macro syntax separately from the reference qualifier).</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="comment">// Hold bound parameters values and references.</span>
- <span class="identifier">boost_se_params_t_21</span><span class="special">*</span> <span class="identifier">boost_local_auxXbinds</span><span class="special">;</span>
- <span class="comment">// This same declaration is first made at global scope in one of the library header files. This declaration needs to be repeated here so it is also visible from within the local function body to allow for nesting local function into one another.</span>
- <span class="identifier">boost</span><span class="special">::</span><span class="identifier">scope_exit</span><span class="special">::</span><span class="identifier">aux</span><span class="special">::</span><span class="identifier">undeclared</span> <span class="identifier">boost_local_auxXargs</span><span class="special">;</span>
-
- <span class="comment">// The local function body. The body function cannot be static because is needs to access the member variable with the local function name to support recursion and the member variable named `...args` to support nesting (local classes cannot have static member variable). Unfortunately, this implies that `this` can be misused within the body instead of `this_` without necessarily generating a compile-time error.</span>
- <span class="identifier">boost_local_auxXresult_type21</span> <span class="identifier">boost_local_auxXbody</span><span class="special">(</span>
- <span class="comment">// Use special name `this_` instead of `this` here.</span>
- <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">add_const</span><span class="special"><</span><span class="identifier">boost_se_params_t_21</span><span class="special">::</span><span class="identifier">boost_se_param_t_0_21</span><span class="special">>::</span><span class="identifier">type</span> <span class="special">&</span> <span class="identifier">separator</span><span class="special">,</span> <span class="identifier">se_this_type21</span> <span class="identifier">this_</span><span class="special">,</span>
- <span class="comment">// Specify default parameter values here.</span>
- <span class="keyword">int</span> <span class="identifier">n</span><span class="special">,</span> <span class="keyword">bool</span> <span class="identifier">recursion</span> <span class="special">=</span> <span class="keyword">false</span><span class="special">)</span> <span class="keyword">const</span>
-
- <span class="comment">// *END* The expansion of `BOOST_LOCAL_FUNCTION_PARAMS` ends here.</span>
-
- <span class="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(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="keyword">private</span><span class="special">:</span>
- <span class="comment">// Initializes the local functor member variable (this cannot be done directly within the constructor because the local function name is not known when the constructor code is expanded by the `PARAMS` macro).</span>
- <span class="keyword">void</span> <span class="identifier">boost_local_auxXinit_recursion</span><span class="special">()</span> <span class="special">{</span>
- <span class="identifier">factorial</span> <span class="special">=</span> <span class="special">*</span><span class="keyword">this</span><span class="special">;</span>
- <span class="special">}</span>
- <span class="comment">// Declare the local class object -- which cannot be passed as template parameter (because it is a local class). It uses the variable with the generic `...args` name to pass the bound parameter values and references (so this variable name must not contain the line number because it is used by different macros expanding on different lines).</span>
- <span class="special">}</span> <span class="identifier">boost_local_auxXfunctorXfactorial</span><span class="special">(</span><span class="identifier">boost_local_auxXargs</span><span class="special">.</span><span class="identifier">value</span><span class="special">);</span>
- <span class="comment">// Declare the actual local function object with the local function name -- which can be passed as template parameter (because it is a `boost::local::function` functor and not a local class).</span>
- <span class="identifier">BOOST_TYPEOF</span><span class="special">(</span><span class="identifier">boost_local_auxXfunctorXfactorial</span><span class="special">.</span><span class="identifier">factorial</span><span class="special">)</span> <span class="keyword">const</span> <span class="identifier">factorial</span><span class="special">(</span><span class="identifier">boost_local_auxXfunctorXfactorial</span><span class="special">);</span>
-
- <span class="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="special">}</span>
-</pre>
-<p>
- </p>
-</div>
-<div class="section">
-<div class="titlepage"><div><div><h3 class="title">
<a name="boost_local.Implementation.local_classes_as_template_parameters"></a><a class="link" href="Implementation.html#boost_local.Implementation.local_classes_as_template_parameters" title="Local Classes as Template Parameters">Local
Classes as Template Parameters</a>
</h3></div></div></div>
<p>
- This library uses a local class to implement the local functor object. However,
- in ISO standard C++ a local classes, and therefore the local functor object,
- cannot be passed as template parameter (for example 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++03 and later standards. To work
- around this limitation, this library investigated the following two tricks
- (both tricks can be extended to support eventual function default parameters):
+ This library uses a local class to implement the local function object. However,
+ in ISO C++ a local class (and therefore the local function object that it
+ implements) cannot be passed as template parameter (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++0x, 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):
</p>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
The <span class="emphasis"><em>casting functor trick</em></span> uses a non-local functor
- class that calls a static member function of the local class via a function
+ that calls a static member function of the local class via a function
pointer. The static member function then calls the correct local function
- body after type casting the object.
+ body after type casting the object from a <code class="computeroutput"><span class="keyword">void</span><span class="special">*</span></code> pointer (local classes can be used for
+ type casting).
</li>
<li class="listitem">
- The <span class="emphasis"><em>virtual functor trick</em></span> uses a non-local virtual
- base class for the local functor class. The correct implementation of
- the <code class="computeroutput"><span class="keyword">operator</span><span class="special">()</span></code>
- is called via polymorphism.
+ The <span class="emphasis"><em>virtual functor trick</em></span> uses a non-local base
+ class for the local functor class. The correct overridden implementation
+ of the virtual <code class="computeroutput"><span class="keyword">operator</span><span class="special">()</span></code> is called via polymorphism.
</li>
</ol></div>
<p>
@@ -250,7 +81,7 @@
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">algorithm</span><span class="special">></span>
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">cassert</span><span class="special">></span>
-<span class="comment">// Casting Functor Trick</span>
+<span class="comment">// Casting functor trick.</span>
<span class="keyword">struct</span> <span class="identifier">casting_func</span> <span class="special">{</span>
<span class="keyword">explicit</span> <span class="identifier">casting_func</span><span class="special">(</span><span class="keyword">void</span><span class="special">*</span> <span class="identifier">obj</span><span class="special">,</span> <span class="keyword">void</span> <span class="special">(*</span><span class="identifier">call</span><span class="special">)(</span><span class="keyword">void</span><span class="special">*,</span> <span class="keyword">const</span> <span class="keyword">double</span><span class="special">&)):</span>
<span class="identifier">obj_</span><span class="special">(</span><span class="identifier">obj</span><span class="special">),</span> <span class="identifier">call_</span><span class="special">(</span><span class="identifier">call</span><span class="special">)</span> <span class="special">{}</span>
@@ -261,7 +92,7 @@
<span class="keyword">void</span> <span class="special">(*</span><span class="identifier">call_</span><span class="special">)(</span><span class="keyword">void</span><span class="special">*,</span> <span class="keyword">const</span> <span class="keyword">double</span><span class="special">&);</span>
<span class="special">};</span>
-<span class="comment">// Virtual Functor Trick</span>
+<span class="comment">// Virtual functor trick.</span>
<span class="keyword">struct</span> <span class="identifier">virtual_func</span> <span class="special">{</span>
<span class="keyword">struct</span> <span class="identifier">interface</span> <span class="special">{</span>
<span class="comment">// Unfortunately, virtual function call is not inlined.</span>
@@ -273,6 +104,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="comment">// Local class for local function.</span>
<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span> <span class="special">{</span>
<span class="keyword">double</span> <span class="identifier">sum</span> <span class="special">=</span> <span class="number">0.0</span><span class="special">;</span>
<span class="keyword">int</span> <span class="identifier">factor</span> <span class="special">=</span> <span class="number">10</span><span class="special">;</span>
@@ -312,16 +144,60 @@
<p>
</p>
<p>
- The casting functor trick had slightly better run-time performances than
- the virtual functor trick so the current implementation of this library uses
- the casting functor trick. However, both tricks do not 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) that can only be resolved at run-time. Therefore, on C++03
- compilers this library generates code that passes the local class functor
- as template parameter directly without using neither one of these two tricks
- in order to take full advantage of compiler optimizations that inline the
- local function calls.
+ 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 <a href="http://en.wikipedia.org/wiki/Virtual_method_table" target="_top">virtual function
+ table</a>). However, both tricks do not 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) that
+ has been observed to be resolved only at run-time by all analyzed compilers.
+ Therefore, on compilers that accept local types as template parameters (MSVC,
+ C++0x, etc, see [N2657]),
+ this library generates code that passes the local class type directly as
+ template parameter without using neither one of these two tricks in order
+ to take full advantage of compiler optimizations that inline the local function
+ calls.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_local.Implementation.parsing_macros"></a><a class="link" href="Implementation.html#boost_local.Implementation.parsing_macros" title="Parsing Macros">Parsing Macros</a>
+</h3></div></div></div>
+<p>
+ This library macros can parse the list of specified parameters and detect
+ if any of the bound parameter name matches the token <code class="computeroutput"><span class="keyword">this</span></code>
+ (to generate special code to bind the object in scope), or if the parameter
+ is bound by <code class="computeroutput"><span class="keyword">const</span></code> (to generate
+ special code to bind by constant), etc. The parameter tokens are inspected
+ using preprocessor metaprogramming and specifically using Boost.Preprocessor
+ and the <code class="computeroutput"><span class="identifier">BOOST_DETAIL_PP_KEYWORD_</span><span class="special">...</span></code> macros. For example:
+ </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">detail</span><span class="special">/</span><span class="identifier">preprocessor</span><span class="special">/</span><span class="identifier">keyword</span><span class="special">/</span><span class="keyword">this</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">detail</span><span class="special">/</span><span class="identifier">preprocessor</span><span class="special">/</span><span class="identifier">keyword</span><span class="special">/</span><span class="keyword">const</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">aux_</span><span class="special">/</span><span class="identifier">preprocessor</span><span class="special">/</span><span class="identifier">keyword</span><span class="special">/</span><span class="identifier">bind</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">cassert</span><span class="special">></span>
+
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span> <span class="special">{</span>
+ <span class="comment">// Detect `this`.</span>
+ <span class="identifier">assert</span><span class="special">(</span> <span class="identifier">BOOST_DETAIL_PP_KEYWORD_IS_THIS_BACK</span><span class="special">(</span>
+ <span class="identifier">BOOST_LOCAL_AUX_PP_KEYWORD_BIND_REMOVE_FRONT</span><span class="special">(</span>
+ <span class="identifier">BOOST_DETAIL_PP_KEYWORD_CONST_REMOVE_FRONT</span><span class="special">(</span>
+ <span class="keyword">const</span> <span class="identifier">bind</span> <span class="keyword">this</span>
+ <span class="special">)))</span> <span class="special">==</span> <span class="number">1</span> <span class="special">);</span>
+ <span class="identifier">assert</span><span class="special">(</span> <span class="identifier">BOOST_DETAIL_PP_KEYWORD_IS_THIS_BACK</span><span class="special">(</span>
+ <span class="identifier">BOOST_LOCAL_AUX_PP_KEYWORD_BIND_REMOVE_FRONT</span><span class="special">(</span>
+ <span class="identifier">BOOST_DETAIL_PP_KEYWORD_CONST_REMOVE_FRONT</span><span class="special">(</span>
+ <span class="keyword">const</span> <span class="identifier">bind</span><span class="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="keyword">return</span> <span class="number">0</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
</p>
</div>
<div class="section">
@@ -413,39 +289,194 @@
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
-<a name="boost_local.Implementation.parsing_macros"></a><a class="link" href="Implementation.html#boost_local.Implementation.parsing_macros" title="Parsing Macros">Parsing Macros</a>
+<a name="boost_local.Implementation.local_functions"></a><a class="link" href="Implementation.html#boost_local.Implementation.local_functions" title="Local Functions">Local Functions</a>
</h3></div></div></div>
<p>
- This library macros can parse the list of specified parameters and detect
- if any of the bound parameter name matches the token <code class="computeroutput"><span class="keyword">this</span></code>
- (to generate special code to bind the object in scope), or if the parameter
- is bound by <code class="computeroutput"><span class="keyword">const</span></code> (to generate
- special code to bind by constant), etc. The parameter tokens are inspected
- by preprocessor metaprogramming using both Boost.Preprocessor
- and the <code class="computeroutput"><span class="identifier">BOOST_DETAIL_PP_KEYWORD_</span><span class="special">...</span></code> macros that in brief work as follow:
+ The expansion of the local function macros of the <code class="computeroutput"><span class="identifier">factorial</span></code>
+ example presented in the <a class="link" href="Advanced_Topics.html" title="Advanced Topics">Advanced
+ Topics</a> section generates code equivalent to the following:
</p>
-<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">detail</span><span class="special">/</span><span class="identifier">preprocessor</span><span class="special">/</span><span class="identifier">keyword</span><span class="special">/</span><span class="keyword">this</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
-<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">detail</span><span class="special">/</span><span class="identifier">preprocessor</span><span class="special">/</span><span class="identifier">keyword</span><span class="special">/</span><span class="keyword">const</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
-<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">aux_</span><span class="special">/</span><span class="identifier">preprocessor</span><span class="special">/</span><span class="identifier">keyword</span><span class="special">/</span><span class="identifier">bind</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<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="comment">// Detect `this`.</span>
-<span class="identifier">BOOST_DETAIL_PP_KEYWORD_IS_THIS_BACK</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">bind</span> <span class="keyword">this</span><span class="special">)</span> <span class="comment">// Expand to 1.</span>
-<span class="identifier">BOOST_DETAIL_PP_KEYWORD_IS_THIS_BACK</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">bind</span><span class="special">&</span> <span class="identifier">x</span><span class="special">)</span> <span class="comment">// Expand to 0.</span>
-
-<span class="comment">// Detect constant.</span>
-<span class="identifier">BOOST_DETAIL_PP_KEYWORD_IS_CONST_FRONT</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">bind</span> <span class="keyword">this</span><span class="special">)</span> <span class="comment">// Expand to 1.</span>
-<span class="identifier">BOOST_DETAIL_PP_KEYWORD_IS_CONST_FRONT</span><span class="special">(</span><span class="identifier">bind</span> <span class="keyword">this</span><span class="special">)</span> <span class="comment">// Expand to 0.</span>
-
-<span class="comment">// Detect binding (constant and not).</span>
-<span class="identifier">BOOST_LOCAL_AUX_PP_KEYWORD_IS_BIND_FRONT</span><span class="special">(</span> <span class="comment">// Expand to 1.</span>
- <span class="identifier">BOOST_DETAIL_PP_KEYWORD_CONST_REMOVE_FRONT</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">bind</span> <span class="keyword">this</span><span class="special">))</span>
-<span class="identifier">BOOST_LOCAL_AUX_PP_KEYWORD_IS_BIND_FRONT</span><span class="special">(</span> <span class="comment">// Also expand to 1.</span>
- <span class="identifier">BOOST_DETAIL_PP_KEYWORD_CONST_REMOVE_FRONT</span><span class="special">(</span><span class="identifier">bind</span> <span class="keyword">this</span><span class="special">))</span>
-<span class="identifier">BOOST_LOCAL_AUX_PP_KEYWORD_IS_BIND_FRONT</span><span class="special">(</span> <span class="comment">// Expand to 0.</span>
- <span class="identifier">BOOST_DETAIL_PP_KEYWORD_CONST_REMOVE_FRONT</span><span class="special">(</span><span class="keyword">const</span> <span class="keyword">int</span> <span class="identifier">x</span><span class="special">))</span>
-<span class="identifier">BOOST_LOCAL_AUX_PP_KEYWORD_IS_BIND_FRONT</span><span class="special">(</span> <span class="comment">// Also expand to 0.</span>
- <span class="identifier">BOOST_DETAIL_PP_KEYWORD_CONST_REMOVE_FRONT</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">x</span><span class="special">))</span>
+<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="special">}</span>
</pre>
+<p>
+ </p>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
Modified: sandbox/local/libs/local/doc/html/boost_local/Release_Notes.html
==============================================================================
--- sandbox/local/libs/local/doc/html/boost_local/Release_Notes.html (original)
+++ sandbox/local/libs/local/doc/html/boost_local/Release_Notes.html 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
@@ -27,6 +27,8 @@
<a name="boost_local.Release_Notes"></a><a class="link" href="Release_Notes.html" title="Release Notes">Release Notes</a>
</h2></div></div></div>
<div class="toc"><dl>
+<dt><span class="section"><a href="Release_Notes.html#boost_local.Release_Notes.version_0_2_0__2011_05_14_">Version
+ 0.2.0 (2011-05-14)</a></span></dt>
<dt><span class="section"><a href="Release_Notes.html#boost_local.Release_Notes.version_0_1_1__2011_01_10_">Version
0.1.1 (2011-01-10)</a></span></dt>
<dt><span class="section"><a href="Release_Notes.html#boost_local.Release_Notes.version_0_1_0__2011_01_03_">Version
@@ -37,6 +39,52 @@
</dl></div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_local.Release_Notes.version_0_2_0__2011_05_14_"></a><a class="link" href="Release_Notes.html#boost_local.Release_Notes.version_0_2_0__2011_05_14_" title="Version 0.2.0 (2011-05-14)">Version
+ 0.2.0 (2011-05-14)</a>
+</h3></div></div></div>
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem">
+ Replaced parenthesized syntax with variadic and sequencing macro syntaxes.
+ </li>
+<li class="listitem">
+ Profiled library performances against other approaches.
+ </li>
+<li class="listitem">
+ Replaced virtual functor trick with casting functor trick (for smaller
+ run-time).
+ </li>
+<li class="listitem">
+ Optimized library run-time (rearranging code and not using casting functor
+ trick on compilers that accept local classes as template parameters).
+ </li>
+<li class="listitem">
+ Added <code class="computeroutput"><a class="link" href="../BOOST_LOCAL_FUNCTION_NAME.html" title="Macro BOOST_LOCAL_FUNCTION_NAME">BOOST_LOCAL_FUNCTION_NAME</a><span class="special">(</span><span class="keyword">inline</span> <span class="special">...)</span></code> and <code class="computeroutput"><a class="link" href="../BOOST_LOCAL_FUNCTION_NAME.html" title="Macro BOOST_LOCAL_FUNCTION_NAME">BOOST_LOCAL_FUNCTION_NAME</a><span class="special">(</span><span class="identifier">recursive</span>
+ <span class="special">...)</span></code>.
+ </li>
+<li class="listitem">
+ Added <code class="computeroutput"><a class="link" href="../BOOST_LOCAL_TYPEOF.html" title="Macro BOOST_LOCAL_TYPEOF">BOOST_LOCAL_TYPEOF</a></code>.
+ </li>
+<li class="listitem">
+ Added <code class="computeroutput"><span class="identifier">bind</span><span class="special">(</span><span class="identifier">type</span><span class="special">)</span></code>
+ to specify bind type explicitly (skipping Boost.Typeof
+ type deduction).
+ </li>
+<li class="listitem">
+ Removed <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">local</span><span class="special">::</span><span class="identifier">function</span></code> (use <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span></code>
+ instead).
+ </li>
+<li class="listitem">
+ Added <code class="computeroutput"><a class="link" href="../boost/local/function/overload.html" title="Class template overload">boost::local::function::overload</a></code>
+ to overload local functions (and functors in general).
+ </li>
+<li class="listitem">
+ Implemented support for nesting local functions, blocks, and exits into
+ one another.
+ </li>
+</ol></div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
<a name="boost_local.Release_Notes.version_0_1_1__2011_01_10_"></a><a class="link" href="Release_Notes.html#boost_local.Release_Notes.version_0_1_1__2011_01_10_" title="Version 0.1.1 (2011-01-10)">Version
0.1.1 (2011-01-10)</a>
</h3></div></div></div>
@@ -70,22 +118,9 @@
Completed development, examples, and documentation.
</li></ol></div>
</div>
-<div class="section">
-<div class="titlepage"><div><div><h3 class="title">
+<div class="section"><div class="titlepage"><div><div><h3 class="title">
<a name="boost_local.Release_Notes.todo"></a><a class="link" href="Release_Notes.html#boost_local.Release_Notes.todo" title="TODO">TODO</a>
-</h3></div></div></div>
-<div class="orderedlist"><ol class="orderedlist" type="1">
-<li class="listitem">
- Rework factorial_impl and Implementation section.
- </li>
-<li class="listitem">
- Finalize Acknowledge section.
- </li>
-<li class="listitem">
- Apply copyright to all files.
- </li>
-</ol></div>
-</div>
+</h3></div></div></div></div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
Modified: sandbox/local/libs/local/doc/html/boost_local/Tutorial.html
==============================================================================
--- sandbox/local/libs/local/doc/html/boost_local/Tutorial.html (original)
+++ sandbox/local/libs/local/doc/html/boost_local/Tutorial.html 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
@@ -558,8 +558,9 @@
<pre class="programlisting"><span class="keyword">const</span> <span class="identifier">bind</span><span class="special">&</span> <span class="emphasis"><em>variable-name</em></span> <span class="comment">// Bind by constant value.</span>
</pre>
<p>
- (Note that when <code class="computeroutput"><span class="keyword">const</span></code> is used,
- it must always precede <code class="computeroutput"><span class="identifier">bind</span></code>.)
+ Note that when <code class="computeroutput"><span class="keyword">const</span></code> is used,
+ it must always precede <code class="computeroutput"><span class="identifier">bind</span></code>.
+ <sup>[<a name="id870746" href="#ftn.id870746" class="footnote">8</a>]</sup>
</p>
<p>
If a variable is bound by value, then a copy of the variable value is taken
@@ -572,19 +573,36 @@
be taken for variables bound by reference).
</p>
<p>
- The type of bound variables is automatically deduced and it is the exact
- same type used to declare such variables in the enclosing scope. Therefore,
- if a bound variable is declared constant, using the <code class="computeroutput"><span class="keyword">const</span></code>
- qualifier in the enclosing scope, then it will be always bound by constant
- value or constant reference even if <code class="computeroutput"><span class="keyword">const</span></code>
- is not repeated by the local function binding. On the other hand, if a bound
- variable was not declared constant in the enclosing scope then it will not
- be bound as constant unless constant binding is forced using <code class="computeroutput"><span class="keyword">const</span> <span class="identifier">bind</span> <span class="special">...</span></code> (note that binding by constant reference
- is not supported by <a href="http://en.wikipedia.org/wiki/C%2B%2B0x#Lambda_functions_and_expressions" target="_top">C++0x
- lambda</a> functions but it is supported by this library). <sup>[<a name="id870824" href="#ftn.id870824" class="footnote">8</a>]</sup> As with passing parameters to usual C++ functions, programmers
- might want to bind variables of complex types by (constant) reference instead
- than by value to avoid expensive copy operations when these variables are
- bound to a local function.
+ 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.
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem">
+ If a bound variable was declared constant in the enclosing scope, it
+ will be always bound by constant value or constant reference even if
+ <code class="computeroutput"><span class="identifier">bind</span> <span class="special">...</span></code>
+ is used instead of <code class="computeroutput"><span class="keyword">const</span> <span class="identifier">bind</span> <span class="special">...</span></code>
+ . However, if a bound variable was not declared constant in the enclosing
+ scope then it will not be bound as constant unless constant binding is
+ forced using <code class="computeroutput"><span class="keyword">const</span> <span class="identifier">bind</span>
+ <span class="special">...</span></code>. (Note that binding by constant
+ reference is not supported by <a href="http://en.wikipedia.org/wiki/C%2B%2B0x#Lambda_functions_and_expressions" target="_top">C++0x
+ lambda</a> functions but it is supported by this library.) <sup>[<a name="id870943" href="#ftn.id870943" class="footnote">9</a>]</sup>
+ </li>
+<li class="listitem">
+ If a bound variable was declared as a reference in the enclosing scope,
+ it will still be bound by value unless it is explicitly bound by reference
+ using <code class="computeroutput"><span class="identifier">bind</span><span class="special">&</span>
+ <span class="special">...</span></code> or <code class="computeroutput"><span class="keyword">const</span>
+ <span class="identifier">bind</span><span class="special">&</span>
+ <span class="special">...</span></code>. <sup>[<a name="id871067" href="#ftn.id871067" class="footnote">10</a>]</sup>
+ </li>
+</ul></div>
+<p>
+ As with passing parameters to usual C++ functions, programmers might want
+ to bind variables of complex types by (constant) reference instead than by
+ value to avoid expensive copy operations when these variables are bound to
+ a local function.
</p>
<p>
For example, let's program a local function <code class="computeroutput"><span class="identifier">add</span></code>
@@ -671,7 +689,7 @@
when it is in scope (e.g., from an enclosing member function). This is done
by using <code class="computeroutput"><span class="keyword">this</span></code> as the name of
the variable to bind in the local function declaration and by using the special
- symbol <code class="computeroutput"><span class="identifier">this_</span></code> <sup>[<a name="id871887" href="#ftn.id871887" class="footnote">9</a>]</sup> (instead of <code class="computeroutput"><span class="keyword">this</span></code>)
+ symbol <code class="computeroutput"><span class="identifier">this_</span></code> <sup>[<a name="id872236" href="#ftn.id872236" class="footnote">11</a>]</sup> (instead of <code class="computeroutput"><span class="keyword">this</span></code>)
to access the object within the local function body.
</p>
<p>
@@ -714,12 +732,12 @@
<p>
When the object <code class="computeroutput"><span class="keyword">this</span></code> is bound
to a local function, the local function body must use the special symbol
- <code class="computeroutput"><span class="identifier">this_</span></code> (instead of <code class="computeroutput"><span class="keyword">this</span></code>) to access the bound object. <sup>[<a name="id872197" href="#ftn.id872197" class="footnote">10</a>]</sup>
+ <code class="computeroutput"><span class="identifier">this_</span></code> (instead of <code class="computeroutput"><span class="keyword">this</span></code>) to access the bound object. <sup>[<a name="id872546" href="#ftn.id872546" class="footnote">12</a>]</sup>
</p>
<p>
Unfortunately, mistakenly using <code class="computeroutput"><span class="keyword">this</span></code>
within the local function body instead of <code class="computeroutput"><span class="identifier">this_</span></code>
- will not necessarily generate a compile-time error. <sup>[<a name="id872290" href="#ftn.id872290" class="footnote">11</a>]</sup> Programmers are responsible to make sure that <code class="computeroutput"><span class="keyword">this</span></code> is never used within a local function
+ will not necessarily generate a compile-time error. <sup>[<a name="id872647" href="#ftn.id872647" class="footnote">13</a>]</sup> Programmers are responsible to make sure that <code class="computeroutput"><span class="keyword">this</span></code> is never used within a local function
body which should only use the special symbol <code class="computeroutput"><span class="identifier">this_</span></code>.
</p>
</td></tr>
@@ -906,7 +924,7 @@
<tr><td align="left" valign="top"><p>
A <code class="computeroutput"><span class="keyword">return</span><span class="special">;</span></code>
instruction from within a local block jumps to the end of the local block
- body and it does not return the enclosing function. <sup>[<a name="id875688" href="#ftn.id875688" class="footnote">12</a>]</sup>
+ body and it does not return the enclosing function. <sup>[<a name="id876060" href="#ftn.id876060" class="footnote">14</a>]</sup>
</p></td></tr>
</table></div>
<p>
@@ -1018,7 +1036,7 @@
</tr>
<tr><td align="left" valign="top"><p>
The execution of the local exit body code is guaranteed only if the program
- does not terminate because of an uncaught exception. <sup>[<a name="id876925" href="#ftn.id876925" class="footnote">13</a>]</sup>
+ does not terminate because of an uncaught exception. <sup>[<a name="id877299" href="#ftn.id877299" class="footnote">15</a>]</sup>
</p></td></tr>
</table></div>
<p>
@@ -1123,7 +1141,7 @@
Local exits are very similar to the <span class="emphasis"><em>scope exits</em></span> provided
by Boost.ScopeExit
with the addition that they also support constant binding and binding of
- the object <code class="computeroutput"><span class="keyword">this</span></code>. <sup>[<a name="id878344" href="#ftn.id878344" class="footnote">14</a>]</sup> Local exits can be used to emulate the <a href="http://d.digitalmars.com" target="_top">D
+ the object <code class="computeroutput"><span class="keyword">this</span></code>. <sup>[<a name="id878589" href="#ftn.id878589" class="footnote">16</a>]</sup> Local exits can be used to emulate the <a href="http://d.digitalmars.com" target="_top">D
Programming Language</a> <span class="emphasis"><em>scope guards</em></span> (see the
<a class="link" href="Examples.html#boost_local.Examples.Emulating_Ds_Scope_Guards" title="Emulating D's Scope Guards">Emulating
D's Scope Guards</a> example).
@@ -1137,7 +1155,7 @@
When local functions, local blocks, and local exits are programmed within
templates, they need to be declared using the following special macros ending
with the <code class="computeroutput"><span class="identifier">TPL</span></code> postfix (see
- the Reference section): <sup>[<a name="id878639" href="#ftn.id878639" class="footnote">15</a>]</sup>
+ the Reference section): <sup>[<a name="id878889" href="#ftn.id878889" class="footnote">17</a>]</sup>
</p>
<pre class="programlisting"><code class="computeroutput"><a class="link" href="../BOOST_LOCAL_FUNCTION_PARAMS_TPL.html" title="Macro BOOST_LOCAL_FUNCTION_PARAMS_TPL">BOOST_LOCAL_FUNCTION_PARAMS_TPL</a></code><span class="special">(</span><span class="emphasis"><em>parameters</em></span><span class="special">)</span>
<code class="computeroutput"><a class="link" href="../BOOST_LOCAL_BLOCK_TPL.html" title="Macro BOOST_LOCAL_BLOCK_TPL">BOOST_LOCAL_BLOCK_TPL</a></code><span class="special">(</span><span class="emphasis"><em>bindings</em></span><span class="special">)</span>
@@ -1320,28 +1338,52 @@
level within the syntax defined by the macros of this library -- thus it
is referred to as a "keyword" only within quotes.
</p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id870824" href="#id870824" class="para">8</a>] </sup>
- An historical note: Constant binding of variables in scope was the main
- use case that originally motivated the authors in developing this library.
- The authors needed to locally create a chuck of code to assert some correctness
- conditions while these assertions were not supposed to modify any of the
- variables they were using (see the Contract++
- library). This was achieved by binding by constant reference the variables
- needed by the assertions and then by programming the local function body
- to check the assertions (or more conveniently by using <code class="computeroutput"><a class="link" href="../BOOST_LOCAL_BLOCK.html" title="Macro BOOST_LOCAL_BLOCK">BOOST_LOCAL_BLOCK</a></code>). This way
- if any of the assertions mistakenly changes a bound variable (for example
- confusing the operator <code class="computeroutput"><span class="special">==</span></code>
- with <code class="computeroutput"><span class="special">=</span></code>), the compiler correctly
- generates an error because the bound variable is of <code class="computeroutput"><span class="keyword">const</span></code>
- type within the local function body.
+<div class="footnote"><p><sup>[<a id="ftn.id870746" href="#id870746" class="para">8</a>] </sup>
+ <span class="bold"><strong>Rationale.</strong></span> The library macros could have
+ been implemented to accept both syntaxes <code class="computeroutput"><span class="keyword">const</span>
+ <span class="identifier">bind</span> <span class="special">...</span></code>
+ and <code class="computeroutput"><span class="identifier">bind</span> <span class="keyword">const</span>
+ <span class="special">...</span></code> equivalently. However, handling
+ both syntaxes would have complicated the macro implementation without adding
+ any feature so only one syntax (<code class="computeroutput"><span class="keyword">const</span>
+ <span class="identifier">bind</span> <span class="special">...</span></code>)
+ is supported.
</p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id871887" href="#id871887" class="para">9</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id870943" href="#id870943" class="para">9</a>] </sup>
+ An historical note: Constant binding of variables in scope was the
+ main use case that originally motivated the authors in developing this
+ library. The authors needed to locally create a chuck of code to assert
+ some correctness conditions while these assertions were not supposed
+ to modify any of the variables they were using (see the Contract++
+ library). This was achieved by binding by constant reference the variables
+ needed by the assertions and then by programming the local function
+ body to check the assertions (or more conveniently by using <code class="computeroutput"><a class="link" href="../BOOST_LOCAL_BLOCK.html" title="Macro BOOST_LOCAL_BLOCK">BOOST_LOCAL_BLOCK</a></code>). This
+ way if any of the assertions mistakenly changes a bound variable (for
+ example confusing the operator <code class="computeroutput"><span class="special">==</span></code>
+ with <code class="computeroutput"><span class="special">=</span></code>), the compiler
+ correctly generates an error because the bound variable is of <code class="computeroutput"><span class="keyword">const</span></code> type within the local function
+ body.
+ </p></div>
+<div class="footnote"><p><sup>[<a id="ftn.id871067" href="#id871067" class="para">10</a>] </sup>
+ <span class="bold"><strong>Rationale.</strong></span> Variables originally declared
+ 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).
+ 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
+ scope but also in the local scope) thus they are always bound by constant
+ even if <code class="computeroutput"><span class="identifier">bind</span><span class="special">[&]</span></code>
+ is used instead of <code class="computeroutput"><span class="keyword">const</span> <span class="identifier">bind</span><span class="special">[&]</span></code>.
+ </p></div>
+<div class="footnote"><p><sup>[<a id="ftn.id872236" href="#id872236" class="para">11</a>] </sup>
<span class="bold"><strong>Rationale.</strong></span> The special name <code class="computeroutput"><span class="identifier">this_</span></code> was chosen following <a href="http://boost.2283326.n4.nabble.com/local-this-or-this-td3423912.html" target="_top">Boost
practises</a> which postfix with an underscore identifiers that are
named after keywords (the C++ keyword <code class="computeroutput"><span class="keyword">this</span></code>
in this case).
</p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id872197" href="#id872197" class="para">10</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id872546" href="#id872546" class="para">12</a>] </sup>
<span class="bold"><strong>Rationale.</strong></span> This limitation comes from
the fact that <code class="computeroutput"><span class="keyword">this</span></code> is a
reserved C++ keyword so it cannot be used as the name of the internal
@@ -1355,7 +1397,7 @@
behaviour of <code class="computeroutput"><span class="keyword">static_cast</span></code></a>
(which might not work on all platforms at the cost of portability).
</p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id872290" href="#id872290" class="para">11</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id872647" href="#id872647" class="para">13</a>] </sup>
<span class="bold"><strong>Rationale.</strong></span> The local function body cannot
be a static member function of the local functor object in order to support
recursion (because the local function name is specified by the <code class="computeroutput"><a class="link" href="../BOOST_LOCAL_FUNCTION_NAME.html" title="Macro BOOST_LOCAL_FUNCTION_NAME">BOOST_LOCAL_FUNCTION_NAME</a></code>
@@ -1368,7 +1410,7 @@
Therefore, from within the local function body the variable <code class="computeroutput"><span class="keyword">this</span></code> is visible but it refers to the local
functor and not to the bound object.
</p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id875688" href="#id875688" class="para">12</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id876060" href="#id876060" class="para">14</a>] </sup>
<span class="bold"><strong>Rationale.</strong></span> Programmers might expect
<code class="computeroutput"><span class="keyword">return</span><span class="special">;</span></code>
to exit the enclosing function instead of the local block (or local exit),
@@ -1386,7 +1428,7 @@
<code class="computeroutput"><span class="identifier">BOOST_LOCAL_RETURN</span><span class="special">;</span></code>)
to exit local blocks (and local exits).
</p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id876925" href="#id876925" class="para">13</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id877299" href="#id877299" class="para">15</a>] </sup>
<span class="bold"><strong>Rationale.</strong></span> This library (as well as
<a href="http://www.boost.org/doc/libs/release/libs/scope_exit/doc/html/index.html" target="_top">Boost.ScopeExit</a>)
uses the destructor of a local variable to automatically execute the
@@ -1397,7 +1439,7 @@
scope exit code even if the main program terminates because of an uncaught
exception.)
</p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id878344" href="#id878344" class="para">14</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id878589" href="#id878589" class="para">16</a>] </sup>
<span class="bold"><strong>Rationale.</strong></span> This library could be merged
together with Boost.ScopeExit
into a new library named Boost.Scope (from the meaning of the word "scope"
@@ -1426,7 +1468,7 @@
name of "<a href="http://gcc.gnu.org/onlinedocs/gcc/Nested-Functions.html" target="_top">nested
functions</a>" (GCC compiler extension).
</p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id878639" href="#id878639" class="para">15</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id878889" href="#id878889" class="para">17</a>] </sup>
<span class="bold"><strong>Rationale.</strong></span> Within templates, this library
needs to use <code class="computeroutput"><span class="keyword">typename</span></code> to explicitly
indicate that some expressions evaluate to a type. Because C++ does not
Modified: sandbox/local/libs/local/doc/html/index.html
==============================================================================
--- sandbox/local/libs/local/doc/html/index.html (original)
+++ sandbox/local/libs/local/doc/html/index.html 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
@@ -426,7 +426,7 @@
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
-<td align="left"><p><small>Last revised: May 12, 2011 at 17:28:50 GMT</small></p></td>
+<td align="left"><p><small>Last revised: May 14, 2011 at 19:25:21 GMT</small></p></td>
<td align="right"><div class="copyright-footer"></div></td>
</tr></table>
<hr>
Modified: sandbox/local/libs/local/doc/html/reference.html
==============================================================================
--- sandbox/local/libs/local/doc/html/reference.html (original)
+++ sandbox/local/libs/local/doc/html/reference.html 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
@@ -37,7 +37,7 @@
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="header.boost.local.block_hpp"></a>Header <boost/local/block.hpp></h3></div></div></div>
-<p>Local blocks allow to program code that is executed accessing some of the variables in scope as constants. </p>
+<p>Local blocks allow to program code that is executed "in place" while accessing some of the variables in scope as constants. </p>
<pre class="synopsis">
<a class="link" href="BOOST_LOCAL_BLOCK.html" title="Macro BOOST_LOCAL_BLOCK">BOOST_LOCAL_BLOCK</a>(bindings)
@@ -68,7 +68,7 @@
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="header.boost.local.function_hpp"></a>Header <boost/local/function.hpp></h3></div></div></div>
-<p>Local functions allows to program functions locally within the scope where they are needed (within enclosing functions, etc). </p>
+<p>Local functions allows to program functions locally within the scope where they are needed. </p>
<pre class="synopsis">
<a class="link" href="BOOST_LOCAL_FUNCTION_PARAMS.html" title="Macro BOOST_LOCAL_FUNCTION_PARAMS">BOOST_LOCAL_FUNCTION_PARAMS</a>(parameters)
@@ -78,6 +78,7 @@
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="header.boost.local.function.overload_hpp"></a>Header <boost/local/function/overload.hpp></h3></div></div></div>
+<p>Defines a functor that can be used to overload the call operator of a set of specified functors. </p>
<pre class="synopsis"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>
<span class="keyword">namespace</span> <span class="identifier">local</span> <span class="special">{</span>
<span class="keyword">namespace</span> <span class="identifier">function</span> <span class="special">{</span>
@@ -98,7 +99,7 @@
<div class="titlepage"><div><div><h3 class="title">
<a name="header.boost.utility.identity_hpp"></a>Header <boost/utility/identity.hpp></h3></div></div></div>
<p>Identity macros are used to pass expressions with commas (not already wrapped within round parenthesis) as macros parameters. </p>
-<p><span class="bold"><strong>Note:</strong></span> The only way (at least as far as the authors know) to pass an arbitrary number of commas within macro parameters without explicitly indicating the number of commas is to wrap the parameter within round parenthesis that are not replaced by macro expansion and then to remove the extra parenthesis at compile-time (for type expressions) or at run-time (for value expressions). This is what these macros do. </p>
+<p><span class="bold"><strong>Note:</strong></span> The only way (at least as far as the authors know) to pass an arbitrary number of commas within macro parameters without explicitly indicating the number of commas (and without using variadic macros which are not part of the ISO C++ standard) is to wrap the expression within round parenthesis that are not replaced by macro expansion and then to remove the extra parenthesis at compile-time (for type expressions) or at run-time (for value expressions). This is what these macros do. </p>
<pre class="synopsis">
<a class="link" href="BOOST_IDENTITY_TYPE.html" title="Macro BOOST_IDENTITY_TYPE">BOOST_IDENTITY_TYPE</a>(parenthesized_type)
Modified: sandbox/local/libs/local/doc/qbk/acknowledgements.qbk
==============================================================================
--- sandbox/local/libs/local/doc/qbk/acknowledgements.qbk (original)
+++ sandbox/local/libs/local/doc/qbk/acknowledgements.qbk 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
@@ -8,16 +8,24 @@
This section attempts to recognize the contributions of /all/ the different people that participated directly or indirectly to the design and development of this library.
-Thanks to Steven Watanabe and Vicente Botet for suggesting to use __Boost_ScopeExit__ binding to emulate local functions (in the context of constant-correct checking of block invariants).
+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].
+Many thanks to Alexander Nasonov for clarifying how __Boost_ScopeExit__ binding could be used to implement local functions and for some [@http://thread.gmane.org/gmane.comp.lib.boost.devel/168612 early work] in this direction.
-Thanks to Alexander Nasonov for clarifying how __Boost_ScopeExit__ binding could be used to implement local functions.
+Many thanks to Gregory Crosswhite for using __Boost_Local__ in [@https://github.com/gcross/CodeSearch one of his projects].
+
+Thanks to David Abrahams, Vicente Botet, et al. for suggesting to provide the [@http://lists.boost.org/Archives/boost/2011/02/176712.php variadic macro syntax] on compilers that support variadic macros.
Thanks to Pierre Morcello for suggesting to use `return;` to exit local blocks (in the context of a discussion about a possible [@http://lists.boost.org/Archives/boost/2009/09/156012.php Boost.Breakable] library).
Thanks to Pierre also for sharing some code that already experimented with implementing local functions using __Boost_ScopeExit__ binding (even if this library was not developed using such a code).
-Thanks to John Bytheway for refining the authors' technique that allows this library to pass local functions as template parameters.
+Thanks to John Bytheway for checking the authors' virtual functor technique that originally allowed this library to pass local functions as template parameters.
+
+Thanks to Jeffrey Lee Hellrung for suggesting the use of the "keyword" `bind` to bind variables in scope and for suggesting to use `bind(type)` to optionally specify the bound variable type (instead of using __Boost_Typeof__).
+Thanks to Vicente Botet for suggesting to provide `__BOOST_LOCAL_TYPEOF__` to access the bound variable type.
+
+Thanks to Mathias Gaunard for suggesting to implement `__boost__local__function__overload__` and for providing an early version of it.
-Thanks to Jeffrey Lee Hellrung for suggesting the use of the "keyword" `bind` to bind variables in scope.
+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.
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.
Modified: sandbox/local/libs/local/doc/qbk/advanced_topics.qbk
==============================================================================
--- sandbox/local/libs/local/doc/qbk/advanced_topics.qbk (original)
+++ sandbox/local/libs/local/doc/qbk/advanced_topics.qbk 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
@@ -261,7 +261,7 @@
bind(``/variable-type/``) ``/variable-name/`` // Bind by value with explicit type.
bind(``/variable-type/``)& ``/variable-name/`` // Bind by reference with explicit type.
const bind(``/variable-type/``) ``/variable-name/`` // Bind by constant value with explicit type.
- const bind(``/variable-type/``)& ``/variable-name/`` // Bind by constant value with explicit type.
+ const bind(``/variable-type/``)& ``/variable-name/`` // Bind by constant reference with explicit type.
bind(``/class-type/``*) this // Bind object `this` with type.
const bind(``/class-type/``*) this // Bind object `this` by constant with type.
@@ -483,8 +483,8 @@
[ This is not supported because local functions are not member functions.
[footnote
*Rationale.*
-In theory, it would be possible for a local functor class to inherit from another local functor class.
-However, this "inheritance" feature is not implemented because it seems of [@http://lists.boost.org/Archives/boost/2010/09/170895.php no use] given that local functions can be bound to one another thus they can simply call each other directly without recurring to dynamic binding or base function call.
+It would be possible to make a local function class inherit from another local function class.
+However, this "inheritance" feature is not implemented because it seemed of [@http://lists.boost.org/Archives/boost/2010/09/170895.php no use] given that local functions can be bound to one another thus they can simply call each other directly without recurring to dynamic binding or base function call.
]
]
]
Modified: sandbox/local/libs/local/doc/qbk/alternatives.qbk
==============================================================================
--- sandbox/local/libs/local/doc/qbk/alternatives.qbk (original)
+++ sandbox/local/libs/local/doc/qbk/alternatives.qbk 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
@@ -18,7 +18,7 @@
[ Boost.Local (this library) ]
[ Local Functor ]
[ Global Functor (not local) ]
- [ __CPP0x_lambda__ (not ISO C++) ]
+ [ __CPP0x_Lambda__ (not ISO C++) ]
[ __Boost_Lambda__ ]
[ __Boost_Phoenix__ ]
]
@@ -33,17 +33,17 @@
[ Yes. ]
]
[
- [ ['Can be defined using regular C++ statements] ]
+ [ ['Can be defined using C++ statement syntax] ]
[ Yes.
-Plus eventual compiler errors follow the usual format of C++ statement errors.]
+Plus eventual compiler errors 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 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 follow the usual format of C++ statement errors. ]
[ Yes.
-Plus eventual compiler errors follow the usual format of C++ statement errors.]
- [ No. ]
- [ No. ]
+Plus eventual compiler errors follow the usual format of C++ statement errors. ]
+ [ No (it uses C++ __expression_template__ syntax). ]
+ [ No (it uses C++ __expression_template__ syntax). ]
]
[
[ ['Can be defined within expressions] ]
@@ -67,17 +67,16 @@
[
[ ['Access variables in scope] ]
[ Yes.
-The variable names are repeated in the function declaration so they can be bound by value, constant value, reference, and constant reference (the object `this` can also be bound). ]
+The variable names are repeated in the function declaration so they can be bound by value, by constant value, by reference, and by constant reference (the object `this` can also be bound). ]
[ No.
-Programmers must manually manage functor member variables and their explicit types to access variables in scope. ]
+Programmers must manually manage functor member variables and explicitly specify their types to access variables in scope. ]
[ No.
-Programmers must manually manage functor member variables and their explicit types to access variables in scope. ]
+Programmers must manually manage functor member variables and explicitly specify their types to access variables in scope. ]
[ Yes.
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. ]
+However, variables cannot be bound by constant references and non-constant value (see below). ]
[ Yes (variables in scope are accessible as usual within expressions). ]
- [ Yes (variables in scope are accessible as usual within expressions).
-Plus `boost::phoenix::let` can be used to bind variables by constant reference. ]
+ [ 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] ]
@@ -90,6 +89,45 @@
]
]
+[h5 Comparison with __CPP0x_Lambda__ Functions]
+
+__CPP0x_lambda__ functions have most of the features that __Boost_Local__ local functions have, key pro and cons of the two approaches are:
+
+* __CPP0x_lambda__ functions can be defined within expressions while __Boost_Local__ local functions can only be defined within declarations.
+* __CPP0x_lambda__ functions are only supported by the C++0x standard so they are not supported by all C++ compilers.
+__Boost_Local__ local functions use only ISO C++ compliant features so they are supported on all C++ compliant compilers.
+* __CPP0x_lambda__ 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, __CPP0x_lambda__ functions can bind a variable by constant only if the variable is copyable and the binding will require a potentially expensive copy operation.
+For example:
+
+ struct x: boost::noncopyable {};
+
+ int main() {
+ // Cannot bind `x` by value because non copyable
+ // but if bind by reference `&x` then `x` is no
+ // longer constant within the lambda function.
+ [x]() {
+ }();
+
+ return 0;
+ }
+
+Or:
+
+ int main() {
+ std::vector<double> v(1000000);
+
+ // Need to bind `v` by value to make it constant
+ // within the lambda function but that requires
+ // the expensive copy of a vector of 1000000 elements.
+ [v]() {
+ }();
+
+ return 0;
+ }
+
+Both constant reference and non-constant value binding are instead supported by __Boost_Local__.
+
[h5 Examples]
The same example is rewritten here for all the different alternatives to local functions so programmers can get a sense of the different syntaxes and programming styles that the alternatives require.
@@ -104,11 +142,11 @@
[add_using_local_functor_cpp]
-Or using C++ global functors (but these do not allow to define the function locally so they are not an alternative implementation of local functions):
+Or using C++ global functors (but these do not allow to define the function locally so they are not a real alternative implementation of local functions):
[add_using_global_functor_cpp]
-Or using __CPP0x_lambda__ functions (but not part of ISO C++ standard):
+Or using __CPP0x_lambda__ functions (but not part of the ISO C++ standard):
[add_using_cpp0x_lambda_cpp]
@@ -122,32 +160,32 @@
[h5 Profiling]
-The following tables compare run-time, binary size, and compile-time for the different alternatives to local functions.
+The following tables compare run-time, binary size, and compile-time for the different alternatives presented 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 ISO C++ compliant compilers (see "__Boost_Local__ Compliant" below) 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.1 with C++0x features enabled, see also __N2657__) this library generates optimized code that runs as fast as the fastest of the other approaches (see "__Boost_Local__" below).
-When this library local function is specified `inline` (see "__Boost_Local__ Inline For-Loop" below) its run-times are always comparable to both the "Local Functor" and "Global Functor" approaches (for all these approaches, the local function cannot be portably passed as template parameter, see __N2657__, so `std::for_each` is replaced by a for-loop).
+However, on compilers that allow to pass local types as template parameters (e.g., MSVC 8.0 or GCC 4.5.1 with C++0x features enabled, see also __N2657__) this library automatically generates optimized code that runs as fast as the fastest of the other approaches (see "__Boost_Local__" below).
+When this library local function is specified `inline` (see "__Boost_Local__ Inline For-Loop" 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).
Finally, this library run-times are always among the fastest when no compiler optimization is enabled (using `bjam debug ...`).
[note
-The run-time performance of this library local function is explained because on ISO C++ compliant compilers (e.g., GCC 4.3.4) this library needs to use a function pointer in order to pass the local functor class as a template parameter (see __N2657__ and the __Implementation__ section).
-For all tested compilers, this function pointer prevents the compiler optimization algorithms from inlining all the function calls.
-Instead, the functor objects used by other approaches like "__Boost_Lambda__" and "__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 8.0 or GCC 4.51 with C++0x features enabled) because this library does not have to use the extra function pointer to implement the local function call.
+The run-time performances of this library local functions are explained because on ISO C++ compliant compilers (e.g., GCC 4.3.4) this library needs to use a function pointer in order to pass the local function class as a template parameter (see __N2657__ and the __Implementation__ 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 like "__Boost_Lambda__" and "__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 8.0 or GCC 4.5.1 with C++0x features enabled) 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 ISO C++ 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, 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 profile program source files linked below).
+Finally, note that only a very simple local function body with just a single instruction was used for the anaylsis presented here (see the `profile_...` source files linked below).
The authors have not studied how this library and the other approaches will perform with respect to each other when a more complex set of instructions is programmed for the local function body (e.g., /if/ 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_Lambda__ and __Boost_Phoenix__ /could/ start to show higher run-times even when optimization is enabled).
[table
[ [ Legend, Source Files, and Commands ] ]
[ [ [$../../example/profile_legend.png [width 13in] [height 10in]] ] ]
[ [
-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 source files at
+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 source files
[@../../example/profile_boost_local.cpp =profile_boost_local.cpp=],
[@../../example/profile_boost_local_inline.cpp =profile_boost_local_inline.cpp=],
[@../../example/profile_local_functor.cpp =profile_local_functor.cpp=],
@@ -182,7 +220,7 @@
[table
[ [
-MSVC 8.0 With "Local Types as Template Parameters" on Windows XP
+MSVC 8.0 With "Local Types as Template Parameters" (Without C++0x Lambdas) on Windows XP
] ]
[ [
[*Compiled with =bjam release ...= for maximum optimization (=/O2 /Ob2=)]
@@ -196,7 +234,7 @@
[table
[ [
-GCC 4.3.4 With No C++0x Features on Cygwin
+GCC 4.3.4 With ISO C++ Only (Without C++0x Lambdas and Without "Local Types as Template Parameters) on Cygwin
] ]
[ [
[*Compiled with =bjam release ...= for maximum optimization (=-O3 -finline-functions=)]
@@ -212,13 +250,13 @@
[section Local Blocks]
-The authors know of no other library or C++ language feature that supports local blocks (i.e., with the ability to bind by constant value or reference).
+The authors know of no other library or C++ language feature that supports local blocks (i.e., with the ability to bind by constant value or constant reference).
[endsect]
[section Local Exits]
-This library local exits provide a functionality very similar to the one provided by __Boost_ScopeExit__ but with the following additional features:
+This library local exits provide functionalities very similar to the ones already provided by __Boost_ScopeExit__ but with the following additional features:
* Bind by constant (value or reference).
* Bind the object `this`.
Modified: sandbox/local/libs/local/doc/qbk/examples.qbk
==============================================================================
--- sandbox/local/libs/local/doc/qbk/examples.qbk (original)
+++ sandbox/local/libs/local/doc/qbk/examples.qbk 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
@@ -22,7 +22,7 @@
[section:Emulating_Ds_Scope_Guards Emulating D's Scope Guards]
-Similarly to __Boost_ScopeExit__, local exits essentially emulate the [@http://www.digitalmars.com/d/2.0/statement.html scope exits] provided by the __D_Programming_Language__.
+Similarly to __Boost_ScopeExit__, local exits essentially emulate the [@http://www.digitalmars.com/d/2.0/statement.html scope exit] statement provided by the __D_Programming_Language__.
Local exits can also be used to emulate D's [@http://www.digitalmars.com/d/2.0/statement.html scope success] and [@http://www.digitalmars.com/d/2.0/statement.html scope failure] statements using a local variable that is set when an error occurs.
For example, using error codes:
@@ -67,9 +67,9 @@
[section GCC Nested Functions]
The GCC compiler supports local functions under the name of [@http://gcc.gnu.org/onlinedocs/gcc/Nested-Functions.html nested functions].
-Nested functions are exclusively a C extension of the GCC compiler, they are not supported for C++ not even by the GCC compiler, and they are not part of any C++ standard (ISO C++, C99, C++0x, etc) nor they are supported by other compilers like MSVC.
+Nested functions are exclusively a C extension of the GCC compiler, they are not supported for C++ not even by the GCC compiler, and they are not part of any C or C++ standard (ISO C++, C99, C++0x, etc) nor they are supported by other compilers like MSVC.
-The following examples rework the GCC nested function examples using this library local functions.
+The following examples implement the examples from the GCC nested function documentation using this library local functions.
[table
[ [__Variadic_Macro_Syntax__] [__Sequencing_Macro_Syntax__] ]
Modified: sandbox/local/libs/local/doc/qbk/implementation.qbk
==============================================================================
--- sandbox/local/libs/local/doc/qbk/implementation.qbk (original)
+++ sandbox/local/libs/local/doc/qbk/implementation.qbk 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
@@ -8,35 +8,36 @@
This section lists source code that should provide a general idea on how this library is implemented.
-The code listed here should only be used as a reference in trying to understand the library implementation and source code.
-There is no guarantee that the library implementation will use exactly the code listed here.
-Refer to the code comments in the library source files for the reasons behind the specific instructions listed here.
+The code listed here can be used by curious readers and library maintainers as a reference in trying to understand this library source files at `"boost/local/..."`.
+There is absolutely no guarantee that the library implementation uses the exact the code listed here.
-[section Local Functions]
+[section Local Classes as Template Parameters]
-The expansion of the local function macros of the `factorial` example presented in the __Advanced_Topics__ section generates code equivalent to the following:
+This library uses a local class to implement the local function object.
+However, in ISO C++ a local class (and therefore the local function object that it implements) cannot be passed as template parameter (e.g., to the `std::for_each` algorithm), this is instead possible on C++0x, 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):
-[factorial_impl_cpp]
+# The /casting functor trick/ uses a non-local functor that calls a static member function of the local class via a function pointer.
+The static member function then calls the correct local function body after type casting the object from a `void*` pointer (local classes can be used for type casting).
-[endsect]
+# The /virtual functor trick/ uses a non-local base class for the local functor class.
+The correct overridden implementation of the virtual `operator()` is called via polymorphism.
-[section Local Classes as Template Parameters]
+[tparam_trick_cpp]
-This library uses a local class to implement the local functor object.
-However, in ISO standard C++ a local classes, and therefore the local functor object, cannot be passed as template parameter (for example to the `std::for_each` algorithm), this is instead possible on C++03 and later standards.
-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 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, both tricks do not 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) that has been observed to be resolved only at run-time by all analyzed compilers.
+Therefore, on compilers that accept local types as template parameters (MSVC, C++0x, etc, see __N2657__), this library generates code that passes the local class type directly as template parameter without using neither one of these two tricks in order to take full advantage of compiler optimizations that inline the local function calls.
-# The /casting functor trick/ uses a non-local functor class that calls a static member function of the local class via a function pointer.
-The static member function then calls the correct local function body after type casting the object.
+[endsect]
-# The /virtual functor trick/ uses a non-local virtual base class for the local functor class.
-The correct implementation of the `operator()` is called via polymorphism.
+[section Parsing Macros]
-[tparam_trick_cpp]
+This library macros can parse the list of specified parameters and detect if any of the bound parameter name matches the token `this` (to generate special code to bind the object in scope), or if the parameter is bound by `const` (to generate special code to bind by constant), etc.
+The parameter tokens are inspected using preprocessor metaprogramming and specifically using __Boost_Preprocessor__ and the `BOOST_DETAIL_PP_KEYWORD_...` macros.
+For example:
-The casting functor trick had slightly better run-time performances than the virtual functor trick so the current implementation of this library uses the casting functor trick.
-However, both tricks do not 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) that can only be resolved at run-time.
-Therefore, on C++03 compilers this library generates code that passes the local class functor as template parameter directly without using neither one of these two tricks in order to take full advantage of compiler optimizations that inline the local function calls.
+[parsing_macros_impl_cpp]
[endsect]
@@ -56,32 +57,11 @@
[endsect]
-[section Parsing Macros]
+[section Local Functions]
-This library macros can parse the list of specified parameters and detect if any of the bound parameter name matches the token `this` (to generate special code to bind the object in scope), or if the parameter is bound by `const` (to generate special code to bind by constant), etc.
-The parameter tokens are inspected by preprocessor metaprogramming using both __Boost_Preprocessor__ and the `BOOST_DETAIL_PP_KEYWORD_...` macros that in brief work as follow:
+The expansion of the local function macros of the `factorial` example presented in the __Advanced_Topics__ section generates code equivalent to the following:
- #include <boost/detail/preprocessor/keyword/this.hpp>
- #include <boost/detail/preprocessor/keyword/const.hpp>
- #include <boost/local/aux_/preprocessor/keyword/bind.hpp>
-
- // Detect `this`.
- BOOST_DETAIL_PP_KEYWORD_IS_THIS_BACK(const bind this) // Expand to 1.
- BOOST_DETAIL_PP_KEYWORD_IS_THIS_BACK(const bind& x) // Expand to 0.
-
- // Detect constant.
- BOOST_DETAIL_PP_KEYWORD_IS_CONST_FRONT(const bind this) // Expand to 1.
- BOOST_DETAIL_PP_KEYWORD_IS_CONST_FRONT(bind this) // Expand to 0.
-
- // Detect binding (constant and not).
- BOOST_LOCAL_AUX_PP_KEYWORD_IS_BIND_FRONT( // Expand to 1.
- BOOST_DETAIL_PP_KEYWORD_CONST_REMOVE_FRONT(const bind this))
- BOOST_LOCAL_AUX_PP_KEYWORD_IS_BIND_FRONT( // Also expand to 1.
- BOOST_DETAIL_PP_KEYWORD_CONST_REMOVE_FRONT(bind this))
- BOOST_LOCAL_AUX_PP_KEYWORD_IS_BIND_FRONT( // Expand to 0.
- BOOST_DETAIL_PP_KEYWORD_CONST_REMOVE_FRONT(const int x))
- BOOST_LOCAL_AUX_PP_KEYWORD_IS_BIND_FRONT( // Also expand to 0.
- BOOST_DETAIL_PP_KEYWORD_CONST_REMOVE_FRONT(int x))
+[factorial_impl_cpp]
[endsect]
Modified: sandbox/local/libs/local/doc/qbk/local.qbk
==============================================================================
--- sandbox/local/libs/local/doc/qbk/local.qbk (original)
+++ sandbox/local/libs/local/doc/qbk/local.qbk 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
@@ -34,9 +34,11 @@
[def __Boost_TypeTraits__ [@http://www.boost.org/doc/libs/release/libs/type_traits/doc/html/index.html Boost.TypeTraits]]
[def __Boost_Chrono__ [@http://www.boost.org/doc/libs/release/libs/chrono/doc/html/index.html Boost.Chrono]]
[def __CPP0x_lambda__ [@http://en.wikipedia.org/wiki/C%2B%2B0x#Lambda_functions_and_expressions C++0x lambda]]
+[def __CPP0x_Lambda__ [@http://en.wikipedia.org/wiki/C%2B%2B0x#Lambda_functions_and_expressions C++0x Lambda]]
[def __LISP__ [@http://en.wikipedia.org/wiki/Lisp_(programming_language) LISP]]
[def __Contractpp__ [@http://sourceforge.net/projects/contractpp Contract++]]
[def __D_Programming_Language__ [@http://d.digitalmars.com D Programming Language]]
+[def __expression_template__ [@http://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/Expression-template expression template]]
[def __N2511__ [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2511.html \[N2511\]]]
[def __N2529__ [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2529.pdf \[N2529\]]]
@@ -155,6 +157,7 @@
[import ../../example/add_this_typed_va.cpp]
[import ../../example/overload.cpp]
[import ../../example/overload_va.cpp]
+[import ../../example/parsing_macros_impl.cpp]
The Boost Local library implements local functions, local blocks, and local exits for the C++ programming language.
Modified: sandbox/local/libs/local/doc/qbk/release_notes.qbk
==============================================================================
--- sandbox/local/libs/local/doc/qbk/release_notes.qbk (original)
+++ sandbox/local/libs/local/doc/qbk/release_notes.qbk 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
@@ -6,6 +6,21 @@
[section:Release_Notes Release Notes]
+[section Version 0.2.0 (2011-05-14)]
+
+# Replaced parenthesized syntax with variadic and sequencing macro syntaxes.
+# Profiled library performances against other approaches.
+# Replaced virtual functor trick with casting functor trick (for smaller run-time).
+# Optimized library run-time (rearranging code and not using casting functor trick on compilers that accept local classes as template parameters).
+# Added `__BOOST_LOCAL_FUNCTION_NAME__(inline ...)` and `__BOOST_LOCAL_FUNCTION_NAME__(recursive ...)`.
+# Added `__BOOST_LOCAL_TYPEOF__`.
+# Added `bind(type)` to specify bind type explicitly (skipping __Boost_Typeof__ type deduction).
+# Removed `boost::local::function` (use `boost::function` instead).
+# Added `__boost__local__function__overload__` to overload local functions (and functors in general).
+# Implemented support for nesting local functions, blocks, and exits into one another.
+
+[endsect]
+
[section Version 0.1.1 (2011-01-10)]
# Uploaded library source into Boost SVN sandbox.
@@ -28,12 +43,6 @@
[section TODO]
-# Rework factorial_impl and Implementation section.
-
-# Finalize Acknowledge section.
-
-# Apply copyright to all files.
-
[endsect]
[endsect]
Modified: sandbox/local/libs/local/doc/qbk/tutorial.qbk
==============================================================================
--- sandbox/local/libs/local/doc/qbk/tutorial.qbk (original)
+++ sandbox/local/libs/local/doc/qbk/tutorial.qbk 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
@@ -182,21 +182,34 @@
const bind& ``/variable-name/`` // Bind by constant value.
-(Note that when `const` is used, it must always precede `bind`.)
+Note that when `const` is used, it must always precede `bind`.
+[footnote
+*Rationale.*
+The library macros could have been implemented to accept both syntaxes `const bind ...` and `bind const ...` equivalently.
+However, handling both syntaxes would have complicated the macro implementation without adding any feature so only one syntax (`const bind ...`) is supported.
+]
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 causing run-time errors (in other words, the usual care in using C++ references must be taken for variables bound by reference).
-The type of bound variables is automatically deduced and it is the exact same type used to declare such variables in the enclosing scope.
-Therefore, if a bound variable is declared constant, using the `const` qualifier in the enclosing scope, then it will be always bound by constant value or constant reference even if `const` is not repeated by the local function binding.
-On the other hand, if a bound variable was not declared constant in the enclosing scope then it will not be bound as constant unless constant binding is forced using `const bind ...` (note that binding by constant reference is not supported by __CPP0x_lambda__ functions but it is supported by this library).
+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.
+
+* If a bound variable was declared constant in the enclosing scope, it will be always bound by constant value or constant reference even if `bind ...` is used instead of `const bind ...` .
+However, if a bound variable was not declared constant in the enclosing scope then it will not be bound as constant unless constant binding is forced using `const bind ...`. (Note that binding by constant reference is not supported by __CPP0x_lambda__ functions but it is supported by this library.)
[footnote
An historical note: Constant binding of variables in scope was the main use case that originally motivated the authors in developing this library.
The authors needed to locally create a chuck of code to assert some correctness conditions while these assertions were not supposed to modify any of the variables they were using (see the __Contractpp__ library).
This was achieved by binding by constant reference the variables needed by the assertions and then by programming the local function body to check the assertions (or more conveniently by using `__BOOST_LOCAL_BLOCK__`).
This way if any of the assertions mistakenly changes a bound variable (for example confusing the operator `==` with `=`), the compiler correctly generates an error because the bound variable is of `const` type within the local function body.
]
+* If a bound variable was declared as a reference in the enclosing scope, it will still be bound by value unless it is explicitly bound by reference using `bind& ...` or `const bind& ...`.
+[footnote
+*Rationale.*
+Variables originally declared as references are bound by value unless `[const] bind&` is used so that references can be bound by both value `[const] bind` and reference `[const] bind&` (this is the same binding semantic adopted by __Boost_ScopeExit__).
+On the other hand, variables originally declared as constants should never loose their `const` qualifier (to prevent their modification not just in the enclosing scope but also in the local scope) thus they are always bound by constant even if `bind[&]` is used instead of `const bind[&]`.
+]
+
As with passing parameters to usual C++ functions, programmers might want to bind variables of complex types by (constant) reference instead than by value to avoid expensive copy operations when these variables are bound to a local function.
For example, let's program a local function `add` similar to the one in the example from the __Introduction__ section.
Modified: sandbox/local/libs/local/example/Jamfile.jam
==============================================================================
--- sandbox/local/libs/local/example/Jamfile.jam (original)
+++ sandbox/local/libs/local/example/Jamfile.jam 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
@@ -67,7 +67,7 @@
exe factorial : factorial.cpp ;
exe factorial_va : factorial_va.cpp ;
-#exe factorial_impl : factorial_impl.cpp ;
+exe factorial_impl : factorial_impl.cpp ;
exe find_if : find_if.cpp ;
exe find_if_va : find_if_va.cpp ;
@@ -90,6 +90,8 @@
exe params_all : params_all.cpp ;
exe params_all_va : params_all_va.cpp ;
+exe parsing_macros_impl : parsing_macros_impl.cpp ;
+
exe print_map : print_map.cpp ;
exe print_map_va : print_map_va.cpp ;
Modified: sandbox/local/libs/local/example/factorial_impl.cpp
==============================================================================
--- sandbox/local/libs/local/example/factorial_impl.cpp (original)
+++ sandbox/local/libs/local/example/factorial_impl.cpp 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
@@ -4,7 +4,7 @@
// License, Version 1.0 (see accompanying file LICENSE_1_0.txt or a
// copy at http://www.boost.org/LICENSE_1_0.txt).
-//[ factorial_impl_cpp
+//[factorial_impl_cpp
#include <boost/local/function.hpp>
#include <iostream>
#include <sstream>
@@ -26,17 +26,17 @@
// 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)();
+ // 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 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;
+ };
+ 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`).
@@ -46,105 +46,126 @@
#else
typedef BOOST_TYPEOF(this) se_this_type21;
#endif
- // Deduce other `& separator` type (using Boost.ScopeExit technique).
- typedef void (*boost_se_tag_0_21)(int & separator);
- typedef BOOST_TYPEOF(boost::scope_exit::aux::wrap(boost::scope_exit::aux::deref(& separator, (boost_se_tag_0_21)0))) boost_se_wrapped_t_0_21;
+ // 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;
+ 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,
+ this ,
#ifdef BOOST_SCOPE_EXIT_AUX_TPL_WORKAROUND
{
#endif
- boost::scope_exit::aux::deref(& separator, (boost_se_tag_0_21)0)
+ 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::scope_exit::aux::declared< boost::scope_exit::aux::resolve< sizeof(boost_local_auxXargs) >::cmp1<0>::cmp2 > boost_local_auxXargs;
boost_local_auxXargs.value = &boost_local_auxXparams21;
// LOCAL FUNCTOR
- class boost_local_auxXfunctor21:
- // Base abstract class is used to later assign this local functor to `boost::local::function` so the local function can be passed as a template parameter (polymorphism ensures that the correct `operator()` as implemented by this class is called when this object is used as an `abstract_function` by `boost::local::function`).
- public ::boost::local::aux::abstract_function<boost_local_auxXresult_type21 (int n, bool recursion), 1> {
- typedef boost_local_auxXresult_type21 (boost_local_auxXfunction_type)(int n , bool recursion);
- public:
- // Take a generic pointer so it can be invoked by the `NAME` macro even if it expands on a different line number.
- explicit boost_local_auxXfunctor21(void* binding_data):
- boost_local_auxXbinds(static_cast<boost_se_params_t_21*>(binding_data)) {
- boost_local_auxXinit_recursion();
- }
-
+ 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.
- boost_local_auxXresult_type21 operator()(
- ::boost::function_traits<boost_local_auxXfunction_type>::arg1_type arg1,
- ::boost::function_traits<boost_local_auxXfunction_type>::arg2_type arg2) {
- // Actual parameter names are not known to the macro syntax separately from their types so generic names `arg...` must be used (and therefore the parameter types are extracted from the function type).
- return boost_local_auxXbody(boost_local_auxXbinds->boost_se_param_0_21.value, boost_local_auxXbinds->se_this, arg1, arg2);
- }
- boost_local_auxXresult_type21 operator()(
- ::boost::function_traits<boost_local_auxXfunction_type>::arg1_type arg1) {
- return boost_local_auxXbody(boost_local_auxXbinds->boost_se_param_0_21.value, boost_local_auxXbinds->se_this, arg1);
+ 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 );
}
- private:
- // Local function functor type (for a later declaration).
- typedef ::boost::local::function<boost_local_auxXfunction_type, 1> boost_local_auxXfunctor_type;
- // Define the deduced types for using `BOOST_LOCAL_TYPEOF` from within the local function body (the `&` is kept because the bound parameter name is not known to the macro syntax separately from the reference qualifier).
- typedef ::boost::add_const< boost_se_params_t_21:: boost_se_param_t_0_21 >::type & separatorXboost_local_auxXtypeof_type;
- typedef se_this_type21 thisXboost_local_auxXtypeof_type;
- // Hold bound parameters values and references.
- boost_se_params_t_21* boost_local_auxXbinds;
+ // "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;
+ boost::scope_exit::aux::undeclared boost_local_auxXargs;
- // The local function body. The body function cannot be static because is needs to access the member variable with the local function name to support recursion and the member variable named `...args` to support nesting (local classes cannot have static member variable). Unfortunately, this implies that `this` can be misused within the body instead of `this_` without necessarily generating a compile-time error.
- boost_local_auxXresult_type21 boost_local_auxXbody(
- // Use special name `this_` instead of `this` here.
- ::boost::add_const<boost_se_params_t_21::boost_se_param_t_0_21>::type & separator, se_this_type21 this_,
+ // 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
-
+ , 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(factorial)` expands to:
+ // *BEGIN* The macro `BOOST_LOCAL_FUNCTION_NAME(recursive factorial)` expands to:
- public:
+ public:
// Member variable named after the local function so the body can recursively call the local function (this must be defined here because the local function name was not known before). This must be public because it is also used to deduce the local function functor type later when when declaring the actual local function object.
- boost_local_auxXfunctor_type factorial;
- private:
+ 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).
- void boost_local_auxXinit_recursion() {
- factorial = *this;
- }
+ 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_auxXfunctorXfactorial(boost_local_auxXargs.value);
+ } 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_auxXfunctorXfactorial.factorial) const factorial(boost_local_auxXfunctorXfactorial);
+ 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);
}
};
Modified: sandbox/local/libs/local/example/profile.xls
==============================================================================
Binary files. No diff available.
Modified: sandbox/local/libs/local/example/profile_legend.png
==============================================================================
Binary files. No diff available.
Modified: sandbox/local/libs/local/example/tparam_trick.cpp
==============================================================================
--- sandbox/local/libs/local/example/tparam_trick.cpp (original)
+++ sandbox/local/libs/local/example/tparam_trick.cpp 2011-05-14 15:27:26 EDT (Sat, 14 May 2011)
@@ -7,7 +7,7 @@
#include <algorithm>
#include <cassert>
-// Casting Functor Trick
+// Casting functor trick.
struct casting_func {
explicit casting_func(void* obj, void (*call)(void*, const double&)):
obj_(obj), call_(call) {}
@@ -18,7 +18,7 @@
void (*call_)(void*, const double&);
};
-// Virtual Functor Trick
+// Virtual functor trick.
struct virtual_func {
struct interface {
// Unfortunately, virtual function call is not inlined.
@@ -30,6 +30,7 @@
interface* func_;
};
+// Local class for local function.
int main() {
double sum = 0.0;
int factor = 10;
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