From b1fa00f3b15c8854cfa6851434b4f0bbca00374d Mon Sep 17 00:00:00 2001 From: Glen Fernandes Date: Sat, 22 Sep 2018 15:04:52 -0400 Subject: [PATCH 1/4] Include workaround.hpp from config instead of detail --- include/boost/function.hpp | 2 +- include/boost/function/function_base.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/function.hpp b/include/boost/function.hpp index 68a25ab..ef907e0 100644 --- a/include/boost/function.hpp +++ b/include/boost/function.hpp @@ -23,7 +23,7 @@ #include // unary_function, binary_function #include -#include +#include // Include the prologue here so that the use of file-level iteration // in anything that may be included by function_template.hpp doesn't break diff --git a/include/boost/function/function_base.hpp b/include/boost/function/function_base.hpp index 841affb..3de9d39 100644 --- a/include/boost/function/function_base.hpp +++ b/include/boost/function/function_base.hpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #ifndef BOOST_NO_SFINAE # include "boost/utility/enable_if.hpp" From d1ad1141f3bbee094e114847fa41f34293e7547e Mon Sep 17 00:00:00 2001 From: Glen Fernandes Date: Sat, 22 Sep 2018 15:06:23 -0400 Subject: [PATCH 2/4] Use enable_if from TypeTraits --- include/boost/function/function_base.hpp | 4 ++-- include/boost/function/function_template.hpp | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/boost/function/function_base.hpp b/include/boost/function/function_base.hpp index 3de9d39..c1dbabd 100644 --- a/include/boost/function/function_base.hpp +++ b/include/boost/function/function_base.hpp @@ -30,7 +30,7 @@ #include #include #ifndef BOOST_NO_SFINAE -# include "boost/utility/enable_if.hpp" +#include #else # include "boost/mpl/bool.hpp" #endif @@ -50,7 +50,7 @@ #endif // __ICL etc # define BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor,Type) \ - typename ::boost::enable_if_c< \ + typename ::boost::enable_if_< \ !(::boost::is_integral::value), \ Type>::type diff --git a/include/boost/function/function_template.hpp b/include/boost/function/function_template.hpp index 177b60a..2fa47a1 100644 --- a/include/boost/function/function_template.hpp +++ b/include/boost/function/function_template.hpp @@ -715,7 +715,7 @@ namespace boost { template BOOST_FUNCTION_FUNCTION(Functor BOOST_FUNCTION_TARGET_FIX(const &) f #ifndef BOOST_NO_SFINAE - ,typename boost::enable_if_c< + ,typename boost::enable_if_< !(is_integral::value), int>::type = 0 #endif // BOOST_NO_SFINAE @@ -727,7 +727,7 @@ namespace boost { template BOOST_FUNCTION_FUNCTION(Functor BOOST_FUNCTION_TARGET_FIX(const &) f, Allocator a #ifndef BOOST_NO_SFINAE - ,typename boost::enable_if_c< + ,typename boost::enable_if_< !(is_integral::value), int>::type = 0 #endif // BOOST_NO_SFINAE @@ -776,7 +776,7 @@ namespace boost { // construct. template #ifndef BOOST_NO_SFINAE - typename boost::enable_if_c< + typename boost::enable_if_< !(is_integral::value), BOOST_FUNCTION_FUNCTION&>::type #else @@ -1066,7 +1066,7 @@ public: template function(Functor f #ifndef BOOST_NO_SFINAE - ,typename boost::enable_if_c< + ,typename boost::enable_if_< !(is_integral::value), int>::type = 0 #endif @@ -1077,7 +1077,7 @@ public: template function(Functor f, Allocator a #ifndef BOOST_NO_SFINAE - ,typename boost::enable_if_c< + ,typename boost::enable_if_< !(is_integral::value), int>::type = 0 #endif @@ -1116,7 +1116,7 @@ public: template #ifndef BOOST_NO_SFINAE - typename boost::enable_if_c< + typename boost::enable_if_< !(is_integral::value), self_type&>::type #else From 87c978d36ed936b555b90dff07ed42a718fdc641 Mon Sep 17 00:00:00 2001 From: Glen Fernandes Date: Sat, 22 Sep 2018 15:11:12 -0400 Subject: [PATCH 3/4] Use LightweightTest and NoExceptionsSupport from Core --- include/boost/function/function_template.hpp | 2 +- test/contains2_test.cpp | 2 +- test/mem_fun_cxx98.cpp | 2 +- test/mem_fun_portable.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/boost/function/function_template.hpp b/include/boost/function/function_template.hpp index 2fa47a1..81bacf7 100644 --- a/include/boost/function/function_template.hpp +++ b/include/boost/function/function_template.hpp @@ -11,7 +11,7 @@ // Note: this header is a header template and must NOT have multiple-inclusion // protection. #include -#include +#include #if defined(BOOST_MSVC) # pragma warning( push ) diff --git a/test/contains2_test.cpp b/test/contains2_test.cpp index cf6d479..9cfa5c3 100644 --- a/test/contains2_test.cpp +++ b/test/contains2_test.cpp @@ -9,7 +9,7 @@ // http://www.boost.org/LICENSE_1_0.txt) #include -#include +#include static int forty_two() { diff --git a/test/mem_fun_cxx98.cpp b/test/mem_fun_cxx98.cpp index c289791..9274036 100644 --- a/test/mem_fun_cxx98.cpp +++ b/test/mem_fun_cxx98.cpp @@ -10,7 +10,7 @@ #include -#include +#include #include #include diff --git a/test/mem_fun_portable.cpp b/test/mem_fun_portable.cpp index 0251339..e12fd08 100644 --- a/test/mem_fun_portable.cpp +++ b/test/mem_fun_portable.cpp @@ -10,7 +10,7 @@ #include -#include +#include #include #include From c0d41a880a239b6c4819ab7c43fd78718d1e5d0c Mon Sep 17 00:00:00 2001 From: Glen Fernandes Date: Sat, 22 Sep 2018 15:11:32 -0400 Subject: [PATCH 4/4] Drop dependency on MPL --- include/boost/function/function_base.hpp | 48 ++++++++++---------- include/boost/function/function_template.hpp | 22 ++++----- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/include/boost/function/function_base.hpp b/include/boost/function/function_base.hpp index c1dbabd..b20a523 100644 --- a/include/boost/function/function_base.hpp +++ b/include/boost/function/function_base.hpp @@ -26,13 +26,13 @@ #include #include #include -#include +#include #include #include #ifndef BOOST_NO_SFINAE #include #else -# include "boost/mpl/bool.hpp" +#include #endif #include #include @@ -152,15 +152,15 @@ namespace boost { template class get_function_tag { - typedef typename mpl::if_c<(is_pointer::value), + typedef typename conditional<(is_pointer::value), function_ptr_tag, function_obj_tag>::type ptr_or_obj_tag; - typedef typename mpl::if_c<(is_member_pointer::value), + typedef typename conditional<(is_member_pointer::value), member_ptr_tag, ptr_or_obj_tag>::type ptr_or_obj_or_mem_tag; - typedef typename mpl::if_c<(is_reference_wrapper::value), + typedef typename conditional<(is_reference_wrapper::value), function_obj_ref_tag, ptr_or_obj_or_mem_tag>::type or_ref_tag; @@ -328,7 +328,7 @@ namespace boost { // Function objects that fit in the small-object buffer. static inline void manager(const function_buffer& in_buffer, function_buffer& out_buffer, - functor_manager_operation_type op, mpl::true_) + functor_manager_operation_type op, true_type) { functor_manager_common::manage_small(in_buffer,out_buffer,op); } @@ -336,7 +336,7 @@ namespace boost { // Function objects that require heap allocation static inline void manager(const function_buffer& in_buffer, function_buffer& out_buffer, - functor_manager_operation_type op, mpl::false_) + functor_manager_operation_type op, false_type) { if (op == clone_functor_tag) { // Clone the functor @@ -377,7 +377,7 @@ namespace boost { functor_manager_operation_type op, function_obj_tag) { manager(in_buffer, out_buffer, op, - mpl::bool_<(function_allows_small_object_optimization::value)>()); + integral_constant::value)>()); } // For member pointers, we use the small-object optimization buffer. @@ -385,7 +385,7 @@ namespace boost { manager(const function_buffer& in_buffer, function_buffer& out_buffer, functor_manager_operation_type op, member_ptr_tag) { - manager(in_buffer, out_buffer, op, mpl::true_()); + manager(in_buffer, out_buffer, op, true_type()); } public: @@ -427,7 +427,7 @@ namespace boost { // Function objects that fit in the small-object buffer. static inline void manager(const function_buffer& in_buffer, function_buffer& out_buffer, - functor_manager_operation_type op, mpl::true_) + functor_manager_operation_type op, true_type) { functor_manager_common::manage_small(in_buffer,out_buffer,op); } @@ -435,7 +435,7 @@ namespace boost { // Function objects that require heap allocation static inline void manager(const function_buffer& in_buffer, function_buffer& out_buffer, - functor_manager_operation_type op, mpl::false_) + functor_manager_operation_type op, false_type) { typedef functor_wrapper functor_wrapper_type; #if defined(BOOST_NO_CXX11_ALLOCATOR) @@ -499,7 +499,7 @@ namespace boost { functor_manager_operation_type op, function_obj_tag) { manager(in_buffer, out_buffer, op, - mpl::bool_<(function_allows_small_object_optimization::value)>()); + integral_constant::value)>()); } public: @@ -530,24 +530,24 @@ namespace boost { #ifdef BOOST_NO_SFINAE // These routines perform comparisons between a Boost.Function // object and an arbitrary function object (when the last - // parameter is mpl::bool_) or against zero (when the - // last parameter is mpl::bool_). They are only necessary + // parameter is false_type) or against zero (when the + // last parameter is true_type). They are only necessary // for compilers that don't support SFINAE. template bool - compare_equal(const Function& f, const Functor&, int, mpl::bool_) + compare_equal(const Function& f, const Functor&, int, true_type) { return f.empty(); } template bool compare_not_equal(const Function& f, const Functor&, int, - mpl::bool_) + true_type) { return !f.empty(); } template bool compare_equal(const Function& f, const Functor& g, long, - mpl::bool_) + false_type) { if (const Functor* fp = f.template target()) return function_equal(*fp, g); @@ -557,7 +557,7 @@ namespace boost { template bool compare_equal(const Function& f, const reference_wrapper& g, - int, mpl::bool_) + int, false_type) { if (const Functor* fp = f.template target()) return fp == g.get_pointer(); @@ -567,7 +567,7 @@ namespace boost { template bool compare_not_equal(const Function& f, const Functor& g, long, - mpl::bool_) + false_type) { if (const Functor* fp = f.template target()) return !function_equal(*fp, g); @@ -578,7 +578,7 @@ namespace boost { bool compare_not_equal(const Function& f, const reference_wrapper& g, int, - mpl::bool_) + false_type) { if (const Functor* fp = f.template target()) return fp != g.get_pointer(); @@ -750,28 +750,28 @@ inline bool operator!=(detail::function::useless_clear_type*, template inline bool operator==(const function_base& f, Functor g) { - typedef mpl::bool_<(is_integral::value)> integral; + typedef integral_constant::value)> integral; return detail::function::compare_equal(f, g, 0, integral()); } template inline bool operator==(Functor g, const function_base& f) { - typedef mpl::bool_<(is_integral::value)> integral; + typedef integral_constant::value)> integral; return detail::function::compare_equal(f, g, 0, integral()); } template inline bool operator!=(const function_base& f, Functor g) { - typedef mpl::bool_<(is_integral::value)> integral; + typedef integral_constant::value)> integral; return detail::function::compare_not_equal(f, g, 0, integral()); } template inline bool operator!=(Functor g, const function_base& f) { - typedef mpl::bool_<(is_integral::value)> integral; + typedef integral_constant::value)> integral; return detail::function::compare_not_equal(f, g, 0, integral()); } #else diff --git a/include/boost/function/function_template.hpp b/include/boost/function/function_template.hpp index 81bacf7..e4ebb30 100644 --- a/include/boost/function/function_template.hpp +++ b/include/boost/function/function_template.hpp @@ -240,7 +240,7 @@ namespace boost { > struct BOOST_FUNCTION_GET_FUNCTION_INVOKER { - typedef typename mpl::if_c<(is_void::value), + typedef typename conditional<(is_void::value), BOOST_FUNCTION_VOID_FUNCTION_INVOKER< FunctionPtr, R BOOST_FUNCTION_COMMA @@ -261,7 +261,7 @@ namespace boost { > struct BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER { - typedef typename mpl::if_c<(is_void::value), + typedef typename conditional<(is_void::value), BOOST_FUNCTION_VOID_FUNCTION_OBJ_INVOKER< FunctionObj, R BOOST_FUNCTION_COMMA @@ -282,7 +282,7 @@ namespace boost { > struct BOOST_FUNCTION_GET_FUNCTION_REF_INVOKER { - typedef typename mpl::if_c<(is_void::value), + typedef typename conditional<(is_void::value), BOOST_FUNCTION_VOID_FUNCTION_REF_INVOKER< FunctionObj, R BOOST_FUNCTION_COMMA @@ -305,7 +305,7 @@ namespace boost { > struct BOOST_FUNCTION_GET_MEMBER_INVOKER { - typedef typename mpl::if_c<(is_void::value), + typedef typename conditional<(is_void::value), BOOST_FUNCTION_VOID_MEMBER_INVOKER< MemberPtr, R BOOST_FUNCTION_COMMA @@ -567,27 +567,27 @@ namespace boost { // Assign to a function object using the small object optimization template void - assign_functor(FunctionObj f, function_buffer& functor, mpl::true_) const + assign_functor(FunctionObj f, function_buffer& functor, true_type) const { new (reinterpret_cast(functor.data)) FunctionObj(f); } template void - assign_functor_a(FunctionObj f, function_buffer& functor, Allocator, mpl::true_) const + assign_functor_a(FunctionObj f, function_buffer& functor, Allocator, true_type) const { - assign_functor(f,functor,mpl::true_()); + assign_functor(f,functor,true_type()); } // Assign to a function object allocated on the heap. template void - assign_functor(FunctionObj f, function_buffer& functor, mpl::false_) const + assign_functor(FunctionObj f, function_buffer& functor, false_type) const { functor.members.obj_ptr = new FunctionObj(f); } template void - assign_functor_a(FunctionObj f, function_buffer& functor, Allocator a, mpl::false_) const + assign_functor_a(FunctionObj f, function_buffer& functor, Allocator a, false_type) const { typedef functor_wrapper functor_wrapper_type; #if defined(BOOST_NO_CXX11_ALLOCATOR) @@ -615,7 +615,7 @@ namespace boost { { if (!boost::detail::function::has_empty_target(boost::addressof(f))) { assign_functor(f, functor, - mpl::bool_<(function_allows_small_object_optimization::value)>()); + integral_constant::value)>()); return true; } else { return false; @@ -627,7 +627,7 @@ namespace boost { { if (!boost::detail::function::has_empty_target(boost::addressof(f))) { assign_functor_a(f, functor, a, - mpl::bool_<(function_allows_small_object_optimization::value)>()); + integral_constant::value)>()); return true; } else { return false;