diff options
author | wwylele <wwylele@gmail.com> | 2015-11-12 17:19:02 +0200 |
---|---|---|
committer | wwylele <wwylele@gmail.com> | 2015-11-12 20:39:28 +0200 |
commit | 8de154893c9bc1b31f29840715551a75eb76adb2 (patch) | |
tree | 333a3118678d33880151f2e167caac3a4dadb83a /src/common/vector_math.h | |
parent | 161be512fd63241554a9199b2da2e60bde7668ae (diff) |
disable unary minus when the type is not signed
silent warning C4146 on msvc
Diffstat (limited to 'src/common/vector_math.h')
-rw-r--r-- | src/common/vector_math.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/common/vector_math.h b/src/common/vector_math.h index 4928c9bf2d..816ad4e331 100644 --- a/src/common/vector_math.h +++ b/src/common/vector_math.h @@ -32,6 +32,7 @@ #pragma once #include <cmath> +#include <type_traits> namespace Math { @@ -90,6 +91,7 @@ public: { x-=other.x; y-=other.y; } + template<class = typename std::enable_if<std::is_signed<T>::value>::type> Vec2<decltype(-T{})> operator -() const { return MakeVec(-x,-y); @@ -220,6 +222,7 @@ public: { x-=other.x; y-=other.y; z-=other.z; } + template<class = typename std::enable_if<std::is_signed<T>::value>::type> Vec3<decltype(-T{})> operator -() const { return MakeVec(-x,-y,-z); @@ -390,6 +393,7 @@ public: { x-=other.x; y-=other.y; z-=other.z; w-=other.w; } + template<class = typename std::enable_if<std::is_signed<T>::value>::type> Vec4<decltype(-T{})> operator -() const { return MakeVec(-x,-y,-z,-w); |