]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Restrict memset to trivial types in SparseMatrix 6451/head
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Fri, 4 May 2018 16:36:22 +0000 (18:36 +0200)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Fri, 4 May 2018 17:20:01 +0000 (19:20 +0200)
include/deal.II/lac/sparse_matrix.templates.h

index 10832ee663dfe156b5d63a57042bb6156b5d1e81..70c7fb191e7f62f6c3e750a6765a33ad76e279de 100644 (file)
@@ -171,12 +171,22 @@ namespace internal
     typedef types::global_dof_index size_type;
 
     template <typename T>
-    void zero_subrange (const size_type begin,
-                        const size_type end,
-                        T *dst)
+    typename std::enable_if<std::is_trivial<T>::value>::type
+    zero_subrange (const size_type begin,
+                   const size_type end,
+                   T              *dst)
     {
       std::memset (dst+begin,0,(end-begin)*sizeof(T));
     }
+
+    template <typename T>
+    typename std::enable_if<!std::is_trivial<T>::value>::type
+    zero_subrange (const size_type begin,
+                   const size_type end,
+                   T              *dst)
+    {
+      std::fill (dst+begin,dst+end,0);
+    }
   }
 }
 

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.