mirror of
https://github.com/g-truc/glm.git
synced 2025-04-04 21:15:03 +00:00
Remove overloads in glm::hash
and specilize correctly
This commit is contained in:
parent
a04b1af3fa
commit
de92b8fe96
3 changed files with 39 additions and 138 deletions
|
@ -41,17 +41,17 @@
|
|||
#include "../mat4x4.hpp"
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
// MSVC uses _MSVC_LANG instead of __cplusplus
|
||||
#if _MSVC_LANG < 201103L
|
||||
#pragma message("GLM_GTX_hash requires C++11 standard library support")
|
||||
#endif
|
||||
// MSVC uses _MSVC_LANG instead of __cplusplus
|
||||
#if _MSVC_LANG < 201103L
|
||||
#pragma message("GLM_GTX_hash requires C++11 standard library support")
|
||||
#endif
|
||||
#elif defined(__GNUC__) || defined(__clang__)
|
||||
// GNU and Clang use __cplusplus
|
||||
#if __cplusplus < 201103L
|
||||
#pragma message("GLM_GTX_hash requires C++11 standard library support")
|
||||
#endif
|
||||
// GNU and Clang use __cplusplus
|
||||
#if __cplusplus < 201103L
|
||||
#pragma message("GLM_GTX_hash requires C++11 standard library support")
|
||||
#endif
|
||||
#else
|
||||
#error "Unknown compiler"
|
||||
#error "Unknown compiler"
|
||||
#endif
|
||||
|
||||
#if GLM_LANG & GLM_LANG_CXX11
|
||||
|
@ -93,62 +93,27 @@ namespace std
|
|||
template<typename T, glm::qualifier Q>
|
||||
struct hash<glm::tdualquat<T, Q> >
|
||||
{
|
||||
GLM_FUNC_DECL size_t operator()(glm::tdualquat<T,Q> const& q) const GLM_NOEXCEPT;
|
||||
GLM_FUNC_DECL size_t operator()(glm::tdualquat<T, Q> const& q) const GLM_NOEXCEPT;
|
||||
};
|
||||
|
||||
template<typename T, glm::qualifier Q>
|
||||
struct hash<glm::mat<2, 2, T, Q> >
|
||||
template<glm::length_t R,typename T, glm::qualifier Q>
|
||||
struct hash<glm::mat<2, R, T, Q> >
|
||||
{
|
||||
GLM_FUNC_DECL size_t operator()(glm::mat<2, 2, T,Q> const& m) const GLM_NOEXCEPT;
|
||||
GLM_FUNC_DECL size_t operator()(glm::mat<2, R, T, Q> const& m) const GLM_NOEXCEPT;
|
||||
};
|
||||
|
||||
template<typename T, glm::qualifier Q>
|
||||
struct hash<glm::mat<2, 3, T, Q> >
|
||||
template<glm::length_t R,typename T, glm::qualifier Q>
|
||||
struct hash<glm::mat<3, R, T, Q> >
|
||||
{
|
||||
GLM_FUNC_DECL size_t operator()(glm::mat<2, 3, T,Q> const& m) const GLM_NOEXCEPT;
|
||||
GLM_FUNC_DECL size_t operator()(glm::mat<3, R, T, Q> const& m) const GLM_NOEXCEPT;
|
||||
};
|
||||
|
||||
template<typename T, glm::qualifier Q>
|
||||
struct hash<glm::mat<2, 4, T, Q> >
|
||||
template<glm::length_t R,typename T, glm::qualifier Q>
|
||||
struct hash<glm::mat<4, R, T, Q> >
|
||||
{
|
||||
GLM_FUNC_DECL size_t operator()(glm::mat<2, 4, T,Q> const& m) const GLM_NOEXCEPT;
|
||||
GLM_FUNC_DECL size_t operator()(glm::mat<4, R, T, Q> const& m) const GLM_NOEXCEPT;
|
||||
};
|
||||
|
||||
template<typename T, glm::qualifier Q>
|
||||
struct hash<glm::mat<3, 2, T, Q> >
|
||||
{
|
||||
GLM_FUNC_DECL size_t operator()(glm::mat<3, 2, T,Q> const& m) const GLM_NOEXCEPT;
|
||||
};
|
||||
|
||||
template<typename T, glm::qualifier Q>
|
||||
struct hash<glm::mat<3, 3, T, Q> >
|
||||
{
|
||||
GLM_FUNC_DECL size_t operator()(glm::mat<3, 3, T,Q> const& m) const GLM_NOEXCEPT;
|
||||
};
|
||||
|
||||
template<typename T, glm::qualifier Q>
|
||||
struct hash<glm::mat<3, 4, T, Q> >
|
||||
{
|
||||
GLM_FUNC_DECL size_t operator()(glm::mat<3, 4, T,Q> const& m) const GLM_NOEXCEPT;
|
||||
};
|
||||
|
||||
template<typename T, glm::qualifier Q>
|
||||
struct hash<glm::mat<4, 2, T, Q> >
|
||||
{
|
||||
GLM_FUNC_DECL size_t operator()(glm::mat<4, 2, T,Q> const& m) const GLM_NOEXCEPT;
|
||||
};
|
||||
|
||||
template<typename T, glm::qualifier Q>
|
||||
struct hash<glm::mat<4, 3, T, Q> >
|
||||
{
|
||||
GLM_FUNC_DECL size_t operator()(glm::mat<4, 3, T,Q> const& m) const GLM_NOEXCEPT;
|
||||
};
|
||||
|
||||
template<typename T, glm::qualifier Q>
|
||||
struct hash<glm::mat<4, 4, T, Q> >
|
||||
{
|
||||
GLM_FUNC_DECL size_t operator()(glm::mat<4, 4, T,Q> const& m) const GLM_NOEXCEPT;
|
||||
};
|
||||
} // namespace std
|
||||
|
||||
#include "hash.inl"
|
||||
|
|
102
glm/gtx/hash.inl
102
glm/gtx/hash.inl
|
@ -1,17 +1,18 @@
|
|||
/// @ref gtx_hash
|
||||
|
||||
namespace glm {
|
||||
namespace detail
|
||||
{
|
||||
GLM_INLINE void hash_combine(size_t &seed, size_t hash)
|
||||
namespace detail
|
||||
{
|
||||
hash += 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
seed ^= hash;
|
||||
GLM_INLINE void hash_combine(size_t& seed, size_t hash)
|
||||
{
|
||||
hash += 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
seed ^= hash;
|
||||
}
|
||||
}
|
||||
}}
|
||||
}
|
||||
|
||||
namespace std {
|
||||
|
||||
namespace std
|
||||
{
|
||||
template<typename T, glm::qualifier Q>
|
||||
GLM_FUNC_QUALIFIER size_t hash<glm::vec<1, T, Q> >::operator()(glm::vec<1, T, Q> const& v) const GLM_NOEXCEPT
|
||||
{
|
||||
|
@ -53,7 +54,7 @@ namespace std
|
|||
}
|
||||
|
||||
template<typename T, glm::qualifier Q>
|
||||
GLM_FUNC_QUALIFIER size_t hash<glm::qua<T, Q> >::operator()(glm::qua<T,Q> const& q) const GLM_NOEXCEPT
|
||||
GLM_FUNC_QUALIFIER size_t hash<glm::qua<T, Q> >::operator()(glm::qua<T, Q> const& q) const GLM_NOEXCEPT
|
||||
{
|
||||
size_t seed = 0;
|
||||
hash<T> hasher;
|
||||
|
@ -74,74 +75,32 @@ namespace std
|
|||
return seed;
|
||||
}
|
||||
|
||||
template<typename T, glm::qualifier Q>
|
||||
GLM_FUNC_QUALIFIER size_t hash<glm::mat<2, 2, T, Q> >::operator()(glm::mat<2, 2, T, Q> const& m) const GLM_NOEXCEPT
|
||||
template<glm::length_t R, typename T, glm::qualifier Q>
|
||||
GLM_FUNC_QUALIFIER size_t hash<glm::mat<2, R, T, Q> >::operator()(glm::mat<2, R, T, Q> const& m) const GLM_NOEXCEPT
|
||||
{
|
||||
size_t seed = 0;
|
||||
hash<glm::vec<2, T, Q> > hasher;
|
||||
hash<glm::vec<R, T, Q> > hasher;
|
||||
glm::detail::hash_combine(seed, hasher(m[0]));
|
||||
glm::detail::hash_combine(seed, hasher(m[1]));
|
||||
return seed;
|
||||
}
|
||||
|
||||
template<typename T, glm::qualifier Q>
|
||||
GLM_FUNC_QUALIFIER size_t hash<glm::mat<2, 3, T, Q> >::operator()(glm::mat<2, 3, T, Q> const& m) const GLM_NOEXCEPT
|
||||
template<glm::length_t R, typename T, glm::qualifier Q>
|
||||
GLM_FUNC_QUALIFIER size_t hash<glm::mat<3, R, T, Q> >::operator()(glm::mat<3, R, T, Q> const& m) const GLM_NOEXCEPT
|
||||
{
|
||||
size_t seed = 0;
|
||||
hash<glm::vec<3, T, Q> > hasher;
|
||||
glm::detail::hash_combine(seed, hasher(m[0]));
|
||||
glm::detail::hash_combine(seed, hasher(m[1]));
|
||||
return seed;
|
||||
}
|
||||
|
||||
template<typename T, glm::qualifier Q>
|
||||
GLM_FUNC_QUALIFIER size_t hash<glm::mat<2, 4, T, Q> >::operator()(glm::mat<2, 4, T, Q> const& m) const GLM_NOEXCEPT
|
||||
{
|
||||
size_t seed = 0;
|
||||
hash<glm::vec<4, T, Q> > hasher;
|
||||
glm::detail::hash_combine(seed, hasher(m[0]));
|
||||
glm::detail::hash_combine(seed, hasher(m[1]));
|
||||
return seed;
|
||||
}
|
||||
|
||||
template<typename T, glm::qualifier Q>
|
||||
GLM_FUNC_QUALIFIER size_t hash<glm::mat<3, 2, T, Q> >::operator()(glm::mat<3, 2, T, Q> const& m) const GLM_NOEXCEPT
|
||||
{
|
||||
size_t seed = 0;
|
||||
hash<glm::vec<2, T, Q> > hasher;
|
||||
hash<glm::vec<R, T, Q> > hasher;
|
||||
glm::detail::hash_combine(seed, hasher(m[0]));
|
||||
glm::detail::hash_combine(seed, hasher(m[1]));
|
||||
glm::detail::hash_combine(seed, hasher(m[2]));
|
||||
return seed;
|
||||
}
|
||||
|
||||
template<typename T, glm::qualifier Q>
|
||||
GLM_FUNC_QUALIFIER size_t hash<glm::mat<3, 3, T, Q> >::operator()(glm::mat<3, 3, T, Q> const& m) const GLM_NOEXCEPT
|
||||
template<glm::length_t R, typename T, glm::qualifier Q >
|
||||
GLM_FUNC_QUALIFIER size_t hash<glm::mat<4, R, T, Q> >::operator()(glm::mat<4, R, T, Q> const& m) const GLM_NOEXCEPT
|
||||
{
|
||||
size_t seed = 0;
|
||||
hash<glm::vec<3, T, Q> > hasher;
|
||||
glm::detail::hash_combine(seed, hasher(m[0]));
|
||||
glm::detail::hash_combine(seed, hasher(m[1]));
|
||||
glm::detail::hash_combine(seed, hasher(m[2]));
|
||||
return seed;
|
||||
}
|
||||
|
||||
template<typename T, glm::qualifier Q>
|
||||
GLM_FUNC_QUALIFIER size_t hash<glm::mat<3, 4, T, Q> >::operator()(glm::mat<3, 4, T, Q> const& m) const GLM_NOEXCEPT
|
||||
{
|
||||
size_t seed = 0;
|
||||
hash<glm::vec<4, T, Q> > hasher;
|
||||
glm::detail::hash_combine(seed, hasher(m[0]));
|
||||
glm::detail::hash_combine(seed, hasher(m[1]));
|
||||
glm::detail::hash_combine(seed, hasher(m[2]));
|
||||
return seed;
|
||||
}
|
||||
|
||||
template<typename T, glm::qualifier Q>
|
||||
GLM_FUNC_QUALIFIER size_t hash<glm::mat<4, 2, T,Q> >::operator()(glm::mat<4, 2, T,Q> const& m) const GLM_NOEXCEPT
|
||||
{
|
||||
size_t seed = 0;
|
||||
hash<glm::vec<2, T, Q> > hasher;
|
||||
hash<glm::vec<R, T, Q> > hasher;
|
||||
glm::detail::hash_combine(seed, hasher(m[0]));
|
||||
glm::detail::hash_combine(seed, hasher(m[1]));
|
||||
glm::detail::hash_combine(seed, hasher(m[2]));
|
||||
|
@ -149,27 +108,4 @@ namespace std
|
|||
return seed;
|
||||
}
|
||||
|
||||
template<typename T, glm::qualifier Q>
|
||||
GLM_FUNC_QUALIFIER size_t hash<glm::mat<4, 3, T,Q> >::operator()(glm::mat<4, 3, T,Q> const& m) const GLM_NOEXCEPT
|
||||
{
|
||||
size_t seed = 0;
|
||||
hash<glm::vec<3, T, Q> > hasher;
|
||||
glm::detail::hash_combine(seed, hasher(m[0]));
|
||||
glm::detail::hash_combine(seed, hasher(m[1]));
|
||||
glm::detail::hash_combine(seed, hasher(m[2]));
|
||||
glm::detail::hash_combine(seed, hasher(m[3]));
|
||||
return seed;
|
||||
}
|
||||
|
||||
template<typename T, glm::qualifier Q>
|
||||
GLM_FUNC_QUALIFIER size_t hash<glm::mat<4, 4, T,Q> >::operator()(glm::mat<4, 4, T, Q> const& m) const GLM_NOEXCEPT
|
||||
{
|
||||
size_t seed = 0;
|
||||
hash<glm::vec<4, T, Q> > hasher;
|
||||
glm::detail::hash_combine(seed, hasher(m[0]));
|
||||
glm::detail::hash_combine(seed, hasher(m[1]));
|
||||
glm::detail::hash_combine(seed, hasher(m[2]));
|
||||
glm::detail::hash_combine(seed, hasher(m[3]));
|
||||
return seed;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if __cplusplus >= 201103L
|
||||
#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSVC_LANG >= 201103L)
|
||||
|
||||
#include <glm/detail/setup.hpp>
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue