From 4fc563f0c0a97e9feed55e56e56498e662bee54b Mon Sep 17 00:00:00 2001 From: Johan Mabille Date: Thu, 30 Apr 2026 06:56:36 +0200 Subject: [PATCH] Removed xtrivially_default_constructible --- .../xtensor/containers/xbuffer_adaptor.hpp | 2 +- include/xtensor/containers/xstorage.hpp | 8 +++--- include/xtensor/utils/xutils.hpp | 28 ------------------- 3 files changed, 5 insertions(+), 33 deletions(-) diff --git a/include/xtensor/containers/xbuffer_adaptor.hpp b/include/xtensor/containers/xbuffer_adaptor.hpp index f9ac409a1..e59503f3a 100644 --- a/include/xtensor/containers/xbuffer_adaptor.hpp +++ b/include/xtensor/containers/xbuffer_adaptor.hpp @@ -709,7 +709,7 @@ namespace xt rhs.get_allocator() ); pointer tmp = safe_init_allocate(al, rhs.m_size); - if (xtrivially_default_constructible::value) + if (std::is_trivially_default_constructible::value) { std::uninitialized_copy(rhs.m_data.get(), rhs.m_data.get() + rhs.m_size, tmp); } diff --git a/include/xtensor/containers/xstorage.hpp b/include/xtensor/containers/xstorage.hpp index 62b2e4a35..efeb6571e 100644 --- a/include/xtensor/containers/xstorage.hpp +++ b/include/xtensor/containers/xstorage.hpp @@ -167,7 +167,7 @@ namespace xt using pointer = typename traits::pointer; using value_type = typename traits::value_type; pointer res = alloc.allocate(size); - if (!xtrivially_default_constructible::value) + if (!std::is_trivially_default_constructible::value) { for (pointer p = res; p != res + size; ++p) { @@ -189,7 +189,7 @@ namespace xt using value_type = typename traits::value_type; if (ptr != nullptr) { - if (!xtrivially_default_constructible::value) + if (!std::is_trivially_default_constructible::value) { for (pointer p = ptr; p != ptr + size; ++p) { @@ -325,7 +325,7 @@ namespace xt rhs.get_allocator() ); resize_impl(rhs.size()); - if (xtrivially_default_constructible::value) + if (std::is_trivially_default_constructible::value) { std::uninitialized_copy(rhs.p_begin, rhs.p_end, p_begin); } @@ -1255,7 +1255,7 @@ namespace xt template inline void svector::destroy_range(T* begin, T* end) { - if (!xtrivially_default_constructible::value) + if (!std::is_trivially_default_constructible::value) { while (begin != end) { diff --git a/include/xtensor/utils/xutils.hpp b/include/xtensor/utils/xutils.hpp index ca9fb0942..e93d8e688 100644 --- a/include/xtensor/utils/xutils.hpp +++ b/include/xtensor/utils/xutils.hpp @@ -609,34 +609,6 @@ namespace xt template concept iterator_concept = is_iterator::value; - /******************************************** - * xtrivial_default_construct implemenation * - ********************************************/ - -#if defined(_GLIBCXX_RELEASE) && _GLIBCXX_RELEASE >= 7 -// has_trivial_default_constructor has not been available since libstdc++-7. -#define XTENSOR_GLIBCXX_USE_CXX11_ABI 1 -#else -#if defined(_GLIBCXX_USE_CXX11_ABI) -#if _GLIBCXX_USE_CXX11_ABI || (defined(_GLIBCXX_USE_DUAL_ABI) && !_GLIBCXX_USE_DUAL_ABI) -#define XTENSOR_GLIBCXX_USE_CXX11_ABI 1 -#endif -#endif -#endif - -#if !defined(__GNUG__) || defined(_LIBCPP_VERSION) || defined(XTENSOR_GLIBCXX_USE_CXX11_ABI) - - template - using xtrivially_default_constructible = std::is_trivially_default_constructible; - -#else - - template - using xtrivially_default_constructible = std::has_trivial_default_constructor; - -#endif -#undef XTENSOR_GLIBCXX_USE_CXX11_ABI - /************************* * conditional type cast * *************************/