diff --git a/headers/vmath.hpp/vmath_mat_fun.hpp b/headers/vmath.hpp/vmath_mat_fun.hpp index 0bd5306..60e84ef 100644 --- a/headers/vmath.hpp/vmath_mat_fun.hpp +++ b/headers/vmath.hpp/vmath_mat_fun.hpp @@ -192,6 +192,13 @@ namespace vmath_hpp::detail namespace vmath_hpp { + // +operator + + template < typename T, std::size_t Size > + [[nodiscard]] constexpr mat operator+(const mat& xs) { + return xs; + } + // -operator template < typename T, std::size_t Size > diff --git a/headers/vmath.hpp/vmath_vec_fun.hpp b/headers/vmath.hpp/vmath_vec_fun.hpp index c5c460b..00a1858 100644 --- a/headers/vmath.hpp/vmath_vec_fun.hpp +++ b/headers/vmath.hpp/vmath_vec_fun.hpp @@ -165,6 +165,13 @@ namespace vmath_hpp::detail namespace vmath_hpp { + // +operator + + template < typename T, std::size_t Size > + [[nodiscard]] constexpr vec operator+(const vec& xs) { + return xs; + } + // -operator template < typename T, std::size_t Size > diff --git a/untests/vmath_mat_fun_tests.cpp b/untests/vmath_mat_fun_tests.cpp index 479fd11..9b8acc7 100644 --- a/untests/vmath_mat_fun_tests.cpp +++ b/untests/vmath_mat_fun_tests.cpp @@ -58,7 +58,8 @@ TEST_CASE("vmath/mat_fun") { } SECTION("operators") { - STATIC_REQUIRE(-int2x2(1,2,3,4) == int2x2(-1,-2,-3,-4)); + STATIC_REQUIRE(+int2x2(1,-2,3,-4) == int2x2(1,-2,3,-4)); + STATIC_REQUIRE(-int2x2(1,-2,3,-4) == int2x2(-1,2,-3,4)); STATIC_REQUIRE(~uint2x2(0xF0F0F0F0,0x0F0F0F0F,0xF0F0F0F0,0x0F0F0F0F) == uint2x2(0x0F0F0F0F,0xF0F0F0F0,0x0F0F0F0F,0xF0F0F0F0)); STATIC_REQUIRE(!int2x2(-1,0,1,2) == bool2x2(false,true,false,false)); diff --git a/untests/vmath_vec_fun_tests.cpp b/untests/vmath_vec_fun_tests.cpp index 7efbc38..51a31dd 100644 --- a/untests/vmath_vec_fun_tests.cpp +++ b/untests/vmath_vec_fun_tests.cpp @@ -41,6 +41,7 @@ TEST_CASE("vmath/vec_fun") { } SECTION("Operators") { + STATIC_REQUIRE(+int2(1,-2) == int2(1,-2)); STATIC_REQUIRE(-int2(1,-2) == int2(-1,2)); STATIC_REQUIRE(~uint2(0xF0F0F0F0,0x0F0F0F0F) == uint2(0x0F0F0F0F,0xF0F0F0F0)); STATIC_REQUIRE(!int3(-1,0,1) == bool3(false, true, false));