From 10a436b4814f94c93b69902bd2b1d812b67c5784 Mon Sep 17 00:00:00 2001 From: Remi Beges Date: Wed, 20 Jun 2012 20:36:14 +0200 Subject: [PATCH] Made operator< of strict order --- include/Nazara/Math/Vector2.inl | 2 +- include/Nazara/Math/Vector3.inl | 2 +- include/Nazara/Math/Vector4.inl | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/Nazara/Math/Vector2.inl b/include/Nazara/Math/Vector2.inl index 3889aaa78..5b9d58261 100644 --- a/include/Nazara/Math/Vector2.inl +++ b/include/Nazara/Math/Vector2.inl @@ -342,7 +342,7 @@ bool NzVector2::operator!=(const NzVector2& vec) const template bool NzVector2::operator<(const NzVector2& vec) const { - return x < vec.x && y < vec.y; + return (x != vec.x) ? x < vec.x : y < vec.y; } template diff --git a/include/Nazara/Math/Vector3.inl b/include/Nazara/Math/Vector3.inl index 73eff32fe..9a40aac0f 100644 --- a/include/Nazara/Math/Vector3.inl +++ b/include/Nazara/Math/Vector3.inl @@ -374,7 +374,7 @@ bool NzVector3::operator!=(const NzVector3& vec) const template bool NzVector3::operator<(const NzVector3& vec) const { - return x < vec.x && y < vec.y && z < vec.z; + return (x != vec.x) ? x < vec.x : (y != vec.y) ? y < vec.y : z < vec.z; } template diff --git a/include/Nazara/Math/Vector4.inl b/include/Nazara/Math/Vector4.inl index e5ec906fd..918e588a5 100644 --- a/include/Nazara/Math/Vector4.inl +++ b/include/Nazara/Math/Vector4.inl @@ -339,7 +339,7 @@ bool NzVector4::operator!=(const NzVector4& vec) const template bool NzVector4::operator<(const NzVector4& vec) const { - return x < vec.x && y < vec.y && z < vec.z && w < vec.w; + return (x != vec.x) ? x < vec.x : (y != vec.y) ? y < vec.y : (z != vec.z) ? z < vec.z : w < vec.w; } template