]> https://gitweb.dealii.org/ - dealii.git/commitdiff
AlignedVector: use is_trivially_destructible.
authorDavid Wells <drwells@email.unc.edu>
Sat, 7 Dec 2024 22:08:38 +0000 (17:08 -0500)
committerDavid Wells <drwells@email.unc.edu>
Sun, 8 Dec 2024 00:00:11 +0000 (19:00 -0500)
This is much more precise than std::is_trivial_v<T>.

include/deal.II/base/aligned_vector.h

index 4d031a8e1e5ac6c2334f41d4522fcf4927d53723..633d8ee45f7faf1e8600ae7005cf180b03a602c7 100644 (file)
@@ -1133,7 +1133,7 @@ AlignedVector<T>::Deleter::operator()(T *ptr)
           Assert(owning_aligned_vector->used_elements_end != nullptr,
                  ExcInternalError());
 
-          if (std::is_trivial_v<T> == false)
+          if (std::is_trivially_destructible_v<T> == false)
             for (T *p = owning_aligned_vector->used_elements_end - 1; p >= ptr;
                  --p)
               p->~T();
@@ -1190,7 +1190,7 @@ AlignedVector<T>::Deleter::MPISharedMemDeleterAction::delete_array(
   // it, not unique_ptr) so it is still set to its correct value.
 
   if (is_shmem_root)
-    if (std::is_trivial_v<T> == false)
+    if (std::is_trivially_destructible_v<T> == false)
       for (T *p = aligned_vector->used_elements_end - 1; p >= ptr; --p)
         p->~T();
 
@@ -1345,7 +1345,7 @@ AlignedVector<T>::resize_fast(const size_type new_size)
       // call destructor on fields that are released, if the type requires it.
       // doing it backward releases the elements in reverse order as compared to
       // how they were created
-      if (std::is_trivial_v<T> == false)
+      if (std::is_trivially_destructible_v<T> == false)
         for (T *p = used_elements_end - 1; p >= elements.get() + new_size; --p)
           p->~T();
       used_elements_end = elements.get() + new_size;
@@ -1382,7 +1382,7 @@ AlignedVector<T>::resize(const size_type new_size)
       // call destructor on fields that are released, if the type requires it.
       // doing it backward releases the elements in reverse order as compared to
       // how they were created
-      if (std::is_trivial_v<T> == false)
+      if (std::is_trivially_destructible_v<T> == false)
         for (T *p = used_elements_end - 1; p >= elements.get() + new_size; --p)
           p->~T();
       used_elements_end = elements.get() + new_size;
@@ -1417,7 +1417,7 @@ AlignedVector<T>::resize(const size_type new_size, const T &init)
       // call destructor on fields that are released, if the type requires it.
       // doing it backward releases the elements in reverse order as compared to
       // how they were created
-      if (std::is_trivial_v<T> == false)
+      if (std::is_trivially_destructible_v<T> == false)
         for (T *p = used_elements_end - 1; p >= elements.get() + new_size; --p)
           p->~T();
       used_elements_end = elements.get() + new_size;

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.