Cleanup polyfilled type traits helpers to derive from integral constant

This commit is contained in:
Christian Mazakas
2023-09-29 07:42:58 -07:00
parent 9f5f8b1b48
commit 6728ffcf6d
2 changed files with 22 additions and 25 deletions

View File

@ -1042,10 +1042,7 @@ struct table_arrays
initialize_groups(
arrays.groups(),groups_size,
std::integral_constant<
bool,
is_trivially_default_constructible<group_type>::value
>{});
is_trivially_default_constructible<group_type>{});
arrays.groups()[groups_size-1].set_sentinel();
}
@ -2060,10 +2057,7 @@ private:
}
void copy_groups_array_from(const table_core& x) {
copy_groups_array_from(x, std::integral_constant<bool,
is_trivially_copy_assignable<group_type>::value
>{}
);
copy_groups_array_from(x,is_trivially_copy_assignable<group_type>{});
}
void copy_groups_array_from(

View File

@ -1,4 +1,4 @@
// Copyright (C) 2022 Christian Mazakas
// Copyright (C) 2022-2023 Christian Mazakas
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -50,11 +50,12 @@ namespace boost {
#if BOOST_WORKAROUND(BOOST_LIBSTDCXX_VERSION, < 50000)
/* std::is_trivially_default_constructible not provided */
template <class T> struct is_trivially_default_constructible
template <class T>
struct is_trivially_default_constructible
: public std::integral_constant<bool,
std::is_default_constructible<T>::value &&
std::has_trivial_default_constructor<T>::value>
{
constexpr static const bool value =
std::is_default_constructible<T>::value &&
std::has_trivial_default_constructor<T>::value;
};
#else
using std::is_trivially_default_constructible;
@ -62,12 +63,12 @@ namespace boost {
#if BOOST_WORKAROUND(BOOST_LIBSTDCXX_VERSION, < 50000)
/* std::is_trivially_copy_constructible not provided */
template <class T> struct is_trivially_copy_constructible
template <class T>
struct is_trivially_copy_constructible
: public std::integral_constant<bool,
std::is_copy_constructible<T>::value &&
std::has_trivial_copy_constructor<T>::value>
{
constexpr static bool const value =
std::is_copy_constructible<T>::value &&
std::has_trivial_copy_constructor<T>::value;
};
#else
using std::is_trivially_copy_constructible;
@ -75,11 +76,12 @@ namespace boost {
#if BOOST_WORKAROUND(BOOST_LIBSTDCXX_VERSION, < 50000)
/* std::is_trivially_copy_assignable not provided */
template <class T> struct is_trivially_copy_assignable
template <class T>
struct is_trivially_copy_assignable
: public std::integral_constant<bool,
std::is_copy_assignable<T>::value &&
std::has_trivial_copy_assign<T>::value>
{
constexpr static bool const value =
std::is_copy_assignable<T>::value &&
std::has_trivial_copy_assign<T>::value;
};
#else
using std::is_trivially_copy_assignable;
@ -103,10 +105,11 @@ namespace boost {
} // namespace type_traits_detail
template <class T> struct is_nothrow_swappable
template <class T>
struct is_nothrow_swappable
: public std::integral_constant<bool,
type_traits_detail::is_nothrow_swappable_helper<T>::value>
{
constexpr static bool const value =
type_traits_detail::is_nothrow_swappable_helper<T>::value;
};
////////////////////////////////////////////////////////////////////////////