Reintroduce Vector comparison operator

Since it can be used for integer vector, also fixed comparison
technique.


Former-commit-id: 3a193ed21beb4d9b7d311eb29bc2852b0776a41c
This commit is contained in:
Lynix
2012-12-02 16:48:56 +01:00
parent 5c7a9e1011
commit 437c7047c9
6 changed files with 108 additions and 0 deletions

View File

@@ -425,6 +425,43 @@ bool NzVector4<T>::operator!=(const NzVector4& vec) const
return !operator==(vec);
}
template<typename T>
bool NzVector4<T>::operator<(const NzVector4& vec) const
{
if (x == vec.x)
{
if (y == vec.y)
{
if (z == vec.z)
return w < vec.w;
else
return z < vec.z;
}
else
return y < vec.y;
}
else
return x < vec.x;
}
template<typename T>
bool NzVector4<T>::operator<=(const NzVector4& vec) const
{
return operator<(vec) || operator==(vec);
}
template<typename T>
bool NzVector3<T>::operator>(const NzVector3& vec) const
{
return !operator<=(vec);
}
template<typename T>
bool NzVector3<T>::operator>=(const NzVector3& vec) const
{
return !operator<(vec);
}
template<typename T>
NzVector4<T> NzVector4<T>::UnitX()
{