From dffffa3b407222bb5af07b8c4f0b92feec4b2fc5 Mon Sep 17 00:00:00 2001
From: Stephane Del Pino <stephane.delpino44@gmail.com>
Date: Mon, 15 Oct 2018 11:52:36 +0200
Subject: [PATCH] Use default affectation and default constructor

This simplifies a bit the code but more importantly makes TinyVector and
TinyMatrix to satisfy std::is_trivial traits
---
 src/algebra/TinyMatrix.hpp | 20 +++-----------------
 src/algebra/TinyVector.hpp | 20 +++-----------------
 2 files changed, 6 insertions(+), 34 deletions(-)

diff --git a/src/algebra/TinyMatrix.hpp b/src/algebra/TinyMatrix.hpp
index 888acb068..23273a0ea 100644
--- a/src/algebra/TinyMatrix.hpp
+++ b/src/algebra/TinyMatrix.hpp
@@ -219,13 +219,7 @@ public:
   }
 
   PASTIS_INLINE
-  constexpr TinyMatrix& operator=(const TinyMatrix& A) noexcept
-  {
-    for (size_t i=0; i<N*N; ++i) {
-      m_values[i] = A.m_values[i];
-    }
-    return *this;
-  }
+  constexpr TinyMatrix& operator=(const TinyMatrix& A) noexcept = default;
 
   PASTIS_INLINE
   constexpr TinyMatrix& operator=(TinyMatrix&& A) noexcept = default;
@@ -239,10 +233,7 @@ public:
   }
 
   PASTIS_INLINE
-  constexpr TinyMatrix() noexcept
-  {
-    ;
-  }
+  constexpr TinyMatrix() noexcept = default;
 
   PASTIS_INLINE
   constexpr TinyMatrix(const ZeroType& z) noexcept
@@ -265,12 +256,7 @@ public:
   }
 
   PASTIS_INLINE
-  constexpr TinyMatrix(const TinyMatrix& A) noexcept
-  {
-    for (size_t i=0; i<N*N; ++i) {
-      m_values[i] = A.m_values[i];
-    }
-  }
+  constexpr TinyMatrix(const TinyMatrix&) noexcept = default;
 
   PASTIS_INLINE
   TinyMatrix(TinyMatrix&& A) noexcept = default;
diff --git a/src/algebra/TinyVector.hpp b/src/algebra/TinyVector.hpp
index 988d5f0ea..7dc42a158 100644
--- a/src/algebra/TinyVector.hpp
+++ b/src/algebra/TinyVector.hpp
@@ -184,13 +184,7 @@ class TinyVector
   }
 
   PASTIS_INLINE
-  const TinyVector& operator=(const TinyVector& v) noexcept
-  {
-    for (size_t i=0; i<N; ++i) {
-      m_values[i] = v.m_values[i];
-    }
-    return *this;
-  }
+  TinyVector& operator=(const TinyVector&) noexcept = default;
 
   PASTIS_INLINE
   constexpr TinyVector& operator=(TinyVector&& v) noexcept = default;
@@ -204,10 +198,7 @@ class TinyVector
   }
 
   PASTIS_INLINE
-  constexpr TinyVector() noexcept
-  {
-    ;
-  }
+  constexpr TinyVector() noexcept = default;
 
   PASTIS_INLINE
   constexpr TinyVector(const ZeroType& z) noexcept
@@ -219,12 +210,7 @@ class TinyVector
   }
 
   PASTIS_INLINE
-  constexpr TinyVector(const TinyVector& v) noexcept
-  {
-    for (size_t i=0; i<N; ++i) {
-      m_values[i] = v.m_values[i];
-    }
-  }
+  constexpr TinyVector(const TinyVector&) noexcept = default;
 
   PASTIS_INLINE
   constexpr TinyVector(TinyVector&& v) noexcept = default;
-- 
GitLab