|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r77765 - in trunk: boost boost/local_function boost/local_function/aux_ boost/local_function/aux_/macro boost/local_function/aux_/macro/code_ libs/local_function/example libs/local_function/test libs/scope_exit/example
From: lorcaminiti_at_[hidden]
Date: 2012-04-04 15:35:38
Author: lcaminiti
Date: 2012-04-04 15:35:34 EDT (Wed, 04 Apr 2012)
New Revision: 77765
URL: http://svn.boost.org/trac/boost/changeset/77765
Log:
Compiling all ScopeExit and LocalFunction tests and examples on GCC with and without type-of emulation mode.
Added LocalFunction configuration macro to force use or not use of locals as template parameters.
Removed:
trunk/boost/local_function/aux_/config.hpp
trunk/boost/local_function/aux_/macro/code_/end.hpp
trunk/boost/local_function/aux_/macro/code_/name.hpp
Text files modified:
trunk/boost/local_function.hpp | 12 +++++++++
trunk/boost/local_function/aux_/function.hpp | 19 +++++++--------
trunk/boost/local_function/aux_/macro/code_/functor.hpp | 12 ++++------
trunk/boost/local_function/aux_/macro/name.hpp | 46 +++++++++++++++++++++++----------------
trunk/boost/local_function/aux_/nobind.hpp | 4 +-
trunk/boost/local_function/config.hpp | 30 ++++++++++++++++++++++++-
trunk/libs/local_function/example/expensive_copy_local_function.cpp | 3 ++
trunk/libs/local_function/example/n2529_this.cpp | 5 ++++
trunk/libs/local_function/example/n2550_find_if.cpp | 3 ++
trunk/libs/local_function/example/noncopyable_local_function.cpp | 3 ++
trunk/libs/local_function/test/add_template.cpp | 4 +-
trunk/libs/local_function/test/add_template_seq.cpp | 2
trunk/libs/local_function/test/add_this.cpp | 5 ++++
trunk/libs/local_function/test/add_this_seq.cpp | 5 ++++
trunk/libs/local_function/test/add_typed.cpp | 9 ++++++-
trunk/libs/local_function/test/add_typed_seq.cpp | 5 ++++
trunk/libs/local_function/test/factorial.cpp | 2
trunk/libs/local_function/test/factorial_seq.cpp | 2
trunk/libs/local_function/test/macro_commas.cpp | 2 +
trunk/libs/local_function/test/macro_commas_seq.cpp | 2 +
trunk/libs/local_function/test/operator.cpp | 5 +++
trunk/libs/local_function/test/operator_error.cpp | 3 ++
trunk/libs/local_function/test/operator_error_seq.cpp | 3 ++
trunk/libs/local_function/test/operator_seq.cpp | 3 ++
trunk/libs/local_function/test/overload.cpp | 1
trunk/libs/local_function/test/overload_seq.cpp | 1
trunk/libs/local_function/test/return_derivative.cpp | 4 +++
trunk/libs/local_function/test/return_derivative_seq.cpp | 4 +++
trunk/libs/local_function/test/return_setget.cpp | 1
trunk/libs/local_function/test/return_setget_seq.cpp | 1
trunk/libs/local_function/test/return_this.cpp | 5 ++++
trunk/libs/local_function/test/return_this_seq.cpp | 5 ++++
trunk/libs/local_function/test/typeof_template.cpp | 2
trunk/libs/local_function/test/typeof_template_seq.cpp | 2
trunk/libs/scope_exit/example/scope_guard.cpp | 2 +
trunk/libs/scope_exit/example/scope_guard_seq.cpp | 5 ++-
trunk/libs/scope_exit/example/try_catch.cpp | 3 ++
trunk/libs/scope_exit/example/try_catch_seq.cpp | 3 ++
38 files changed, 175 insertions(+), 53 deletions(-)
Modified: trunk/boost/local_function.hpp
==============================================================================
--- trunk/boost/local_function.hpp (original)
+++ trunk/boost/local_function.hpp 2012-04-04 15:35:34 EDT (Wed, 04 Apr 2012)
@@ -46,7 +46,12 @@
#endif // VARIADIC
#define BOOST_LOCAL_FUNCTION_NAME(qualified_function_name) \
- BOOST_LOCAL_FUNCTION_AUX_NAME(qualified_function_name)
+ BOOST_LOCAL_FUNCTION_AUX_NAME(0, /* not within template */ \
+ qualified_function_name)
+
+#define BOOST_LOCAL_FUNCTION_NAME_TPL(qualified_function_name) \
+ BOOST_LOCAL_FUNCTION_AUX_NAME(1, /* within template */ \
+ qualified_function_name)
#define BOOST_LOCAL_FUNCTION_TYPEOF(bound_variable_name) \
BOOST_LOCAL_FUNCTION_AUX_TYPEOF_TYPE(bound_variable_name)
@@ -298,6 +303,11 @@
#define BOOST_LOCAL_FUNCTION_NAME(qualified_function_name)
/**
+In type-dependant context.
+*/
+#define BOOST_LOCAL_FUNCTION_NAME_TPL(qualified_function_name)
+
+/**
@brief This macro expands to the type of the specified bound variable.
This macro can be used within the local functions body to refer to the bound
Deleted: trunk/boost/local_function/aux_/config.hpp
==============================================================================
--- trunk/boost/local_function/aux_/config.hpp 2012-04-04 15:35:34 EDT (Wed, 04 Apr 2012)
+++ (empty file)
@@ -1,36 +0,0 @@
-
-// Copyright (C) 2009-2012 Lorenzo Caminiti
-// Distributed under the Boost Software License, Version 1.0
-// (see accompanying file LICENSE_1_0.txt or a copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-// Home at http://www.boost.org/libs/local_function
-
-#ifndef BOOST_LOCAL_FUNCTION_AUX_CONFIG_HPP_
-#define BOOST_LOCAL_FUNCTION_AUX_CONFIG_HPP_
-
-#include <boost/config.hpp>
-
-// PUBLIC //
-
-// NOTE: If local classes can be passes as template parameters (always true for
-// C++11 and true for some C++03 compilers like MSVC and old GCC versions),
-// this library uses it to optimize local function performances (which in this
-// case are comparable to C++11 lambdas).
-#ifdef BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS
-# define BOOST_LOCAL_FUNCTION_AUX_CONFIG_LOCALS_AS_TPARAMS_01 0
-# if __GNUC__
-# warning "Boost.LocalFunction: Local class template parameters"
-# elif BOOST_MSVC
-# pragma message("Boost.LocalFunction: Local class template parameters")
-# endif
-#else
-# define BOOST_LOCAL_FUNCTION_AUX_CONFIG_LOCALS_AS_TPARAMS_01 1
-# if __GNUC__
-# warning "Boost.LocalFunction: No local class template parameters"
-# elif BOOST_MSVC
-# pragma message("Boost.LocalFunction: No local class template parameters")
-# endif
-#endif
-
-#endif // #include guard
-
Modified: trunk/boost/local_function/aux_/function.hpp
==============================================================================
--- trunk/boost/local_function/aux_/function.hpp (original)
+++ trunk/boost/local_function/aux_/function.hpp 2012-04-04 15:35:34 EDT (Wed, 04 Apr 2012)
@@ -10,7 +10,6 @@
# define BOOST_LOCAL_FUNCTION_AUX_FUNCTION_HPP_
# include <boost/local_function/config.hpp>
-# include <boost/local_function/aux_/config.hpp>
# include <boost/local_function/aux_/member.hpp>
# include <boost/call_traits.hpp>
# include <boost/typeof/typeof.hpp>
@@ -114,7 +113,7 @@
#define BOOST_LOCAL_FUNCTION_AUX_call_typedef(z, n, arity) \
typedef R (*BOOST_LOCAL_FUNCTION_AUX_call_ptr(z, n, ~))( \
object_ptr \
- BOOST_PP_IIF(BOOST_LOCAL_FUNCTION_AUX_CONFIG_LOCALS_AS_TPARAMS_01, \
+ BOOST_PP_IIF(BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS, \
BOOST_PP_TUPLE_EAT(3) \
, \
BOOST_PP_REPEAT_ ## z \
@@ -153,7 +152,7 @@
return BOOST_LOCAL_FUNCTION_AUX_call_member(z, defaults_n, ~)( \
object_ \
BOOST_PP_IIF( \
- BOOST_LOCAL_FUNCTION_AUX_CONFIG_LOCALS_AS_TPARAMS_01,\
+ BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS,\
BOOST_PP_TUPLE_EAT(3) \
, \
BOOST_PP_REPEAT_ ## z \
@@ -169,7 +168,7 @@
template<
typename F
, size_t defaults
-#if !BOOST_LOCAL_FUNCTION_AUX_CONFIG_LOCALS_AS_TPARAMS_01
+#if !BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS
BOOST_PP_REPEAT(BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX,
BOOST_LOCAL_FUNCTION_AUX_comma_bind_tparam, ~)
#endif
@@ -190,7 +189,7 @@
(typename) // For `F` tparam.
(size_t) // For `defaults` tparam.
// MSVC error if using #if instead of PP_IIF here.
- BOOST_PP_IIF(BOOST_LOCAL_FUNCTION_AUX_CONFIG_LOCALS_AS_TPARAMS_01,
+ BOOST_PP_IIF(BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS,
BOOST_PP_TUPLE_EAT(3) // Nothing.
,
BOOST_PP_REPEAT // For bind tparams.
@@ -241,7 +240,7 @@
typename R
BOOST_PP_REPEAT(BOOST_LOCAL_FUNCTION_AUX_arity,
BOOST_LOCAL_FUNCTION_AUX_comma_arg_tparam, ~)
-#if !BOOST_LOCAL_FUNCTION_AUX_CONFIG_LOCALS_AS_TPARAMS_01
+#if !BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS
BOOST_PP_REPEAT(BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX,
BOOST_LOCAL_FUNCTION_AUX_comma_bind_tparam, ~)
#endif
@@ -252,7 +251,7 @@
BOOST_LOCAL_FUNCTION_AUX_arg_type, ~)
)
, BOOST_LOCAL_FUNCTION_AUX_defaults
-#if !BOOST_LOCAL_FUNCTION_AUX_CONFIG_LOCALS_AS_TPARAMS_01
+#if !BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS
BOOST_PP_REPEAT(BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX,
BOOST_LOCAL_FUNCTION_AUX_comma_bind_type, ~)
#endif
@@ -288,7 +287,7 @@
// so used internal symbol.
inline void BOOST_LOCAL_FUNCTION_AUX_FUNCTION_INIT_CALL_FUNC(
object_ptr object
-#if !BOOST_LOCAL_FUNCTION_AUX_CONFIG_LOCALS_AS_TPARAMS_01
+#if !BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS
BOOST_PP_REPEAT(BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX,
BOOST_LOCAL_FUNCTION_AUX_comma_bind_param_decl, ~)
#endif
@@ -296,7 +295,7 @@
BOOST_LOCAL_FUNCTION_AUX_comma_call_param_decl, ~)
) {
object_ = object;
-#if !BOOST_LOCAL_FUNCTION_AUX_CONFIG_LOCALS_AS_TPARAMS_01
+#if !BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS
BOOST_PP_REPEAT(BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX,
BOOST_LOCAL_FUNCTION_AUX_bind_member_init, ~)
#endif
@@ -314,7 +313,7 @@
private:
object_ptr object_;
-#if !BOOST_LOCAL_FUNCTION_AUX_CONFIG_LOCALS_AS_TPARAMS_01
+#if !BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS
BOOST_PP_REPEAT(BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX,
BOOST_LOCAL_FUNCTION_AUX_bind_member_decl, ~)
#endif
Deleted: trunk/boost/local_function/aux_/macro/code_/end.hpp
==============================================================================
--- trunk/boost/local_function/aux_/macro/code_/end.hpp 2012-04-04 15:35:34 EDT (Wed, 04 Apr 2012)
+++ (empty file)
@@ -1,97 +0,0 @@
-
-// Copyright (C) 2009-2012 Lorenzo Caminiti
-// Distributed under the Boost Software License, Version 1.0
-// (see accompanying file LICENSE_1_0.txt or a copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-// Home at http://www.boost.org/libs/local_function
-
-#ifndef BOOST_CLOSURE_AUX_CODE_END_HPP_
-#define BOOST_CLOSURE_AUX_CODE_END_HPP_
-
-#include <boost/closure/aux_/symbol.hpp>
-#include <boost/closure/aux_/config.hpp>
-#include <boost/closure/aux_/function.hpp>
-#include <boost/closure/aux_/macro/closure.hpp>
-#include <boost/closure/aux_/macro/code_/functor.hpp>
-#include <boost/closure/detail/preprocessor/keyword/inline.hpp>
-#include <boost/typeof/typeof.hpp>
-#include <boost/preprocessor/logical/bitor.hpp>
-#include <boost/preprocessor/control/iif.hpp>
-
-// PRIVATE //
-
-#define BOOST_CLOSURE_AUX_CODE_END_FUNCTOR_PTR_ \
- BOOST_CLOSURE_AUX_SYMBOL( (functor_ptr) )
-
-#define BOOST_CLOSURE_AUX_CODE_END_FUNCTOR_(id, \
- local_function_name, local_functor_name, nonlocal_functor_name) \
- /* `PARAMS() { ... }` expandsion here -- still within functor class */ \
- /* class functor ## __LINE__ { ... */ \
- public: \
- /* LIMITATION: member var used to deduce functor type using TYPEOF */ \
- /* (so it must be public, ptr to always allow for default init); */ \
- /* unfortunately, this introduces a dependency with Boost.Typeof */ \
- /* that cannot be removed even when all binds and result types are */ \
- /* explicitly specified but this is necessary because the functor */ \
- /* type is known to the CLOSURE macro which must pass it to the */ \
- /* END macro that is defined on a different line */ \
- BOOST_CLOSURE_AUX_CODE_FUNCTOR_TYPE* \
- BOOST_CLOSURE_AUX_CODE_END_FUNCTOR_PTR_; \
- /* local functor can be passed as tparam only on C++11 (faster) */ \
- } local_functor_name(BOOST_CLOSURE_AUX_CLOSURE_ARGS_VAR.value); \
- /* non-local functor can always be passed as tparam (but slower) */ \
- BOOST_TYPEOF(*(local_functor_name.BOOST_CLOSURE_AUX_CODE_END_FUNCTOR_PTR_))\
- nonlocal_functor_name; \
- /* initialization */ \
- local_functor_name.BOOST_CLOSURE_AUX_FUNCTION_INIT_CALL_FUNC( \
- &local_functor_name, nonlocal_functor_name);
-
-#define BOOST_CLOSURE_AUX_CODE_END_FUNCTOR_VAR_(local_function_name) \
- BOOST_CLOSURE_AUX_SYMBOL( (local_function_name) )
-
-// This can always be passed as a template parameters (on all compilers).
-// However, it is slower because it cannot be inlined.
-// Passed at tparam: Yes (on all C++). Inlineable: No. Recursive: No.
-#define BOOST_CLOSURE_AUX_CODE_END_(local_function_name) \
- BOOST_CLOSURE_AUX_CODE_END_FUNCTOR_(__LINE__, local_function_name, \
- /* local functor */ \
- BOOST_CLOSURE_AUX_CODE_END_FUNCTOR_VAR_(local_function_name), \
- /* local function declared as non-local functor -- but it can */ \
- /* be inlined only by C++11 and it cannot be recursive */ \
- local_function_name)
-
-// This is faster on some compilers but not all (e.g., it is faster on GCC
-// because its optimization inlines it but not on MSVC). However, it cannot be
-// passed as a template parameter on non C++11 compilers.
-// Passed at tparam: Only on C++11. Inlineable: Yes. Recursive: No.
-#define BOOST_CLOSURE_AUX_CODE_END_INLINE_(local_function_name) \
- BOOST_CLOSURE_AUX_CODE_END_FUNCTOR_(__LINE__, local_function_name, \
- /* inlined local function declared as local functor (maybe */ \
- /* inlined even by non C++11 -- but it can be passed as */ \
- /* template parameter only on C++11 */ \
- local_function_name, \
- /* non-local functor */ \
- BOOST_CLOSURE_AUX_CODE_END_FUNCTOR_VAR_(local_function_name))
-
-// PUBLIC //
-
-// Inlined local functions are specified by `..._NAME(inline name)`.
-// They have more chances to be inlined for faster run-times by some compilers
-// (for example by GCC but not by MSVC). C++11 compilers can always inline
-// local functions even if they are not explicitly specified inline.
-#define BOOST_CLOSURE_AUX_CODE_END(qualified_name) \
- BOOST_PP_IIF(BOOST_PP_BITOR( \
- BOOST_CLOSURE_AUX_CONFIG_LOCAL_TYPES_AS_TEMPLATE_PARAMS_01, \
- BOOST_CLOSURE_DETAIL_PP_KEYWORD_IS_INLINE_FRONT(qualified_name)), \
- /* on C++11 always use inlining because compilers might optimize */ \
- /* it to be faster and it can also be passed as tparam */ \
- BOOST_CLOSURE_AUX_CODE_END_INLINE_ \
- , \
- /* on non C++11 don't use liniling unless explicitly specified by */ \
- /* programmers `inline name` the inlined local function cannot be */ \
- /* passed as tparam */ \
- BOOST_CLOSURE_AUX_CODE_END_ \
- )(BOOST_CLOSURE_DETAIL_PP_KEYWORD_INLINE_REMOVE_FRONT(qualified_name))
-
-#endif // #include guard
-
Modified: trunk/boost/local_function/aux_/macro/code_/functor.hpp
==============================================================================
--- trunk/boost/local_function/aux_/macro/code_/functor.hpp (original)
+++ trunk/boost/local_function/aux_/macro/code_/functor.hpp 2012-04-04 15:35:34 EDT (Wed, 04 Apr 2012)
@@ -8,8 +8,8 @@
#ifndef BOOST_LOCAL_FUNCTION_AUX_CODE_FUNCTOR_HPP_
#define BOOST_LOCAL_FUNCTION_AUX_CODE_FUNCTOR_HPP_
+#include <boost/local_function/config.hpp>
#include <boost/local_function/aux_/symbol.hpp>
-#include <boost/local_function/aux_/config.hpp>
#include <boost/local_function/aux_/function.hpp>
#include <boost/local_function/aux_/add_pointed_const.hpp>
#include <boost/local_function/aux_/member.hpp>
@@ -464,7 +464,7 @@
inline static BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_TYPE(id) \
BOOST_LOCAL_FUNCTION_AUX_CODE_FUNCTOR_STATIC_CALL_FUNC_(z, defaults_n, ~)( \
void* object \
- BOOST_PP_IIF(BOOST_LOCAL_FUNCTION_AUX_CONFIG_LOCALS_AS_TPARAMS_01, \
+ BOOST_PP_IIF(BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS, \
BOOST_PP_TUPLE_EAT(6) \
, \
BOOST_LOCAL_FUNCTION_AUX_CODE_FUNCTOR_STATIC_CALL_COMMA_BIND_PARAM_DECLS_ \
@@ -486,7 +486,7 @@
static_cast< \
BOOST_LOCAL_FUNCTION_AUX_CODE_FUNCTOR_CLASS_TYPE_(id)* \
>(object)-> \
- BOOST_PP_IIF(BOOST_LOCAL_FUNCTION_AUX_CONFIG_LOCALS_AS_TPARAMS_01,\
+ BOOST_PP_IIF(BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS,\
BOOST_LOCAL_FUNCTION_AUX_CODE_FUNCTOR_STATIC_CALL_OPERATOR_ \
, \
BOOST_LOCAL_FUNCTION_AUX_CODE_FUNCTOR_STATIC_CALL_BODY_ \
@@ -703,8 +703,7 @@
::boost::local_function::aux::function< \
BOOST_LOCAL_FUNCTION_AUX_CODE_FUNCTOR_F_TYPE_ \
, default_count \
- BOOST_PP_IIF( \
- BOOST_LOCAL_FUNCTION_AUX_CONFIG_LOCALS_AS_TPARAMS_01, \
+ BOOST_PP_IIF(BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS,\
BOOST_PP_TUPLE_EAT(6) \
, \
BOOST_LOCAL_FUNCTION_AUX_CODE_FUNCTOR_COMMA_BIND_TYPES_\
@@ -767,8 +766,7 @@
) { \
functor.BOOST_LOCAL_FUNCTION_AUX_FUNCTION_INIT_CALL_FUNC( \
object \
- BOOST_PP_IIF( \
- BOOST_LOCAL_FUNCTION_AUX_CONFIG_LOCALS_AS_TPARAMS_01, \
+ BOOST_PP_IIF(BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS,\
BOOST_PP_TUPLE_EAT(6) \
, \
BOOST_LOCAL_FUNCTION_AUX_CODE_FUNCTOR_COMMA_STATIC_BINDS_ \
Deleted: trunk/boost/local_function/aux_/macro/code_/name.hpp
==============================================================================
--- trunk/boost/local_function/aux_/macro/code_/name.hpp 2012-04-04 15:35:34 EDT (Wed, 04 Apr 2012)
+++ (empty file)
@@ -1,103 +0,0 @@
-
-// Copyright (C) 2009-2012 Lorenzo Caminiti
-// Distributed under the Boost Software License, Version 1.0
-// (see accompanying file LICENSE_1_0.txt or a copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-// Home at http://www.boost.org/libs/local_function
-
-#ifndef BOOST_LOCAL_FUNCTION_AUX_CODE_NAME_HPP_
-#define BOOST_LOCAL_FUNCTION_AUX_CODE_NAME_HPP_
-
-#include <boost/local_function/aux_/symbol.hpp>
-#include <boost/local_function/aux_/config.hpp>
-#include <boost/local_function/aux_/function.hpp>
-#include <boost/local_function/aux_/macro/decl.hpp>
-#include <boost/local_function/aux_/macro/code_/functor.hpp>
-#include <boost/local_function/detail/preprocessor/keyword/inline.hpp>
-#include <boost/typeof/typeof.hpp>
-#include <boost/preprocessor/logical/bitor.hpp>
-#include <boost/preprocessor/control/iif.hpp>
-
-// PRIVATE //
-
-#define BOOST_LOCAL_FUNCTION_AUX_CODE_NAME_FUNCTOR_PTR_ \
- BOOST_LOCAL_FUNCTION_AUX_SYMBOL( (functor_ptr) )
-
-#define BOOST_LOCAL_FUNCTION_AUX_CODE_NAME_FUNCTOR_(id, \
- local_function_name, local_functor_name, nonlocal_functor_name) \
- /* `PARAMS() { ... }` expandsion here -- still within functor class */ \
- /* class functor ## __LINE__ { ... */ \
- public: \
- /* LIMITATION: member var used to deduce functor type using TYPEOF */ \
- /* (so it must be public, ptr to always allow for default init); */ \
- /* unfortunately, this introduces a dependency with Boost.Typeof */ \
- /* that cannot be removed even when all binds and result types are */ \
- /* explicitly specified but this is necessary because the functor */ \
- /* type is known to the LOCAL_FUNCTION macro which must pass it to */ \
- /* the NAME macro that is defined on a different line */ \
- BOOST_LOCAL_FUNCTION_AUX_CODE_FUNCTOR_TYPE* \
- BOOST_LOCAL_FUNCTION_AUX_CODE_NAME_FUNCTOR_PTR_; \
- /* local functor can be passed as tparam only on C++11 (faster) */ \
- } local_functor_name( \
- BOOST_LOCAL_FUNCTION_AUX_DECL_ARGS_VAR.value); \
- /* non-local functor can always be passed as tparam (but slower) */ \
- BOOST_TYPEOF(*(local_functor_name. \
- BOOST_LOCAL_FUNCTION_AUX_CODE_NAME_FUNCTOR_PTR_)) \
- nonlocal_functor_name; \
- /* initialization */ \
- local_functor_name.BOOST_LOCAL_FUNCTION_AUX_FUNCTION_INIT_CALL_FUNC( \
- &local_functor_name, nonlocal_functor_name);
-
-#define BOOST_LOCAL_FUNCTION_AUX_CODE_NAME_FUNCTOR_VAR_(local_function_name) \
- BOOST_LOCAL_FUNCTION_AUX_SYMBOL( (local_function_name) )
-
-// This can always be passed as a template parameters (on all compilers).
-// However, it is slower because it cannot be inlined.
-// Passed at tparam: Yes (on all C++). Inlineable: No. Recursive: No.
-#define BOOST_LOCAL_FUNCTION_AUX_CODE_NAME_(local_function_name) \
- BOOST_LOCAL_FUNCTION_AUX_CODE_NAME_FUNCTOR_(__LINE__, local_function_name, \
- /* local functor */ \
- BOOST_LOCAL_FUNCTION_AUX_CODE_NAME_FUNCTOR_VAR_( \
- local_function_name), \
- /* local function declared as non-local functor -- but it can */ \
- /* be inlined only by C++11 and it cannot be recursive */ \
- local_function_name)
-
-// This is faster on some compilers but not all (e.g., it is faster on GCC
-// because its optimization inlines it but not on MSVC). However, it cannot be
-// passed as a template parameter on non C++11 compilers.
-// Passed at tparam: Only on C++11. Inlineable: Yes. Recursive: No.
-#define BOOST_LOCAL_FUNCTION_AUX_CODE_NAME_INLINE_(local_function_name) \
- BOOST_LOCAL_FUNCTION_AUX_CODE_NAME_FUNCTOR_(__LINE__, local_function_name, \
- /* inlined local function declared as local functor (maybe */ \
- /* inlined even by non C++11 -- but it can be passed as */ \
- /* template parameter only on C++11 */ \
- local_function_name, \
- /* non-local functor */ \
- BOOST_LOCAL_FUNCTION_AUX_CODE_NAME_FUNCTOR_VAR_( \
- local_function_name))
-
-// PUBLIC //
-
-// Inlined local functions are specified by `..._NAME(inline name)`.
-// They have more chances to be inlined for faster run-times by some compilers
-// (for example by GCC but not by MSVC). C++11 compilers can always inline
-// local functions even if they are not explicitly specified inline.
-#define BOOST_LOCAL_FUNCTION_AUX_CODE_NAME(qualified_name) \
- BOOST_PP_IIF(BOOST_PP_BITOR( \
- BOOST_LOCAL_FUNCTION_AUX_CONFIG_LOCALS_AS_TPARAMS_01, \
- BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_IS_INLINE_FRONT( \
- qualified_name)), \
- /* on C++11 always use inlining because compilers might optimize */ \
- /* it to be faster and it can also be passed as tparam */ \
- BOOST_LOCAL_FUNCTION_AUX_CODE_NAME_INLINE_ \
- , \
- /* on non C++11 don't use liniling unless explicitly specified by */ \
- /* programmers `inline name` the inlined local function cannot be */ \
- /* passed as tparam */ \
- BOOST_LOCAL_FUNCTION_AUX_CODE_NAME_ \
- )(BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_INLINE_REMOVE_FRONT( \
- qualified_name))
-
-#endif // #include guard
-
Modified: trunk/boost/local_function/aux_/macro/name.hpp
==============================================================================
--- trunk/boost/local_function/aux_/macro/name.hpp (original)
+++ trunk/boost/local_function/aux_/macro/name.hpp 2012-04-04 15:35:34 EDT (Wed, 04 Apr 2012)
@@ -8,13 +8,13 @@
#ifndef BOOST_LOCAL_FUNCTION_AUX_NAME_HPP_
#define BOOST_LOCAL_FUNCTION_AUX_NAME_HPP_
+#include <boost/local_function/config.hpp>
#include <boost/local_function/aux_/macro/decl.hpp>
#include <boost/local_function/aux_/macro/code_/functor.hpp>
#include <boost/local_function/detail/preprocessor/keyword/recursive.hpp>
#include <boost/local_function/detail/preprocessor/keyword/inline.hpp>
#include <boost/local_function/aux_/function.hpp>
#include <boost/local_function/aux_/symbol.hpp>
-#include <boost/local_function/aux_/config.hpp>
#include <boost/typeof/typeof.hpp>
#include <boost/preprocessor/control/iif.hpp>
#include <boost/preprocessor/control/expr_iif.hpp>
@@ -34,7 +34,7 @@
BOOST_LOCAL_FUNCTION_AUX_SYMBOL( (nonrecursive_local_function_name) ) \
)
-#define BOOST_LOCAL_FUNCTION_AUX_NAME_END_LOCAL_FUNCTOR_(id, \
+#define BOOST_LOCAL_FUNCTION_AUX_NAME_END_LOCAL_FUNCTOR_(typename01, \
local_function_name, is_recursive, \
local_functor_name, nonlocal_functor_name) \
/* `PARAMS() { ... }` expandsion here -- still within functor class */ \
@@ -64,10 +64,14 @@
/* local functor can be passed as tparam only on C++11 (faster) */ \
} local_functor_name(BOOST_LOCAL_FUNCTION_AUX_DECL_ARGS_VAR.value); \
/* non-local functor can always be passed as tparam (but slower) */ \
- BOOST_TYPEOF(local_functor_name. \
- BOOST_LOCAL_FUNCTION_AUX_NAME_RECURSIVE_FUNC_(is_recursive, \
- local_function_name)) \
- nonlocal_functor_name; \
+ BOOST_PP_IIF(typename01, \
+ BOOST_TYPEOF_TPL \
+ , \
+ BOOST_TYPEOF \
+ )(local_functor_name.BOOST_LOCAL_FUNCTION_AUX_NAME_RECURSIVE_FUNC_( \
+ is_recursive, local_function_name)) \
+ nonlocal_functor_name /* functor variable */ \
+ ; \
/* the order of the following 2 function calls cannot be changed */ \
/* because init_recursion uses the local_functor so the local_functor */ \
/* must be init first */ \
@@ -87,8 +91,8 @@
// This can always be passed as a template parameters (on all compilers).
// However, it is slower because it cannot be inlined.
// Passed at tparam: Yes (on all C++). Inlineable: No. Recursive: No.
-#define BOOST_LOCAL_FUNCTION_AUX_NAME_(local_function_name) \
- BOOST_LOCAL_FUNCTION_AUX_NAME_END_LOCAL_FUNCTOR_(__LINE__, \
+#define BOOST_LOCAL_FUNCTION_AUX_NAME_(typename01, local_function_name) \
+ BOOST_LOCAL_FUNCTION_AUX_NAME_END_LOCAL_FUNCTOR_(typename01, \
local_function_name, \
/* local function is not recursive (because recursion and its */ \
/* initialization cannot be inlined even on C++11, */ \
@@ -104,8 +108,8 @@
// because its optimization inlines it but not on MSVC). However, it cannot be
// passed as a template parameter on non C++11 compilers.
// Passed at tparam: Only on C++11. Inlineable: Yes. Recursive: No.
-#define BOOST_LOCAL_FUNCTION_AUX_NAME_INLINE_(local_function_name) \
- BOOST_LOCAL_FUNCTION_AUX_NAME_END_LOCAL_FUNCTOR_(__LINE__, \
+#define BOOST_LOCAL_FUNCTION_AUX_NAME_INLINE_(typename01, local_function_name) \
+ BOOST_LOCAL_FUNCTION_AUX_NAME_END_LOCAL_FUNCTOR_(typename01, \
local_function_name, \
/* inlined local function is never recursive (because recursion */ \
/* and its initialization cannot be inlined)*/ \
@@ -120,8 +124,9 @@
// This is slower on all compilers (C++11 and non) because recursion and its
// initialization can never be inlined.
// Passed at tparam: Yes. Inlineable: No. Recursive: Yes.
-#define BOOST_LOCAL_FUNCTION_AUX_NAME_RECURSIVE_(local_function_name) \
- BOOST_LOCAL_FUNCTION_AUX_NAME_END_LOCAL_FUNCTOR_(__LINE__, \
+#define BOOST_LOCAL_FUNCTION_AUX_NAME_RECURSIVE_( \
+ typename01, local_function_name) \
+ BOOST_LOCAL_FUNCTION_AUX_NAME_END_LOCAL_FUNCTOR_(typename01, \
local_function_name, \
/* recursive local function -- but it cannot be inlined */ \
1 /* recursive */ , \
@@ -135,9 +140,10 @@
// They have more chances to be inlined for faster run-times by some compilers
// (for example by GCC but not by MSVC). C++11 compilers can always inline
// local functions even if they are not explicitly specified inline.
-#define BOOST_LOCAL_FUNCTION_AUX_NAME_PARSE_INLINE_(qualified_name) \
+#define BOOST_LOCAL_FUNCTION_AUX_NAME_PARSE_INLINE_( \
+ typename01, qualified_name) \
BOOST_PP_IIF(BOOST_PP_BITOR( \
- BOOST_LOCAL_FUNCTION_AUX_CONFIG_LOCALS_AS_TPARAMS_01, \
+ BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS, \
BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_IS_INLINE_FRONT( \
qualified_name)), \
/* on C++11 always use inlining because compilers might optimize */ \
@@ -148,7 +154,7 @@
/* programmers `inline name` the inlined local function cannot be */ \
/* passed as tparam */ \
BOOST_LOCAL_FUNCTION_AUX_NAME_ \
- )(BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_INLINE_REMOVE_FRONT( \
+ )(typename01, BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_INLINE_REMOVE_FRONT( \
qualified_name))
// Expand to 1 iff `recursive name` or `recursive inline name` or
@@ -178,18 +184,20 @@
// Recursive local function are specified by `..._NAME(recursive name)`.
// They can never be inlined for faster run-time (not even by C++11 compilers).
-#define BOOST_LOCAL_FUNCTION_AUX_NAME_PARSE_RECURSIVE_(qualified_name) \
+#define BOOST_LOCAL_FUNCTION_AUX_NAME_PARSE_RECURSIVE_( \
+ typename01, qualified_name) \
BOOST_PP_IIF(BOOST_LOCAL_FUNCTION_AUX_NAME_IS_RECURSIVE_(qualified_name), \
/* recursion can never be inlined (not even on C++11) */ \
BOOST_LOCAL_FUNCTION_AUX_NAME_RECURSIVE_ \
, \
BOOST_LOCAL_FUNCTION_AUX_NAME_PARSE_INLINE_ \
- )(BOOST_LOCAL_FUNCTION_AUX_NAME_RECURSIVE_REMOVE_(qualified_name))
+ )(typename01, \
+ BOOST_LOCAL_FUNCTION_AUX_NAME_RECURSIVE_REMOVE_(qualified_name))
// PUBLIC //
-#define BOOST_LOCAL_FUNCTION_AUX_NAME(qualified_name) \
- BOOST_LOCAL_FUNCTION_AUX_NAME_PARSE_RECURSIVE_(qualified_name)
+#define BOOST_LOCAL_FUNCTION_AUX_NAME(typename01, qualified_name) \
+ BOOST_LOCAL_FUNCTION_AUX_NAME_PARSE_RECURSIVE_(typename01, qualified_name)
#endif // #include guard
Modified: trunk/boost/local_function/aux_/nobind.hpp
==============================================================================
--- trunk/boost/local_function/aux_/nobind.hpp (original)
+++ trunk/boost/local_function/aux_/nobind.hpp 2012-04-04 15:35:34 EDT (Wed, 04 Apr 2012)
@@ -8,11 +8,11 @@
#ifndef BOOST_LOCAL_FUNCTION_AUX_NOBIND_HPP_
#define BOOST_LOCAL_FUNCTION_AUX_NOBIND_HPP_
-#include <boost/local_function/aux_/config.hpp>
+#include <boost/local_function/config.hpp>
// NOTE: The current implementation needs no-bind placeholders only when
// local types cannot be passed as template parameters.
-#if !BOOST_LOCAL_FUNCTION_AUX_CONFIG_LOCALS_AS_TPARAMS_01
+#if !BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS
namespace boost { namespace local_function { namespace aux {
Modified: trunk/boost/local_function/config.hpp
==============================================================================
--- trunk/boost/local_function/config.hpp (original)
+++ trunk/boost/local_function/config.hpp 2012-04-04 15:35:34 EDT (Wed, 04 Apr 2012)
@@ -10,12 +10,30 @@
#ifndef DOXYGEN
+#include <boost/config.hpp>
+
#ifndef BOOST_LOCAL_FUNCTION_CONFIG_FUNCTION_ARITY_MAX
-#define BOOST_LOCAL_FUNCTION_CONFIG_FUNCTION_ARITY_MAX 5
+# define BOOST_LOCAL_FUNCTION_CONFIG_FUNCTION_ARITY_MAX 5
#endif
#ifndef BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX
-#define BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX 10
+# define BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX 10
+#endif
+
+#ifndef BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS
+# ifdef BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS
+# define BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS 0
+# else
+# define BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS 1
+# endif
+#elif BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS // If true, force it to 1.
+# undef BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS
+# define BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS 1
+#endif
+#if BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS
+# warning "locals as tparams"
+#else
+# warning "no locals as tparams"
#endif
#else // DOXYGEN
@@ -57,6 +75,14 @@
*/
#define BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX
+/**
+Control performance optimizations.
+Automatically set using Boost.Config BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS
+if not defined by user.
+0 - no optimization, 1 - optimization.
+*/
+#define BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS
+
#endif // DOXYGEN
#endif // #include guard
Modified: trunk/libs/local_function/example/expensive_copy_local_function.cpp
==============================================================================
--- trunk/libs/local_function/example/expensive_copy_local_function.cpp (original)
+++ trunk/libs/local_function/example/expensive_copy_local_function.cpp 2012-04-04 15:35:34 EDT (Wed, 04 Apr 2012)
@@ -6,6 +6,8 @@
// Home at http://www.boost.org/libs/local_function
#include <boost/local_function.hpp>
+#include <boost/typeof/typeof.hpp>
+#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
#include <iostream>
#include <cassert>
@@ -17,6 +19,7 @@
for (unsigned i = 0; i < 10000; ++i) std::cout << '.';
}
};
+BOOST_TYPEOF_REGISTER_TYPE(n) // Register for `bind& x` below.
int main(void) {
n x(-1);
Modified: trunk/libs/local_function/example/n2529_this.cpp
==============================================================================
--- trunk/libs/local_function/example/n2529_this.cpp (original)
+++ trunk/libs/local_function/example/n2529_this.cpp 2012-04-04 15:35:34 EDT (Wed, 04 Apr 2012)
@@ -6,10 +6,15 @@
// Home at http://www.boost.org/libs/local_function
#include <boost/local_function.hpp>
+#include <boost/typeof/typeof.hpp>
+#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
#include <boost/detail/lightweight_test.hpp>
#include <vector>
#include <algorithm>
+struct v;
+BOOST_TYPEOF_REGISTER_TYPE(v) // Register before `bind this_` below.
+
struct v {
std::vector<int> nums;
Modified: trunk/libs/local_function/example/n2550_find_if.cpp
==============================================================================
--- trunk/libs/local_function/example/n2550_find_if.cpp (original)
+++ trunk/libs/local_function/example/n2550_find_if.cpp 2012-04-04 15:35:34 EDT (Wed, 04 Apr 2012)
@@ -6,6 +6,8 @@
// Home at http://www.boost.org/libs/local_function
#include <boost/local_function.hpp>
+#include <boost/typeof/typeof.hpp>
+#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
#include <boost/detail/lightweight_test.hpp>
#include <vector>
#include <algorithm>
@@ -14,6 +16,7 @@
int salary;
explicit employee(const int& a_salary): salary(a_salary) {}
};
+BOOST_TYPEOF_REGISTER_TYPE(employee) // Register for `NAME` below.
int main(void) {
std::vector<employee> employees;
Modified: trunk/libs/local_function/example/noncopyable_local_function.cpp
==============================================================================
--- trunk/libs/local_function/example/noncopyable_local_function.cpp (original)
+++ trunk/libs/local_function/example/noncopyable_local_function.cpp 2012-04-04 15:35:34 EDT (Wed, 04 Apr 2012)
@@ -7,6 +7,8 @@
#include <boost/local_function.hpp>
#include <boost/noncopyable.hpp>
+#include <boost/typeof/typeof.hpp>
+#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
#include <cassert>
//[noncopyable_local_function
@@ -14,6 +16,7 @@
int i;
n(int _i): i(_i) {}
};
+BOOST_TYPEOF_REGISTER_TYPE(n) // Register for `bind& x` below.
int main() {
n x(-1);
Modified: trunk/libs/local_function/test/add_template.cpp
==============================================================================
--- trunk/libs/local_function/test/add_template.cpp (original)
+++ trunk/libs/local_function/test/add_template.cpp 2012-04-04 15:35:34 EDT (Wed, 04 Apr 2012)
@@ -19,10 +19,10 @@
T total(const T& x, const T& y, const T& z) {
T sum = T(), factor = 10;
- // Using the `..._TPL` macro.
+ // Must use the `..._TPL` macros within templates.
T BOOST_LOCAL_FUNCTION_TPL(const bind factor, bind& sum, T num) {
return sum += factor * num;
- } BOOST_LOCAL_FUNCTION_NAME(add)
+ } BOOST_LOCAL_FUNCTION_NAME_TPL(add)
add(x);
T nums[2]; nums[0] = y; nums[1] = z;
Modified: trunk/libs/local_function/test/add_template_seq.cpp
==============================================================================
--- trunk/libs/local_function/test/add_template_seq.cpp (original)
+++ trunk/libs/local_function/test/add_template_seq.cpp 2012-04-04 15:35:34 EDT (Wed, 04 Apr 2012)
@@ -15,7 +15,7 @@
T BOOST_LOCAL_FUNCTION_TPL( (const bind factor) (bind& sum) (T num) ) {
return sum += factor * num;
- } BOOST_LOCAL_FUNCTION_NAME(add)
+ } BOOST_LOCAL_FUNCTION_NAME_TPL(add)
add(x);
T nums[2]; nums[0] = y; nums[1] = z;
Modified: trunk/libs/local_function/test/add_this.cpp
==============================================================================
--- trunk/libs/local_function/test/add_this.cpp (original)
+++ trunk/libs/local_function/test/add_this.cpp 2012-04-04 15:35:34 EDT (Wed, 04 Apr 2012)
@@ -11,10 +11,15 @@
#else
#include <boost/local_function.hpp>
+#include <boost/typeof/typeof.hpp>
+#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
#include <boost/detail/lightweight_test.hpp>
#include <vector>
#include <algorithm>
+struct adder;
+BOOST_TYPEOF_REGISTER_TYPE(adder) // Register before `bind this_` below.
+
//[add_this
struct adder {
adder() : sum_(0) {}
Modified: trunk/libs/local_function/test/add_this_seq.cpp
==============================================================================
--- trunk/libs/local_function/test/add_this_seq.cpp (original)
+++ trunk/libs/local_function/test/add_this_seq.cpp 2012-04-04 15:35:34 EDT (Wed, 04 Apr 2012)
@@ -6,10 +6,15 @@
// Home at http://www.boost.org/libs/local_function
#include <boost/local_function.hpp>
+#include <boost/typeof/typeof.hpp>
+#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
#include <boost/detail/lightweight_test.hpp>
#include <vector>
#include <algorithm>
+struct adder;
+BOOST_TYPEOF_REGISTER_TYPE(adder) // Register before `bind this_` below.
+
struct adder {
adder() : sum_(0) {}
Modified: trunk/libs/local_function/test/add_typed.cpp
==============================================================================
--- trunk/libs/local_function/test/add_typed.cpp (original)
+++ trunk/libs/local_function/test/add_typed.cpp 2012-04-04 15:35:34 EDT (Wed, 04 Apr 2012)
@@ -11,20 +11,25 @@
#else
#include <boost/local_function.hpp>
+#include <boost/typeof/typeof.hpp>
+#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
#include <boost/detail/lightweight_test.hpp>
#include <vector>
#include <algorithm>
//[add_typed
+struct adder;
+BOOST_TYPEOF_REGISTER_TYPE(adder) // Unfortunately needed for `..._NAME` below.
+
struct adder {
adder() : sum_(0) {}
int sum(const std::vector<int>& nums, const int& factor = 10) {
- // Explicitly specify bound variable and result types.
+ // Explicitly specify bound variable and result types...
BOOST_LOCAL_FUNCTION(const bind(const int&) factor,
bind(adder*) this_, int num, return int) {
return this_->sum_ += factor * num;
- } BOOST_LOCAL_FUNCTION_NAME(add)
+ } BOOST_LOCAL_FUNCTION_NAME(add) // ... but this still uses type-of.
std::for_each(nums.begin(), nums.end(), add);
return sum_;
Modified: trunk/libs/local_function/test/add_typed_seq.cpp
==============================================================================
--- trunk/libs/local_function/test/add_typed_seq.cpp (original)
+++ trunk/libs/local_function/test/add_typed_seq.cpp 2012-04-04 15:35:34 EDT (Wed, 04 Apr 2012)
@@ -6,10 +6,15 @@
// Home at http://www.boost.org/libs/local_function
#include <boost/local_function.hpp>
+#include <boost/typeof/typeof.hpp>
+#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
#include <boost/detail/lightweight_test.hpp>
#include <vector>
#include <algorithm>
+struct adder;
+BOOST_TYPEOF_REGISTER_TYPE(adder) // Needed for `NAME` below.
+
struct adder {
adder() : sum_(0) {}
Modified: trunk/libs/local_function/test/factorial.cpp
==============================================================================
--- trunk/libs/local_function/test/factorial.cpp (original)
+++ trunk/libs/local_function/test/factorial.cpp 2012-04-04 15:35:34 EDT (Wed, 04 Apr 2012)
@@ -18,7 +18,7 @@
#include <vector>
struct calculator;
-BOOST_TYPEOF_REGISTER_TYPE(calculator) // Register before bind `this_` below.
+BOOST_TYPEOF_REGISTER_TYPE(calculator) // Register before `bind this_` below.
//[factorial
struct calculator {
Modified: trunk/libs/local_function/test/factorial_seq.cpp
==============================================================================
--- trunk/libs/local_function/test/factorial_seq.cpp (original)
+++ trunk/libs/local_function/test/factorial_seq.cpp 2012-04-04 15:35:34 EDT (Wed, 04 Apr 2012)
@@ -13,7 +13,7 @@
#include <vector>
struct calculator;
-BOOST_TYPEOF_REGISTER_TYPE(calculator) // Register before bind `this_` below.
+BOOST_TYPEOF_REGISTER_TYPE(calculator) // Register before `bind this_` below.
struct calculator {
std::vector<int> results;
Modified: trunk/libs/local_function/test/macro_commas.cpp
==============================================================================
--- trunk/libs/local_function/test/macro_commas.cpp (original)
+++ trunk/libs/local_function/test/macro_commas.cpp 2012-04-04 15:35:34 EDT (Wed, 04 Apr 2012)
@@ -12,6 +12,8 @@
#include <boost/local_function.hpp>
#include <boost/utility/identity_type.hpp>
+#include <boost/typeof/std/string.hpp> // Type-of registrations
+#include <boost/typeof/std/map.hpp> // needed for `NAME` macro.
#include <map>
#include <string>
Modified: trunk/libs/local_function/test/macro_commas_seq.cpp
==============================================================================
--- trunk/libs/local_function/test/macro_commas_seq.cpp (original)
+++ trunk/libs/local_function/test/macro_commas_seq.cpp 2012-04-04 15:35:34 EDT (Wed, 04 Apr 2012)
@@ -7,6 +7,8 @@
#include <boost/local_function.hpp>
#include <boost/utility/identity_type.hpp>
+#include <boost/typeof/std/string.hpp> // Type-of registrations
+#include <boost/typeof/std/map.hpp> // needed for `NAME` macro.
#include <boost/config.hpp>
#include <map>
#include <string>
Modified: trunk/libs/local_function/test/operator.cpp
==============================================================================
--- trunk/libs/local_function/test/operator.cpp (original)
+++ trunk/libs/local_function/test/operator.cpp 2012-04-04 15:35:34 EDT (Wed, 04 Apr 2012)
@@ -11,6 +11,8 @@
#else
#include <boost/local_function.hpp>
+#include <boost/typeof/typeof.hpp>
+#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
#include <boost/detail/lightweight_test.hpp>
//[operator
@@ -18,11 +20,12 @@
int x;
int y;
};
+BOOST_TYPEOF_REGISTER_TYPE(point) // Register for `NAME` below.
int main(void) {
bool BOOST_LOCAL_FUNCTION(const point& p, const point& q) {
return p.x == q.x && p.y == q.y;
- } BOOST_LOCAL_FUNCTION_NAME(equal) // OK: not using `operator...`.
+ } BOOST_LOCAL_FUNCTION_NAME(equal) // OK: not using `operator==`.
point a; a.x = 1; a.y = 2;
point b = a;
Modified: trunk/libs/local_function/test/operator_error.cpp
==============================================================================
--- trunk/libs/local_function/test/operator_error.cpp (original)
+++ trunk/libs/local_function/test/operator_error.cpp 2012-04-04 15:35:34 EDT (Wed, 04 Apr 2012)
@@ -11,6 +11,8 @@
#else
#include <boost/local_function.hpp>
+#include <boost/typeof/typeof.hpp>
+#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
#include <boost/detail/lightweight_test.hpp>
//[operator_error
@@ -18,6 +20,7 @@
int x;
int y;
};
+BOOST_TYPEOF_REGISTER_TYPE(point) // Register for `NAME` below.
int main(void) {
bool BOOST_LOCAL_FUNCTION(const point& p, const point& q) {
Modified: trunk/libs/local_function/test/operator_error_seq.cpp
==============================================================================
--- trunk/libs/local_function/test/operator_error_seq.cpp (original)
+++ trunk/libs/local_function/test/operator_error_seq.cpp 2012-04-04 15:35:34 EDT (Wed, 04 Apr 2012)
@@ -6,12 +6,15 @@
// Home at http://www.boost.org/libs/local_function
#include <boost/local_function.hpp>
+#include <boost/typeof/typeof.hpp>
+#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
#include <boost/detail/lightweight_test.hpp>
struct point {
int x;
int y;
};
+BOOST_TYPEOF_REGISTER_TYPE(point) // Register for `NAME` below.
int main(void) {
bool BOOST_LOCAL_FUNCTION( (const point& p) (const point& q) ) {
Modified: trunk/libs/local_function/test/operator_seq.cpp
==============================================================================
--- trunk/libs/local_function/test/operator_seq.cpp (original)
+++ trunk/libs/local_function/test/operator_seq.cpp 2012-04-04 15:35:34 EDT (Wed, 04 Apr 2012)
@@ -6,12 +6,15 @@
// Home at http://www.boost.org/libs/local_function
#include <boost/local_function.hpp>
+#include <boost/typeof/typeof.hpp>
+#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
#include <boost/detail/lightweight_test.hpp>
struct point {
int x;
int y;
};
+BOOST_TYPEOF_REGISTER_TYPE(point) // Register for `NAME` below.
int main(void) {
bool BOOST_LOCAL_FUNCTION( (const point& p) (const point& q) ) {
Modified: trunk/libs/local_function/test/overload.cpp
==============================================================================
--- trunk/libs/local_function/test/overload.cpp (original)
+++ trunk/libs/local_function/test/overload.cpp 2012-04-04 15:35:34 EDT (Wed, 04 Apr 2012)
@@ -12,6 +12,7 @@
#include <boost/local_function.hpp>
#include <boost/functional/overloaded_function.hpp> // For overloading.
+#include <boost/typeof/std/string.hpp>
#include <boost/detail/lightweight_test.hpp>
#include <string>
#include <cmath>
Modified: trunk/libs/local_function/test/overload_seq.cpp
==============================================================================
--- trunk/libs/local_function/test/overload_seq.cpp (original)
+++ trunk/libs/local_function/test/overload_seq.cpp 2012-04-04 15:35:34 EDT (Wed, 04 Apr 2012)
@@ -7,6 +7,7 @@
#include <boost/local_function.hpp>
#include <boost/functional/overloaded_function.hpp>
+#include <boost/typeof/std/string.hpp>
#include <boost/detail/lightweight_test.hpp>
#include <string>
#include <cmath>
Modified: trunk/libs/local_function/test/return_derivative.cpp
==============================================================================
--- trunk/libs/local_function/test/return_derivative.cpp (original)
+++ trunk/libs/local_function/test/return_derivative.cpp 2012-04-04 15:35:34 EDT (Wed, 04 Apr 2012)
@@ -12,8 +12,12 @@
#include <boost/local_function.hpp>
#include <boost/function.hpp>
+#include <boost/typeof/typeof.hpp>
+#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
#include <boost/detail/lightweight_test.hpp>
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function, 1)
+
boost::function<int (int)> derivative(boost::function<int (int)>& f, int dx) {
int BOOST_LOCAL_FUNCTION(bind& f, const bind dx, int x) {
return (f(x + dx) - f(x)) / dx;
Modified: trunk/libs/local_function/test/return_derivative_seq.cpp
==============================================================================
--- trunk/libs/local_function/test/return_derivative_seq.cpp (original)
+++ trunk/libs/local_function/test/return_derivative_seq.cpp 2012-04-04 15:35:34 EDT (Wed, 04 Apr 2012)
@@ -7,8 +7,12 @@
#include <boost/local_function.hpp>
#include <boost/function.hpp>
+#include <boost/typeof/typeof.hpp>
+#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
#include <boost/detail/lightweight_test.hpp>
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function, 1)
+
boost::function<int (int)> derivative(boost::function<int (int)>& f, int dx) {
int BOOST_LOCAL_FUNCTION( (bind& f) (const bind dx) (int x) ) {
return (f(x + dx) - f(x)) / dx;
Modified: trunk/libs/local_function/test/return_setget.cpp
==============================================================================
--- trunk/libs/local_function/test/return_setget.cpp (original)
+++ trunk/libs/local_function/test/return_setget.cpp 2012-04-04 15:35:34 EDT (Wed, 04 Apr 2012)
@@ -12,6 +12,7 @@
#include <boost/local_function.hpp>
#include <boost/function.hpp>
+#include <boost/typeof/std/string.hpp>
#include <boost/detail/lightweight_test.hpp>
#include <string>
Modified: trunk/libs/local_function/test/return_setget_seq.cpp
==============================================================================
--- trunk/libs/local_function/test/return_setget_seq.cpp (original)
+++ trunk/libs/local_function/test/return_setget_seq.cpp 2012-04-04 15:35:34 EDT (Wed, 04 Apr 2012)
@@ -7,6 +7,7 @@
#include <boost/local_function.hpp>
#include <boost/function.hpp>
+#include <boost/typeof/std/string.hpp>
#include <boost/detail/lightweight_test.hpp>
#include <string>
Modified: trunk/libs/local_function/test/return_this.cpp
==============================================================================
--- trunk/libs/local_function/test/return_this.cpp (original)
+++ trunk/libs/local_function/test/return_this.cpp 2012-04-04 15:35:34 EDT (Wed, 04 Apr 2012)
@@ -12,8 +12,13 @@
#include <boost/local_function.hpp>
#include <boost/function.hpp>
+#include <boost/typeof/typeof.hpp>
+#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
#include <boost/detail/lightweight_test.hpp>
+struct number;
+BOOST_TYPEOF_REGISTER_TYPE(number) // Register before `bind this_` below.
+
struct number {
number(int value) : value_(value) {}
Modified: trunk/libs/local_function/test/return_this_seq.cpp
==============================================================================
--- trunk/libs/local_function/test/return_this_seq.cpp (original)
+++ trunk/libs/local_function/test/return_this_seq.cpp 2012-04-04 15:35:34 EDT (Wed, 04 Apr 2012)
@@ -7,8 +7,13 @@
#include <boost/local_function.hpp>
#include <boost/function.hpp>
+#include <boost/typeof/typeof.hpp>
+#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
#include <boost/detail/lightweight_test.hpp>
+struct number;
+BOOST_TYPEOF_REGISTER_TYPE(number) // Register before `bind this_` below.
+
struct number {
number(int value) : value_(value) {}
Modified: trunk/libs/local_function/test/typeof_template.cpp
==============================================================================
--- trunk/libs/local_function/test/typeof_template.cpp (original)
+++ trunk/libs/local_function/test/typeof_template.cpp 2012-04-04 15:35:34 EDT (Wed, 04 Apr 2012)
@@ -27,7 +27,7 @@
BOOST_CONCEPT_ASSERT((Addable<typename boost::remove_reference<
BOOST_LOCAL_FUNCTION_TYPEOF(sum)>::type>));
sum += factor * num;
- } BOOST_LOCAL_FUNCTION_NAME(add)
+ } BOOST_LOCAL_FUNCTION_NAME_TPL(add)
add(6);
return sum;
Modified: trunk/libs/local_function/test/typeof_template_seq.cpp
==============================================================================
--- trunk/libs/local_function/test/typeof_template_seq.cpp (original)
+++ trunk/libs/local_function/test/typeof_template_seq.cpp 2012-04-04 15:35:34 EDT (Wed, 04 Apr 2012)
@@ -20,7 +20,7 @@
BOOST_CONCEPT_ASSERT((Addable<typename boost::remove_reference<
BOOST_LOCAL_FUNCTION_TYPEOF(sum)>::type>));
sum += factor * num;
- } BOOST_LOCAL_FUNCTION_NAME(add)
+ } BOOST_LOCAL_FUNCTION_NAME_TPL(add)
add(6);
return sum;
Modified: trunk/libs/scope_exit/example/scope_guard.cpp
==============================================================================
--- trunk/libs/scope_exit/example/scope_guard.cpp (original)
+++ trunk/libs/scope_exit/example/scope_guard.cpp 2012-04-04 15:35:34 EDT (Wed, 04 Apr 2012)
@@ -12,6 +12,8 @@
#else
#include <boost/scope_exit.hpp>
+#include <boost/typeof/std/string.hpp>
+#include <boost/typeof/std/map.hpp>
#include <map>
#include <string>
#include <utility>
Modified: trunk/libs/scope_exit/example/scope_guard_seq.cpp
==============================================================================
--- trunk/libs/scope_exit/example/scope_guard_seq.cpp (original)
+++ trunk/libs/scope_exit/example/scope_guard_seq.cpp 2012-04-04 15:35:34 EDT (Wed, 04 Apr 2012)
@@ -7,6 +7,8 @@
// Home at http://www.boost.org/libs/scope_exit
#include <boost/scope_exit.hpp>
+#include <boost/typeof/std/string.hpp>
+#include <boost/typeof/std/map.hpp>
#include <map>
#include <string>
#include <utility>
@@ -21,8 +23,7 @@
BOOST_SCOPE_EXIT( (currency_rate_inserted) (&commit) (&rates)
(¤cy) ) {
- if(currency_rate_inserted && !commit)
- rates.erase(currency);
+ if(currency_rate_inserted && !commit) rates.erase(currency);
} BOOST_SCOPE_EXIT_END
// ...
Modified: trunk/libs/scope_exit/example/try_catch.cpp
==============================================================================
--- trunk/libs/scope_exit/example/try_catch.cpp (original)
+++ trunk/libs/scope_exit/example/try_catch.cpp 2012-04-04 15:35:34 EDT (Wed, 04 Apr 2012)
@@ -12,6 +12,8 @@
#else
#include <boost/scope_exit.hpp>
+#include <boost/typeof/typeof.hpp>
+#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
#include <iostream>
struct file {
@@ -25,6 +27,7 @@
private:
bool open_;
};
+BOOST_TYPEOF_REGISTER_TYPE(file)
void bad(void) {
//[try_catch_bad
Modified: trunk/libs/scope_exit/example/try_catch_seq.cpp
==============================================================================
--- trunk/libs/scope_exit/example/try_catch_seq.cpp (original)
+++ trunk/libs/scope_exit/example/try_catch_seq.cpp 2012-04-04 15:35:34 EDT (Wed, 04 Apr 2012)
@@ -7,6 +7,8 @@
// Home at http://www.boost.org/libs/scope_exit
#include <boost/scope_exit.hpp>
+#include <boost/typeof/typeof.hpp>
+#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
#include <iostream>
struct file {
@@ -20,6 +22,7 @@
private:
bool open_;
};
+BOOST_TYPEOF_REGISTER_TYPE(file)
void bad(void) {
//[try_catch_bad_seq
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