From 52ff7423b7507c733298d13aabcef045dde15bb9 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Sun, 28 Jan 2024 03:02:55 +0200 Subject: [PATCH] Remove uses of BOOST_FUNCTION_COMMA --- include/boost/function/function_template.hpp | 130 +++++++++---------- 1 file changed, 63 insertions(+), 67 deletions(-) diff --git a/include/boost/function/function_template.hpp b/include/boost/function/function_template.hpp index 6d8e4d0..796cf6c 100644 --- a/include/boost/function/function_template.hpp +++ b/include/boost/function/function_template.hpp @@ -23,9 +23,6 @@ #define BOOST_FUNCTION_PARMS T... a #define BOOST_FUNCTION_ARGS static_cast(a)... -// Always have commas (zero args case is handled with variadics too) -#define BOOST_FUNCTION_COMMA , - #define BOOST_FUNCTION_VOID_RETURN_TYPE void #define BOOST_FUNCTION_RETURN(X) X @@ -34,12 +31,12 @@ namespace boost { namespace function { template< typename FunctionPtr, - typename R BOOST_FUNCTION_COMMA + typename R, BOOST_FUNCTION_TEMPLATE_PARMS > struct function_invoker { - static R invoke(function_buffer& function_ptr BOOST_FUNCTION_COMMA + static R invoke(function_buffer& function_ptr, BOOST_FUNCTION_PARMS) { FunctionPtr f = reinterpret_cast(function_ptr.members.func_ptr); @@ -49,13 +46,13 @@ namespace boost { template< typename FunctionPtr, - typename R BOOST_FUNCTION_COMMA + typename R, BOOST_FUNCTION_TEMPLATE_PARMS > struct void_function_invoker { static BOOST_FUNCTION_VOID_RETURN_TYPE - invoke(function_buffer& function_ptr BOOST_FUNCTION_COMMA + invoke(function_buffer& function_ptr, BOOST_FUNCTION_PARMS) { @@ -66,12 +63,12 @@ namespace boost { template< typename FunctionObj, - typename R BOOST_FUNCTION_COMMA + typename R, BOOST_FUNCTION_TEMPLATE_PARMS > struct function_obj_invoker { - static R invoke(function_buffer& function_obj_ptr BOOST_FUNCTION_COMMA + static R invoke(function_buffer& function_obj_ptr, BOOST_FUNCTION_PARMS) { @@ -86,13 +83,13 @@ namespace boost { template< typename FunctionObj, - typename R BOOST_FUNCTION_COMMA + typename R, BOOST_FUNCTION_TEMPLATE_PARMS > struct void_function_obj_invoker { static BOOST_FUNCTION_VOID_RETURN_TYPE - invoke(function_buffer& function_obj_ptr BOOST_FUNCTION_COMMA + invoke(function_buffer& function_obj_ptr, BOOST_FUNCTION_PARMS) { @@ -107,12 +104,12 @@ namespace boost { template< typename FunctionObj, - typename R BOOST_FUNCTION_COMMA + typename R, BOOST_FUNCTION_TEMPLATE_PARMS > struct function_ref_invoker { - static R invoke(function_buffer& function_obj_ptr BOOST_FUNCTION_COMMA + static R invoke(function_buffer& function_obj_ptr, BOOST_FUNCTION_PARMS) { @@ -124,13 +121,13 @@ namespace boost { template< typename FunctionObj, - typename R BOOST_FUNCTION_COMMA + typename R, BOOST_FUNCTION_TEMPLATE_PARMS > struct void_function_ref_invoker { static BOOST_FUNCTION_VOID_RETURN_TYPE - invoke(function_buffer& function_obj_ptr BOOST_FUNCTION_COMMA + invoke(function_buffer& function_obj_ptr, BOOST_FUNCTION_PARMS) { @@ -144,12 +141,12 @@ namespace boost { /* Handle invocation of member pointers. */ template< typename MemberPtr, - typename R BOOST_FUNCTION_COMMA + typename R, BOOST_FUNCTION_TEMPLATE_PARMS > struct member_invoker { - static R invoke(function_buffer& function_obj_ptr BOOST_FUNCTION_COMMA + static R invoke(function_buffer& function_obj_ptr, BOOST_FUNCTION_PARMS) { @@ -161,13 +158,13 @@ namespace boost { template< typename MemberPtr, - typename R BOOST_FUNCTION_COMMA + typename R, BOOST_FUNCTION_TEMPLATE_PARMS > struct void_member_invoker { static BOOST_FUNCTION_VOID_RETURN_TYPE - invoke(function_buffer& function_obj_ptr BOOST_FUNCTION_COMMA + invoke(function_buffer& function_obj_ptr, BOOST_FUNCTION_PARMS) { @@ -180,7 +177,7 @@ namespace boost { template< typename FunctionPtr, - typename R BOOST_FUNCTION_COMMA + typename R, BOOST_FUNCTION_TEMPLATE_PARMS > struct get_function_invoker @@ -188,12 +185,12 @@ namespace boost { typedef typename conditional<(is_void::value), void_function_invoker< FunctionPtr, - R BOOST_FUNCTION_COMMA + R, BOOST_FUNCTION_TEMPLATE_ARGS >, function_invoker< FunctionPtr, - R BOOST_FUNCTION_COMMA + R, BOOST_FUNCTION_TEMPLATE_ARGS > >::type type; @@ -201,7 +198,7 @@ namespace boost { template< typename FunctionObj, - typename R BOOST_FUNCTION_COMMA + typename R, BOOST_FUNCTION_TEMPLATE_PARMS > struct get_function_obj_invoker @@ -209,12 +206,12 @@ namespace boost { typedef typename conditional<(is_void::value), void_function_obj_invoker< FunctionObj, - R BOOST_FUNCTION_COMMA + R, BOOST_FUNCTION_TEMPLATE_ARGS >, function_obj_invoker< FunctionObj, - R BOOST_FUNCTION_COMMA + R, BOOST_FUNCTION_TEMPLATE_ARGS > >::type type; @@ -222,7 +219,7 @@ namespace boost { template< typename FunctionObj, - typename R BOOST_FUNCTION_COMMA + typename R, BOOST_FUNCTION_TEMPLATE_PARMS > struct get_function_ref_invoker @@ -230,12 +227,12 @@ namespace boost { typedef typename conditional<(is_void::value), void_function_ref_invoker< FunctionObj, - R BOOST_FUNCTION_COMMA + R, BOOST_FUNCTION_TEMPLATE_ARGS >, function_ref_invoker< FunctionObj, - R BOOST_FUNCTION_COMMA + R, BOOST_FUNCTION_TEMPLATE_ARGS > >::type type; @@ -245,7 +242,7 @@ namespace boost { /* Retrieve the appropriate invoker for a member pointer. */ template< typename MemberPtr, - typename R BOOST_FUNCTION_COMMA + typename R, BOOST_FUNCTION_TEMPLATE_PARMS > struct get_member_invoker @@ -253,12 +250,12 @@ namespace boost { typedef typename conditional<(is_void::value), void_member_invoker< MemberPtr, - R BOOST_FUNCTION_COMMA + R, BOOST_FUNCTION_TEMPLATE_ARGS >, member_invoker< MemberPtr, - R BOOST_FUNCTION_COMMA + R, BOOST_FUNCTION_TEMPLATE_ARGS > >::type type; @@ -282,12 +279,12 @@ namespace boost { struct get_invoker { template + typename R, BOOST_FUNCTION_TEMPLATE_PARMS> struct apply { typedef typename get_function_invoker< FunctionPtr, - R BOOST_FUNCTION_COMMA + R, BOOST_FUNCTION_TEMPLATE_ARGS >::type invoker_type; @@ -296,12 +293,12 @@ namespace boost { }; template + typename R, BOOST_FUNCTION_TEMPLATE_PARMS> struct apply_a { typedef typename get_function_invoker< FunctionPtr, - R BOOST_FUNCTION_COMMA + R, BOOST_FUNCTION_TEMPLATE_ARGS >::type invoker_type; @@ -316,12 +313,12 @@ namespace boost { struct get_invoker { template + typename R, BOOST_FUNCTION_TEMPLATE_PARMS> struct apply { typedef typename get_member_invoker< MemberPtr, - R BOOST_FUNCTION_COMMA + R, BOOST_FUNCTION_TEMPLATE_ARGS >::type invoker_type; @@ -330,12 +327,12 @@ namespace boost { }; template + typename R, BOOST_FUNCTION_TEMPLATE_PARMS> struct apply_a { typedef typename get_member_invoker< MemberPtr, - R BOOST_FUNCTION_COMMA + R, BOOST_FUNCTION_TEMPLATE_ARGS >::type invoker_type; @@ -350,12 +347,12 @@ namespace boost { struct get_invoker { template + typename R, BOOST_FUNCTION_TEMPLATE_PARMS> struct apply { typedef typename get_function_obj_invoker< FunctionObj, - R BOOST_FUNCTION_COMMA + R, BOOST_FUNCTION_TEMPLATE_ARGS >::type invoker_type; @@ -364,12 +361,12 @@ namespace boost { }; template + typename R, BOOST_FUNCTION_TEMPLATE_PARMS> struct apply_a { typedef typename get_function_obj_invoker< FunctionObj, - R BOOST_FUNCTION_COMMA + R, BOOST_FUNCTION_TEMPLATE_ARGS >::type invoker_type; @@ -383,12 +380,12 @@ namespace boost { struct get_invoker { template + typename R, BOOST_FUNCTION_TEMPLATE_PARMS> struct apply { typedef typename get_function_ref_invoker< typename RefWrapper::type, - R BOOST_FUNCTION_COMMA + R, BOOST_FUNCTION_TEMPLATE_ARGS >::type invoker_type; @@ -397,12 +394,12 @@ namespace boost { }; template + typename R, BOOST_FUNCTION_TEMPLATE_PARMS> struct apply_a { typedef typename get_function_ref_invoker< typename RefWrapper::type, - R BOOST_FUNCTION_COMMA + R, BOOST_FUNCTION_TEMPLATE_ARGS >::type invoker_type; @@ -419,13 +416,13 @@ namespace boost { * members. It therefore cannot have any constructors, * destructors, base classes, etc. */ - template + template struct basic_vtable { typedef R result_type; typedef result_type (*invoker_type)(function_buffer& - BOOST_FUNCTION_COMMA + , BOOST_FUNCTION_TEMPLATE_ARGS); template @@ -617,7 +614,7 @@ namespace boost { } // end namespace detail template< - typename R BOOST_FUNCTION_COMMA + typename R, BOOST_FUNCTION_TEMPLATE_PARMS > class function_n : public function_base @@ -628,7 +625,7 @@ namespace boost { private: typedef boost::detail::function::basic_vtable< - R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_ARGS> + R, BOOST_FUNCTION_TEMPLATE_ARGS> vtable_type; vtable_type* get_vtable() const { @@ -695,7 +692,7 @@ namespace boost { boost::throw_exception(bad_function_call()); return get_vtable()->invoker - (this->functor BOOST_FUNCTION_COMMA BOOST_FUNCTION_ARGS); + (this->functor, BOOST_FUNCTION_ARGS); } // The distinction between when to use function_n and @@ -831,7 +828,7 @@ namespace boost { typedef typename boost::detail::function::get_function_tag::type tag; typedef boost::detail::function::get_invoker get_invoker; typedef typename get_invoker:: - template apply handler_type; @@ -865,7 +862,7 @@ namespace boost { typedef typename boost::detail::function::get_function_tag::type tag; typedef boost::detail::function::get_invoker get_invoker; typedef typename get_invoker:: - template apply_a handler_type; @@ -942,13 +939,13 @@ namespace boost { } }; - template + template inline void swap(function_n< - R BOOST_FUNCTION_COMMA + R, BOOST_FUNCTION_TEMPLATE_ARGS >& f1, function_n< - R BOOST_FUNCTION_COMMA + R, BOOST_FUNCTION_TEMPLATE_ARGS >& f2) { @@ -956,29 +953,29 @@ namespace boost { } // Poison comparisons between boost::function objects of the same type. -template +template void operator==(const function_n< - R BOOST_FUNCTION_COMMA + R, BOOST_FUNCTION_TEMPLATE_ARGS>&, const function_n< - R BOOST_FUNCTION_COMMA + R, BOOST_FUNCTION_TEMPLATE_ARGS>&); -template +template void operator!=(const function_n< - R BOOST_FUNCTION_COMMA + R, BOOST_FUNCTION_TEMPLATE_ARGS>&, const function_n< - R BOOST_FUNCTION_COMMA + R, BOOST_FUNCTION_TEMPLATE_ARGS>& ); #define BOOST_FUNCTION_PARTIAL_SPEC R (BOOST_FUNCTION_TEMPLATE_ARGS) -template class function - : public function_n + : public function_n { - typedef function_n base_type; + typedef function_n base_type; typedef function self_type; struct clear_type {}; @@ -1062,7 +1059,6 @@ public: } // end namespace boost // Cleanup after ourselves... -#undef BOOST_FUNCTION_COMMA #undef BOOST_FUNCTION_TEMPLATE_PARMS #undef BOOST_FUNCTION_TEMPLATE_ARGS #undef BOOST_FUNCTION_PARMS