From cfe48661d81d618635697545fcef71c51c68dbc0 Mon Sep 17 00:00:00 2001 From: Jan Mrna Date: Fri, 17 Oct 2025 10:11:15 +0200 Subject: [PATCH] vec: Added no-overhead constructor for tag change --- cpp/src/math.hpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cpp/src/math.hpp b/cpp/src/math.hpp index a44638e..f6c45f7 100644 --- a/cpp/src/math.hpp +++ b/cpp/src/math.hpp @@ -46,6 +46,9 @@ public: vec(std::array array) : m_Array{array} {} + template + vec(vec&& other) : m_Array{std::move(other.m_Array)} {} + // // Access to elements & data // @@ -276,11 +279,17 @@ public: } template - vec ChangeTag() + vec ChangeTag() const & { return vec(m_Array); } + template + vec ChangeTag() && + { + return vec(std::move(*this)); + } + // Structured binding support for N == 2 template const T& get() const