C++20 compatibility for deprecated std::is_pod

This commit is contained in:
John Wellbelove 2021-06-24 20:38:57 +01:00 committed by John Wellbelove
parent c49a9274df
commit e109e4977b
3 changed files with 50 additions and 14 deletions

View File

@ -1148,51 +1148,71 @@ namespace etl
//***************************************************************************
/// is_trivially_constructible
///\ingroup type_traits
#if ETL_CPP11_SUPPORTED && ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED
template <typename T> struct is_trivially_constructible : std::is_trivially_constructible<T> {};
#else
template <typename T> struct is_trivially_constructible : std::is_pod<T> {};
#endif
#if ETL_CPP17_SUPPORTED
template <typename T>
inline constexpr bool is_trivially_constructible_v = std::is_pod_v<T>;
inline constexpr bool is_trivially_constructible_v = etl::is_trivially_constructible<T>::value;
#endif
//***************************************************************************
/// is_trivially_copy_constructible
///\ingroup type_traits
#if ETL_CPP11_SUPPORTED && ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED
template <typename T> struct is_trivially_copy_constructible : std::is_trivially_copy_constructible<T> {};
#else
template <typename T> struct is_trivially_copy_constructible : std::is_pod<T> {};
#endif
#if ETL_CPP17_SUPPORTED
template <typename T>
inline constexpr bool is_trivially_copy_constructible_v = std::is_pod_v<T>;
inline constexpr bool is_trivially_copy_constructible_v = etl::is_trivially_copy_constructible<T>::value;
#endif
//***************************************************************************
/// is_trivially_destructible
///\ingroup type_traits
#if ETL_CPP11_SUPPORTED && ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED
template <typename T> struct is_trivially_destructible : std::is_trivially_destructible<T> {};
#else
template <typename T> struct is_trivially_destructible : std::is_pod<T> {};
#endif
#if ETL_CPP17_SUPPORTED
template <typename T>
inline constexpr bool is_trivially_destructible_v = std::is_pod_v<T>;
inline constexpr bool is_trivially_destructible_v = etl::is_trivially_destructible<T>::value;
#endif
//***************************************************************************
/// is_trivially_copy_assignable
///\ingroup type_traits
#if ETL_CPP11_SUPPORTED && ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED
template <typename T> struct is_trivially_copy_assignable : std::is_trivially_copy_assignable<T> {};
#else
template <typename T> struct is_trivially_copy_assignable : std::is_pod<T> {};
#endif
#if ETL_CPP17_SUPPORTED
template <typename T>
inline constexpr bool is_trivially_copy_assignable_v = std::is_pod_v<T>;
inline constexpr bool is_trivially_copy_assignable_v = etl::is_trivially_copy_assignable<T>::value;
#endif
//***************************************************************************
/// is_trivially_copyable
///\ingroup type_traits
#if ETL_CPP11_SUPPORTED && ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED
template <typename T> struct is_trivially_copyable : std::is_trivially_copyable<T> {};
#else
template <typename T> struct is_trivially_copyable : std::is_pod<T> {};
#endif
#if ETL_CPP17_SUPPORTED
template <typename T>
inline constexpr bool is_trivially_copyable_v = std::is_pod_v<T>;
inline constexpr bool is_trivially_copyable_v = etl::is_trivially_copyable<T>::value;
#endif
#endif

View File

@ -1136,51 +1136,71 @@ namespace etl
//***************************************************************************
/// is_trivially_constructible
///\ingroup type_traits
#if ETL_CPP11_SUPPORTED && ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED
template <typename T> struct is_trivially_constructible : std::is_trivially_constructible<T> {};
#else
template <typename T> struct is_trivially_constructible : std::is_pod<T> {};
#endif
#if ETL_CPP17_SUPPORTED
template <typename T>
inline constexpr bool is_trivially_constructible_v = std::is_pod_v<T>;
inline constexpr bool is_trivially_constructible_v = etl::is_trivially_constructible<T>::value;
#endif
//***************************************************************************
/// is_trivially_copy_constructible
///\ingroup type_traits
#if ETL_CPP11_SUPPORTED && ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED
template <typename T> struct is_trivially_copy_constructible : std::is_trivially_copy_constructible<T> {};
#else
template <typename T> struct is_trivially_copy_constructible : std::is_pod<T> {};
#endif
#if ETL_CPP17_SUPPORTED
template <typename T>
inline constexpr bool is_trivially_copy_constructible_v = std::is_pod_v<T>;
inline constexpr bool is_trivially_copy_constructible_v = etl::is_trivially_copy_constructible<T>::value;
#endif
//***************************************************************************
/// is_trivially_destructible
///\ingroup type_traits
#if ETL_CPP11_SUPPORTED && ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED
template <typename T> struct is_trivially_destructible : std::is_trivially_destructible<T> {};
#else
template <typename T> struct is_trivially_destructible : std::is_pod<T> {};
#endif
#if ETL_CPP17_SUPPORTED
template <typename T>
inline constexpr bool is_trivially_destructible_v = std::is_pod_v<T>;
inline constexpr bool is_trivially_destructible_v = etl::is_trivially_destructible<T>::value;
#endif
//***************************************************************************
/// is_trivially_copy_assignable
///\ingroup type_traits
#if ETL_CPP11_SUPPORTED && ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED
template <typename T> struct is_trivially_copy_assignable : std::is_trivially_copy_assignable<T> {};
#else
template <typename T> struct is_trivially_copy_assignable : std::is_pod<T> {};
#endif
#if ETL_CPP17_SUPPORTED
template <typename T>
inline constexpr bool is_trivially_copy_assignable_v = std::is_pod_v<T>;
inline constexpr bool is_trivially_copy_assignable_v = etl::is_trivially_copy_assignable<T>::value;
#endif
//***************************************************************************
/// is_trivially_copyable
///\ingroup type_traits
#if ETL_CPP11_SUPPORTED && ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED
template <typename T> struct is_trivially_copyable : std::is_trivially_copyable<T> {};
#else
template <typename T> struct is_trivially_copyable : std::is_pod<T> {};
#endif
#if ETL_CPP17_SUPPORTED
template <typename T>
inline constexpr bool is_trivially_copyable_v = std::is_pod_v<T>;
inline constexpr bool is_trivially_copyable_v = etl::is_trivially_copyable<T>::value;
#endif
#endif

View File

@ -1297,9 +1297,7 @@ namespace etl
ETL_OVERRIDE
#endif
{
#if ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED
ETL_ASSERT(etl::is_trivially_copyable<T>::value, ETL_ERROR(etl::vector_incompatible_type));
#endif
etl::ivector<T>::repair_buffer(buffer);
}
@ -1468,9 +1466,7 @@ namespace etl
ETL_OVERRIDE
#endif
{
#if ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED
ETL_ASSERT(etl::is_trivially_copyable<T>::value, ETL_ERROR(etl::vector_incompatible_type));
#endif
etl::ivector<T>::repair_buffer(this->p_buffer);
}