]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use simpler copy/move initialization in Tensor. 16505/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Fri, 19 Jan 2024 20:48:09 +0000 (13:48 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Fri, 19 Jan 2024 20:48:09 +0000 (13:48 -0700)
include/deal.II/base/tensor.h

index a6aed73afe060986628103445963409daf5194d0..0bae03a7b5502351c73db51b81fe54e30bc5c15f 100644 (file)
@@ -1494,20 +1494,16 @@ operator Tensor<1, dim, Tensor<rank_ - 1, dim, OtherNumber>>() const
 template <int rank_, int dim, typename Number>
 constexpr DEAL_II_ALWAYS_INLINE
 Tensor<rank_, dim, Number>::Tensor(const Tensor<rank_, dim, Number> &other)
-{
-  for (unsigned int i = 0; i < dim; ++i)
-    values[i] = other.values[i];
-}
+  : values(other.values)
+{}
 
 
 
 template <int rank_, int dim, typename Number>
 constexpr DEAL_II_ALWAYS_INLINE
 Tensor<rank_, dim, Number>::Tensor(Tensor<rank_, dim, Number> &&other) noexcept
-{
-  for (unsigned int i = 0; i < dim; ++i)
-    values[i] = other.values[i];
-}
+  : values(std::move(other.values))
+{}
 #  endif
 
 

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.