Merge branch 'pr/82'

This commit is contained in:
Lynix 2016-10-13 04:49:27 +02:00
commit 4de37bf9fa
6 changed files with 91 additions and 0 deletions

View File

@ -8,6 +8,7 @@
#define NAZARA_VECTOR2_HPP
#include <Nazara/Core/String.hpp>
#include <functional>
namespace Nz
{
@ -119,6 +120,11 @@ template<typename T> std::ostream& operator<<(std::ostream& out, const Nz::Vecto
template<typename T> Nz::Vector2<T> operator*(T scale, const Nz::Vector2<T>& vec);
template<typename T> Nz::Vector2<T> operator/(T scale, const Nz::Vector2<T>& vec);
namespace std
{
template<class T> struct hash<Nz::Vector2<T>>;
}
#include <Nazara/Math/Vector2.inl>
#endif // NAZARA_VECTOR2_HPP

View File

@ -1057,6 +1057,29 @@ Nz::Vector2<T> operator/(T scale, const Nz::Vector2<T>& vec)
return Nz::Vector2<T>(scale / vec.x, scale / vec.y);
}
namespace std
{
template<class T>
struct hash<Nz::Vector2<T>>
{
/*!
* \brief Specialisation of std to hash
* \return Result of the hash
*
* \param v Vector2 to hash
*/
std::size_t operator()(const Nz::Vector2<T>& v) const
{
std::size_t seed {};
Nz::HashCombine(seed, v.x);
Nz::HashCombine(seed, v.y);
return seed;
}
};
}
#undef F
#include <Nazara/Core/DebugOff.hpp>

View File

@ -8,6 +8,7 @@
#define NAZARA_VECTOR3_HPP
#include <Nazara/Core/String.hpp>
#include <functional>
namespace Nz
{
@ -141,6 +142,11 @@ template<typename T> std::ostream& operator<<(std::ostream& out, const Nz::Vecto
template<typename T> Nz::Vector3<T> operator*(T scale, const Nz::Vector3<T>& vec);
template<typename T> Nz::Vector3<T> operator/(T scale, const Nz::Vector3<T>& vec);
namespace std
{
template<class T> struct hash<Nz::Vector3<T>>;
}
#include <Nazara/Math/Vector3.inl>
#endif // NAZARA_VECTOR3_HPP

View File

@ -1347,6 +1347,31 @@ Nz::Vector3<T> operator/(T scale, const Nz::Vector3<T>& vec)
return Nz::Vector3<T>(scale / vec.x, scale / vec.y, scale / vec.z);
}
namespace std
{
template<class T>
struct hash<Nz::Vector3<T>>
{
/*!
* \brief Specialisation of std to hash
* \return Result of the hash
*
* \param v Vector3 to hash
*/
std::size_t operator()(const Nz::Vector3<T>& v) const
{
std::size_t seed {};
Nz::HashCombine(seed, v.x);
Nz::HashCombine(seed, v.y);
Nz::HashCombine(seed, v.z);
return seed;
}
};
}
#undef F
#include <Nazara/Core/DebugOff.hpp>

View File

@ -8,6 +8,7 @@
#define NAZARA_VECTOR4_HPP
#include <Nazara/Core/String.hpp>
#include <functional>
namespace Nz
{
@ -117,6 +118,11 @@ template<typename T> std::ostream& operator<<(std::ostream& out, const Nz::Vecto
template<typename T> Nz::Vector4<T> operator*(T scale, const Nz::Vector4<T>& vec);
template<typename T> Nz::Vector4<T> operator/(T scale, const Nz::Vector4<T>& vec);
namespace std
{
template<class T> struct hash<Nz::Vector4<T>>;
}
#include <Nazara/Math/Vector4.inl>
#endif // NAZARA_VECTOR4_HPP

View File

@ -1120,6 +1120,31 @@ Nz::Vector4<T> operator/(T scale, const Nz::Vector4<T>& vec)
return Nz::Vector4<T>(scale / vec.x, scale / vec.y, scale / vec.z, scale / vec.w);
}
namespace std
{
template<class T>
struct hash<Nz::Vector4<T>>
{
/*!
* \brief Specialisation of std to hash
* \return Result of the hash
*
* \param v Vector4 to hash
*/
std::size_t operator()(const Nz::Vector4<T>& v) const
{
std::size_t seed {};
Nz::HashCombine(seed, v.x);
Nz::HashCombine(seed, v.y);
Nz::HashCombine(seed, v.z);
Nz::HashCombine(seed, v.w);
return seed;
}
};
}
#undef F
#include <Nazara/Core/DebugOff.hpp>