From c0d41a880a239b6c4819ab7c43fd78718d1e5d0c Mon Sep 17 00:00:00 2001 From: Glen Fernandes Date: Sat, 22 Sep 2018 15:11:32 -0400 Subject: [PATCH] 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;