From 15afd57d32ca30f15d3215ac6541cb29f37bd9f7 Mon Sep 17 00:00:00 2001 From: David Wells Date: Sat, 7 Dec 2024 17:07:48 -0500 Subject: [PATCH] AlignedVector: use is_trivially_copyable. This is much more precise than std::is_trivial_v. --- include/deal.II/base/aligned_vector.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/include/deal.II/base/aligned_vector.h b/include/deal.II/base/aligned_vector.h index 9650776940..4d031a8e1e 100644 --- a/include/deal.II/base/aligned_vector.h +++ b/include/deal.II/base/aligned_vector.h @@ -820,8 +820,8 @@ namespace internal if (end == begin) return; - // for classes trivial assignment can use memcpy. - if constexpr (std::is_trivial_v == true && + // We can use memcpy() with trivially copyable objects. + if constexpr (std::is_trivially_copyable_v == true && (std::is_same_v || std::is_same_v) == true) std::memcpy(destination_ + begin, @@ -888,8 +888,8 @@ namespace internal if (end == begin) return; - // Classes with trivial assignment can use memcpy. - if constexpr (std::is_trivial_v == true && + // We can use memcpy() with trivially copyable objects. + if constexpr (std::is_trivially_copyable_v == true && (std::is_same_v || std::is_same_v) == true) std::memcpy(destination_ + begin, @@ -1790,11 +1790,11 @@ AlignedVector::replicate_across_communicator(const MPI_Comm communicator, // has all of the data. if (is_shmem_root) { - if (std::is_trivial_v) + if (std::is_trivially_copyable_v == true) { - // The data is "trivial", i.e., we can copy things directly without - // having to go through the serialization/deserialization machinery of - // Utilities::MPI::broadcast. + // The data is trivially copyable, i.e., we can copy things directly + // without having to go through the serialization/deserialization + // machinery of Utilities::MPI::broadcast. // // In that case, first tell all of the other shmem roots how many // elements we will have to deal with, and let them resize their @@ -1983,7 +1983,7 @@ AlignedVector::replicate_across_communicator(const MPI_Comm communicator, // shared memory space. if (is_shmem_root) { - if (std::is_trivial_v == true) + if (std::is_trivially_copyable_v == true) std::memcpy(aligned_shmem_pointer, elements.get(), sizeof(T) * size()); else for (std::size_t i = 0; i < size(); ++i) -- 2.39.5