diff --git a/include/boost/function/detail/prologue.hpp b/include/boost/function/detail/prologue.hpp index 84823a8..1028ec8 100644 --- a/include/boost/function/detail/prologue.hpp +++ b/include/boost/function/detail/prologue.hpp @@ -9,4 +9,5 @@ # include # include # include +# include #endif // BOOST_FUNCTION_PROLOGUE_HPP diff --git a/include/boost/function/function_template.hpp b/include/boost/function/function_template.hpp index 16fd56f..febd1bf 100644 --- a/include/boost/function/function_template.hpp +++ b/include/boost/function/function_template.hpp @@ -14,7 +14,7 @@ // For more information, see http://www.boost.org // Note: this header is a header template and must NOT have multiple-inclusion -// protection. +// protection. #include #define BOOST_FUNCTION_TEMPLATE_PARMS BOOST_PP_ENUM_PARAMS(BOOST_FUNCTION_NUM_ARGS, typename T) @@ -31,7 +31,7 @@ #define BOOST_FUNCTION_ARG_TYPE(J,I,D) \ typedef BOOST_PP_CAT(T,I) BOOST_PP_CAT(arg, BOOST_PP_CAT(BOOST_PP_INC(I),_type)); -#define BOOST_FUNCTION_ARG_TYPES BOOST_PP_REPEAT(BOOST_FUNCTION_NUM_ARGS,BOOST_FUNCTION_ARG_TYPE,) +#define BOOST_FUNCTION_ARG_TYPES BOOST_PP_REPEAT(BOOST_FUNCTION_NUM_ARGS,BOOST_FUNCTION_ARG_TYPE,BOOST_PP_EMPTY) // Type of the default allocator #ifndef BOOST_NO_STD_ALLOCATOR @@ -42,7 +42,7 @@ // Comma if nonzero number of arguments #if BOOST_FUNCTION_NUM_ARGS == 0 -# define BOOST_FUNCTION_COMMA +# define BOOST_FUNCTION_COMMA #else # define BOOST_FUNCTION_COMMA , #endif // BOOST_FUNCTION_NUM_ARGS > 0 @@ -52,7 +52,7 @@ #define BOOST_FUNCTION_FUNCTION_INVOKER \ BOOST_JOIN(function_invoker,BOOST_FUNCTION_NUM_ARGS) #define BOOST_FUNCTION_VOID_FUNCTION_INVOKER \ - BOOST_JOIN(void_function_invoker,BOOST_FUNCTION_NUM_ARGS) + BOOST_JOIN(void_function_invoker,BOOST_FUNCTION_NUM_ARGS) #define BOOST_FUNCTION_FUNCTION_OBJ_INVOKER \ BOOST_JOIN(function_obj_invoker,BOOST_FUNCTION_NUM_ARGS) #define BOOST_FUNCTION_VOID_FUNCTION_OBJ_INVOKER \ @@ -126,7 +126,7 @@ namespace boost { > struct BOOST_FUNCTION_VOID_FUNCTION_OBJ_INVOKER { - static unusable invoke(any_pointer function_obj_ptr + static unusable invoke(any_pointer function_obj_ptr BOOST_FUNCTION_COMMA BOOST_FUNCTION_PARMS) @@ -158,7 +158,7 @@ namespace boost { > struct BOOST_FUNCTION_STATELESS_VOID_FUNCTION_OBJ_INVOKER { - static unusable invoke(any_pointer BOOST_FUNCTION_COMMA + static unusable invoke(any_pointer BOOST_FUNCTION_COMMA BOOST_FUNCTION_PARMS) { @@ -241,12 +241,12 @@ namespace boost { > class BOOST_FUNCTION_FUNCTION : public function_base { - typedef typename detail::function::function_return_type::type + typedef typename detail::function::function_return_type::type internal_result_type; public: BOOST_STATIC_CONSTANT(int, args = BOOST_FUNCTION_NUM_ARGS); - + #if BOOST_FUNCTION_NUM_ARGS == 1 typedef T0 argument_type; #elif BOOST_FUNCTION_NUM_ARGS == 2 @@ -272,7 +272,7 @@ namespace boost { // one with a default parameter. template BOOST_FUNCTION_FUNCTION(Functor BOOST_FUNCTION_TARGET_FIX(const &) f) : - function_base(), + function_base(), invoker(0) { this->assign_to(f); @@ -291,7 +291,7 @@ namespace boost { { assert(!this->empty()); - internal_result_type result = invoker(function_base::functor + internal_result_type result = invoker(function_base::functor BOOST_FUNCTION_COMMA BOOST_FUNCTION_ARGS); @@ -305,10 +305,10 @@ namespace boost { // The distinction between when to use BOOST_FUNCTION_FUNCTION and // when to use self_type is obnoxious. MSVC cannot handle self_type as // the return type of these assignment operators, but Borland C++ cannot - // handle BOOST_FUNCTION_FUNCTION as the type of the temporary to + // handle BOOST_FUNCTION_FUNCTION as the type of the temporary to // construct. template - BOOST_FUNCTION_FUNCTION& + BOOST_FUNCTION_FUNCTION& operator=(Functor BOOST_FUNCTION_TARGET_FIX(const &) f) { self_type(f).swap(*this); @@ -339,8 +339,8 @@ namespace boost { void clear() { if (function_base::manager) { - function_base::functor = - function_base::manager(function_base::functor, + function_base::functor = + function_base::manager(function_base::functor, detail::function::destroy_functor_tag); } @@ -360,7 +360,7 @@ namespace boost { typedef void (dummy::*safe_bool)(); public: - operator safe_bool () const + operator safe_bool () const { return (this->empty())? 0 : &dummy::nonnull; } bool operator!() const @@ -373,9 +373,9 @@ namespace boost { if (!f.empty()) { invoker = f.invoker; function_base::manager = f.manager; - function_base::functor = + function_base::functor = f.manager(f.functor, detail::function::clone_functor_tag); - } + } } template @@ -389,7 +389,7 @@ namespace boost { void assign_to(FunctionPtr f, detail::function::function_ptr_tag) { clear(); - + if (f) { typedef typename detail::function::BOOST_FUNCTION_GET_FUNCTION_INVOKER< FunctionPtr, @@ -397,11 +397,11 @@ namespace boost { BOOST_FUNCTION_TEMPLATE_ARGS >::type invoker_type; - + invoker = &invoker_type::invoke; - function_base::manager = + function_base::manager = &detail::function::functor_manager::manage; - function_base::functor = + function_base::functor = function_base::manager(detail::function::make_any_pointer( // should be a reinterpret cast, but some compilers // insist on giving cv-qualifiers to free functions @@ -409,7 +409,7 @@ namespace boost { ), detail::function::clone_functor_tag); } - } + } #if BOOST_FUNCTION_NUM_ARGS > 0 template @@ -418,24 +418,24 @@ namespace boost { this->assign_to(mem_fn(f)); } #endif // BOOST_FUNCTION_NUM_ARGS > 0 - + template void assign_to(FunctionObj f, detail::function::function_obj_tag) { if (!detail::function::has_empty_target(addressof(f))) { - typedef + typedef typename detail::function::BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER< FunctionObj, R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_ARGS >::type invoker_type; - + invoker = &invoker_type::invoke; function_base::manager = &detail::function::functor_manager< FunctionObj, Allocator>::manage; #ifndef BOOST_NO_STD_ALLOCATOR - typedef typename Allocator::template rebind::other + typedef typename Allocator::template rebind::other allocator_type; typedef typename allocator_type::pointer pointer_type; allocator_type allocator; @@ -447,38 +447,38 @@ namespace boost { #else FunctionObj* new_f = new FunctionObj(f); #endif // BOOST_NO_STD_ALLOCATOR - function_base::functor = + function_base::functor = detail::function::make_any_pointer(static_cast(new_f)); } } - + template - void assign_to(const reference_wrapper& f, + void assign_to(const reference_wrapper& f, detail::function::function_obj_ref_tag) { if (!detail::function::has_empty_target(f.get_pointer())) { - typedef + typedef typename detail::function::BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER< FunctionObj, R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_ARGS >::type invoker_type; - + invoker = &invoker_type::invoke; function_base::manager = &detail::function::trivial_manager; - function_base::functor = + function_base::functor = function_base::manager( detail::function::make_any_pointer( const_cast(f.get_pointer())), detail::function::clone_functor_tag); } } - + template void assign_to(FunctionObj, detail::function::stateless_function_obj_tag) { - typedef + typedef typename detail::function:: BOOST_FUNCTION_GET_STATELESS_FUNCTION_OBJ_INVOKER< FunctionObj, @@ -494,7 +494,7 @@ namespace boost { typedef internal_result_type (*invoker_type)(detail::function::any_pointer BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_ARGS); - + invoker_type invoker; }; @@ -506,7 +506,7 @@ namespace boost { Allocator >& f1, BOOST_FUNCTION_FUNCTION< - R BOOST_FUNCTION_COMMA + R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_ARGS, Allocator >& f2) @@ -518,7 +518,7 @@ namespace boost { #if BOOST_FUNCTION_NUM_ARGS == 0 #define BOOST_FUNCTION_PARTIAL_SPEC R (void) -#else +#else #define BOOST_FUNCTION_PARTIAL_SPEC R (BOOST_PP_ENUM_PARAMS(BOOST_FUNCTION_NUM_ARGS,T)) #endif @@ -526,10 +526,10 @@ template class function - : public BOOST_FUNCTION_FUNCTION { - typedef BOOST_FUNCTION_FUNCTION base_type; typedef function self_type; @@ -538,11 +538,11 @@ public: function() : base_type() {} - template + template function(Functor BOOST_FUNCTION_TARGET_FIX(const &) f) : base_type(f) {} - + function(const self_type& f) : base_type(static_cast(f)){} - + template self_type& operator=(Functor BOOST_FUNCTION_TARGET_FIX(const &) f) { @@ -557,7 +557,7 @@ public: } self_type& operator=(const self_type& f) - { + { self_type(f).swap(*this); return *this; }