From 35f0c2a6818e0f14c157c807d56cc80dbcd80252 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Sat, 11 May 2024 21:51:45 +0300 Subject: [PATCH] GCC 4.x doesn't have std::is_trivially_copy_constructible --- include/boost/function/function_template.hpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/include/boost/function/function_template.hpp b/include/boost/function/function_template.hpp index 0ee0cce..07cf992 100644 --- a/include/boost/function/function_template.hpp +++ b/include/boost/function/function_template.hpp @@ -599,6 +599,18 @@ namespace boost { typedef T1 second_argument_type; }; +#if defined( BOOST_LIBSTDCXX_VERSION ) && BOOST_LIBSTDCXX_VERSION < 50000 + + template struct is_trivially_copy_constructible: std::integral_constant::value && std::has_trivial_copy_constructor::value> + { + }; + +#else + + using std::is_trivially_copy_constructible; + +#endif + } // end namespace function } // end namespace detail @@ -834,7 +846,7 @@ namespace boost { if (stored_vtable.assign_to(std::move(f), functor)) { std::size_t value = reinterpret_cast(&stored_vtable.base); // coverity[pointless_expression]: suppress coverity warnings on apparant if(const). - if (std::is_trivially_copy_constructible::value && + if (boost::detail::function::is_trivially_copy_constructible::value && std::is_trivially_destructible::value && boost::detail::function::function_allows_small_object_optimization::value) value |= static_cast(0x01); @@ -868,7 +880,7 @@ namespace boost { if (stored_vtable.assign_to_a(std::move(f), functor, a)) { std::size_t value = reinterpret_cast(&stored_vtable.base); // coverity[pointless_expression]: suppress coverity warnings on apparant if(const). - if (std::is_trivially_copy_constructible::value && + if (boost::detail::function::is_trivially_copy_constructible::value && std::is_trivially_destructible::value && boost::detail::function::function_allows_small_object_optimization::value) value |= static_cast(0x01);