mirror of
https://github.com/BlackMATov/vmath.hpp.git
synced 2025-12-16 14:11:28 +07:00
vector, matrix: +operator
This commit is contained in:
@@ -192,6 +192,13 @@ namespace vmath_hpp::detail
|
||||
|
||||
namespace vmath_hpp
|
||||
{
|
||||
// +operator
|
||||
|
||||
template < typename T, std::size_t Size >
|
||||
[[nodiscard]] constexpr mat<T, Size> operator+(const mat<T, Size>& xs) {
|
||||
return xs;
|
||||
}
|
||||
|
||||
// -operator
|
||||
|
||||
template < typename T, std::size_t Size >
|
||||
|
||||
@@ -165,6 +165,13 @@ namespace vmath_hpp::detail
|
||||
|
||||
namespace vmath_hpp
|
||||
{
|
||||
// +operator
|
||||
|
||||
template < typename T, std::size_t Size >
|
||||
[[nodiscard]] constexpr vec<T, Size> operator+(const vec<T, Size>& xs) {
|
||||
return xs;
|
||||
}
|
||||
|
||||
// -operator
|
||||
|
||||
template < typename T, std::size_t Size >
|
||||
|
||||
@@ -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));
|
||||
|
||||
|
||||
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user