From 948c251985efea2e0b476fbab221850efee6a689 Mon Sep 17 00:00:00 2001 From: Stephane Del Pino <stephane.delpino44@gmail.com> Date: Sun, 16 Dec 2018 16:57:37 +0100 Subject: [PATCH] Fix arguments forwarding in variadic constructor --- src/algebra/TinyMatrix.hpp | 6 +++--- src/algebra/TinyVector.hpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/algebra/TinyMatrix.hpp b/src/algebra/TinyMatrix.hpp index df335536b..e693a70f7 100644 --- a/src/algebra/TinyMatrix.hpp +++ b/src/algebra/TinyMatrix.hpp @@ -19,7 +19,7 @@ private: PASTIS_FORCEINLINE constexpr size_t _index(const size_t& i, const size_t& j) const noexcept { - return std::move(i*N+j); + return i*N+j; } template <typename... Args> @@ -28,7 +28,7 @@ private: { m_values[N*N-1-sizeof...(args)] = t; if constexpr (sizeof...(args) >0) { - this->_unpackVariadicInput(args...); + this->_unpackVariadicInput(std::forward<Args>(args)...); } } @@ -235,7 +235,7 @@ public: constexpr TinyMatrix(const T& t, Args&&... args) noexcept { static_assert(sizeof...(args)==N*N-1, "wrong number of parameters"); - this->_unpackVariadicInput(t, args...); + this->_unpackVariadicInput(t, std::forward<Args>(args)...); } PASTIS_INLINE diff --git a/src/algebra/TinyVector.hpp b/src/algebra/TinyVector.hpp index 162bcc2d2..7b7d407ee 100644 --- a/src/algebra/TinyVector.hpp +++ b/src/algebra/TinyVector.hpp @@ -23,7 +23,7 @@ class TinyVector { m_values[N-1-sizeof...(args)] = t; if constexpr (sizeof...(args) > 0) { - this->_unpackVariadicInput(args...); + this->_unpackVariadicInput(std::forward<Args>(args)...); } } @@ -200,7 +200,7 @@ class TinyVector constexpr TinyVector(const T& t, Args&&... args) noexcept { static_assert(sizeof...(args)==N-1, "wrong number of parameters"); - this->_unpackVariadicInput(t, args...); + this->_unpackVariadicInput(t, std::forward<Args>(args)...); } PASTIS_INLINE -- GitLab