]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix a GCC8 warning. 6500/head
authorDavid Wells <wellsd2@rpi.edu>
Sat, 5 May 2018 17:17:23 +0000 (13:17 -0400)
committerMatthias Maier <tamiko@43-1.org>
Sun, 6 May 2018 21:07:36 +0000 (16:07 -0500)
GCC warns that these types are not trivally copyable so we should not use
std::memmove. We cannot use std::move either since the beginning of the new
range may intersect the old range. Hence: use std::move_backward to copy from
the end, which cannot overlap.

include/deal.II/lac/constraint_matrix.templates.h

index 781173d7492d15385a425a12d667d3bd3911b249..4a6aa6172cf57236cf36a868901ce1dd4750a617 100644 (file)
@@ -1062,9 +1062,12 @@ namespace internals
           // at least one element when we get here, subtracting 1 works fine.
           data.resize(2*data.size());
           for (size_type i=individual_size.size()-1; i>0; --i)
-            std::memmove(&data[i*row_length*2], &data[i*row_length],
-                         individual_size[i]*
-                         sizeof(std::pair<size_type,double>));
+            {
+              const auto ptr = data.data();
+              std::move_backward(ptr + i*row_length,
+                                 ptr + i*row_length + individual_size[i],
+                                 ptr + i*2*row_length + individual_size[i]);
+            }
           row_length *= 2;
         }
       data[index*row_length+my_length] = pair;

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.