Skip to content
Snippets Groups Projects
Commit 948c2519 authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Fix arguments forwarding in variadic constructor

parent 0a302344
No related branches found
No related tags found
No related merge requests found
...@@ -19,7 +19,7 @@ private: ...@@ -19,7 +19,7 @@ private:
PASTIS_FORCEINLINE PASTIS_FORCEINLINE
constexpr size_t _index(const size_t& i, const size_t& j) const noexcept 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> template <typename... Args>
...@@ -28,7 +28,7 @@ private: ...@@ -28,7 +28,7 @@ private:
{ {
m_values[N*N-1-sizeof...(args)] = t; m_values[N*N-1-sizeof...(args)] = t;
if constexpr (sizeof...(args) >0) { if constexpr (sizeof...(args) >0) {
this->_unpackVariadicInput(args...); this->_unpackVariadicInput(std::forward<Args>(args)...);
} }
} }
...@@ -235,7 +235,7 @@ public: ...@@ -235,7 +235,7 @@ public:
constexpr TinyMatrix(const T& t, Args&&... args) noexcept constexpr TinyMatrix(const T& t, Args&&... args) noexcept
{ {
static_assert(sizeof...(args)==N*N-1, "wrong number of parameters"); static_assert(sizeof...(args)==N*N-1, "wrong number of parameters");
this->_unpackVariadicInput(t, args...); this->_unpackVariadicInput(t, std::forward<Args>(args)...);
} }
PASTIS_INLINE PASTIS_INLINE
......
...@@ -23,7 +23,7 @@ class TinyVector ...@@ -23,7 +23,7 @@ class TinyVector
{ {
m_values[N-1-sizeof...(args)] = t; m_values[N-1-sizeof...(args)] = t;
if constexpr (sizeof...(args) > 0) { if constexpr (sizeof...(args) > 0) {
this->_unpackVariadicInput(args...); this->_unpackVariadicInput(std::forward<Args>(args)...);
} }
} }
...@@ -200,7 +200,7 @@ class TinyVector ...@@ -200,7 +200,7 @@ class TinyVector
constexpr TinyVector(const T& t, Args&&... args) noexcept constexpr TinyVector(const T& t, Args&&... args) noexcept
{ {
static_assert(sizeof...(args)==N-1, "wrong number of parameters"); static_assert(sizeof...(args)==N-1, "wrong number of parameters");
this->_unpackVariadicInput(t, args...); this->_unpackVariadicInput(t, std::forward<Args>(args)...);
} }
PASTIS_INLINE PASTIS_INLINE
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment