Merge pull request #1113 from genpfault/fix-noexcept-warnings

GCC: Fix noexcept warnings on hash functions #1113
This commit is contained in:
Christophe 2022-10-24 12:18:30 +02:00 committed by GitHub
commit 8339c77bd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 134 additions and 66 deletions

View File

@ -360,6 +360,18 @@
# define GLM_HAS_BITSCAN_WINDOWS 0 # define GLM_HAS_BITSCAN_WINDOWS 0
#endif #endif
#if GLM_LANG & GLM_LANG_CXX11_FLAG
# define GLM_HAS_NOEXCEPT 1
#else
# define GLM_HAS_NOEXCEPT 0
#endif
#if GLM_HAS_NOEXCEPT
# define GLM_NOEXCEPT noexcept
#else
# define GLM_NOEXCEPT
#endif
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
// OpenMP // OpenMP
#ifdef _OPENMP #ifdef _OPENMP

View File

@ -27,8 +27,8 @@ namespace glm
typedef length_t length_type; typedef length_t length_type;
GLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 2; } GLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 2; }
GLM_FUNC_DECL col_type & operator[](length_type i); GLM_FUNC_DECL col_type & operator[](length_type i) GLM_NOEXCEPT;
GLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const; GLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const GLM_NOEXCEPT;
// -- Constructors -- // -- Constructors --

View File

@ -217,14 +217,14 @@ namespace glm
// -- Accesses -- // -- Accesses --
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER typename mat<2, 2, T, Q>::col_type& mat<2, 2, T, Q>::operator[](typename mat<2, 2, T, Q>::length_type i) GLM_FUNC_QUALIFIER typename mat<2, 2, T, Q>::col_type& mat<2, 2, T, Q>::operator[](typename mat<2, 2, T, Q>::length_type i) GLM_NOEXCEPT
{ {
assert(i < this->length()); assert(i < this->length());
return this->value[i]; return this->value[i];
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<2, 2, T, Q>::col_type const& mat<2, 2, T, Q>::operator[](typename mat<2, 2, T, Q>::length_type i) const GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<2, 2, T, Q>::col_type const& mat<2, 2, T, Q>::operator[](typename mat<2, 2, T, Q>::length_type i) const GLM_NOEXCEPT
{ {
assert(i < this->length()); assert(i < this->length());
return this->value[i]; return this->value[i];

View File

@ -28,8 +28,8 @@ namespace glm
typedef length_t length_type; typedef length_t length_type;
GLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 2; } GLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 2; }
GLM_FUNC_DECL col_type & operator[](length_type i); GLM_FUNC_DECL col_type & operator[](length_type i) GLM_NOEXCEPT;
GLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const; GLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const GLM_NOEXCEPT;
// -- Constructors -- // -- Constructors --

View File

@ -217,14 +217,14 @@ namespace glm
// -- Accesses -- // -- Accesses --
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER typename mat<2, 3, T, Q>::col_type & mat<2, 3, T, Q>::operator[](typename mat<2, 3, T, Q>::length_type i) GLM_FUNC_QUALIFIER typename mat<2, 3, T, Q>::col_type & mat<2, 3, T, Q>::operator[](typename mat<2, 3, T, Q>::length_type i) GLM_NOEXCEPT
{ {
assert(i < this->length()); assert(i < this->length());
return this->value[i]; return this->value[i];
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<2, 3, T, Q>::col_type const& mat<2, 3, T, Q>::operator[](typename mat<2, 3, T, Q>::length_type i) const GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<2, 3, T, Q>::col_type const& mat<2, 3, T, Q>::operator[](typename mat<2, 3, T, Q>::length_type i) const GLM_NOEXCEPT
{ {
assert(i < this->length()); assert(i < this->length());
return this->value[i]; return this->value[i];

View File

@ -28,8 +28,8 @@ namespace glm
typedef length_t length_type; typedef length_t length_type;
GLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 2; } GLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 2; }
GLM_FUNC_DECL col_type & operator[](length_type i); GLM_FUNC_DECL col_type & operator[](length_type i) GLM_NOEXCEPT;
GLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const; GLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const GLM_NOEXCEPT;
// -- Constructors -- // -- Constructors --

View File

@ -219,14 +219,14 @@ namespace glm
// -- Accesses -- // -- Accesses --
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER typename mat<2, 4, T, Q>::col_type & mat<2, 4, T, Q>::operator[](typename mat<2, 4, T, Q>::length_type i) GLM_FUNC_QUALIFIER typename mat<2, 4, T, Q>::col_type & mat<2, 4, T, Q>::operator[](typename mat<2, 4, T, Q>::length_type i) GLM_NOEXCEPT
{ {
assert(i < this->length()); assert(i < this->length());
return this->value[i]; return this->value[i];
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<2, 4, T, Q>::col_type const& mat<2, 4, T, Q>::operator[](typename mat<2, 4, T, Q>::length_type i) const GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<2, 4, T, Q>::col_type const& mat<2, 4, T, Q>::operator[](typename mat<2, 4, T, Q>::length_type i) const GLM_NOEXCEPT
{ {
assert(i < this->length()); assert(i < this->length());
return this->value[i]; return this->value[i];

View File

@ -28,8 +28,8 @@ namespace glm
typedef length_t length_type; typedef length_t length_type;
GLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 3; } GLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 3; }
GLM_FUNC_DECL col_type & operator[](length_type i); GLM_FUNC_DECL col_type & operator[](length_type i) GLM_NOEXCEPT;
GLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const; GLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const GLM_NOEXCEPT;
// -- Constructors -- // -- Constructors --

View File

@ -236,14 +236,14 @@ namespace glm
// -- Accesses -- // -- Accesses --
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER typename mat<3, 2, T, Q>::col_type & mat<3, 2, T, Q>::operator[](typename mat<3, 2, T, Q>::length_type i) GLM_FUNC_QUALIFIER typename mat<3, 2, T, Q>::col_type & mat<3, 2, T, Q>::operator[](typename mat<3, 2, T, Q>::length_type i) GLM_NOEXCEPT
{ {
assert(i < this->length()); assert(i < this->length());
return this->value[i]; return this->value[i];
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<3, 2, T, Q>::col_type const& mat<3, 2, T, Q>::operator[](typename mat<3, 2, T, Q>::length_type i) const GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<3, 2, T, Q>::col_type const& mat<3, 2, T, Q>::operator[](typename mat<3, 2, T, Q>::length_type i) const GLM_NOEXCEPT
{ {
assert(i < this->length()); assert(i < this->length());
return this->value[i]; return this->value[i];

View File

@ -27,8 +27,8 @@ namespace glm
typedef length_t length_type; typedef length_t length_type;
GLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 3; } GLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 3; }
GLM_FUNC_DECL col_type & operator[](length_type i); GLM_FUNC_DECL col_type & operator[](length_type i) GLM_NOEXCEPT;
GLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const; GLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const GLM_NOEXCEPT;
// -- Constructors -- // -- Constructors --

View File

@ -238,14 +238,14 @@ namespace glm
// -- Accesses -- // -- Accesses --
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER typename mat<3, 3, T, Q>::col_type & mat<3, 3, T, Q>::operator[](typename mat<3, 3, T, Q>::length_type i) GLM_FUNC_QUALIFIER typename mat<3, 3, T, Q>::col_type & mat<3, 3, T, Q>::operator[](typename mat<3, 3, T, Q>::length_type i) GLM_NOEXCEPT
{ {
assert(i < this->length()); assert(i < this->length());
return this->value[i]; return this->value[i];
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<3, 3, T, Q>::col_type const& mat<3, 3, T, Q>::operator[](typename mat<3, 3, T, Q>::length_type i) const GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<3, 3, T, Q>::col_type const& mat<3, 3, T, Q>::operator[](typename mat<3, 3, T, Q>::length_type i) const GLM_NOEXCEPT
{ {
assert(i < this->length()); assert(i < this->length());
return this->value[i]; return this->value[i];

View File

@ -28,8 +28,8 @@ namespace glm
typedef length_t length_type; typedef length_t length_type;
GLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 3; } GLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 3; }
GLM_FUNC_DECL col_type & operator[](length_type i); GLM_FUNC_DECL col_type & operator[](length_type i) GLM_NOEXCEPT;
GLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const; GLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const GLM_NOEXCEPT;
// -- Constructors -- // -- Constructors --

View File

@ -242,14 +242,14 @@ namespace glm
// -- Accesses -- // -- Accesses --
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER typename mat<3, 4, T, Q>::col_type & mat<3, 4, T, Q>::operator[](typename mat<3, 4, T, Q>::length_type i) GLM_FUNC_QUALIFIER typename mat<3, 4, T, Q>::col_type & mat<3, 4, T, Q>::operator[](typename mat<3, 4, T, Q>::length_type i) GLM_NOEXCEPT
{ {
assert(i < this->length()); assert(i < this->length());
return this->value[i]; return this->value[i];
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<3, 4, T, Q>::col_type const& mat<3, 4, T, Q>::operator[](typename mat<3, 4, T, Q>::length_type i) const GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<3, 4, T, Q>::col_type const& mat<3, 4, T, Q>::operator[](typename mat<3, 4, T, Q>::length_type i) const GLM_NOEXCEPT
{ {
assert(i < this->length()); assert(i < this->length());
return this->value[i]; return this->value[i];

View File

@ -28,8 +28,8 @@ namespace glm
typedef length_t length_type; typedef length_t length_type;
GLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 4; } GLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 4; }
GLM_FUNC_DECL col_type & operator[](length_type i); GLM_FUNC_DECL col_type & operator[](length_type i) GLM_NOEXCEPT;
GLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const; GLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const GLM_NOEXCEPT;
// -- Constructors -- // -- Constructors --

View File

@ -255,14 +255,14 @@ namespace glm
// -- Accesses -- // -- Accesses --
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER typename mat<4, 2, T, Q>::col_type & mat<4, 2, T, Q>::operator[](typename mat<4, 2, T, Q>::length_type i) GLM_FUNC_QUALIFIER typename mat<4, 2, T, Q>::col_type & mat<4, 2, T, Q>::operator[](typename mat<4, 2, T, Q>::length_type i) GLM_NOEXCEPT
{ {
assert(i < this->length()); assert(i < this->length());
return this->value[i]; return this->value[i];
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<4, 2, T, Q>::col_type const& mat<4, 2, T, Q>::operator[](typename mat<4, 2, T, Q>::length_type i) const GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<4, 2, T, Q>::col_type const& mat<4, 2, T, Q>::operator[](typename mat<4, 2, T, Q>::length_type i) const GLM_NOEXCEPT
{ {
assert(i < this->length()); assert(i < this->length());
return this->value[i]; return this->value[i];

View File

@ -28,8 +28,8 @@ namespace glm
typedef length_t length_type; typedef length_t length_type;
GLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 4; } GLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 4; }
GLM_FUNC_DECL col_type & operator[](length_type i); GLM_FUNC_DECL col_type & operator[](length_type i) GLM_NOEXCEPT;
GLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const; GLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const GLM_NOEXCEPT;
// -- Constructors -- // -- Constructors --

View File

@ -255,14 +255,14 @@ namespace glm
// -- Accesses -- // -- Accesses --
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER typename mat<4, 3, T, Q>::col_type & mat<4, 3, T, Q>::operator[](typename mat<4, 3, T, Q>::length_type i) GLM_FUNC_QUALIFIER typename mat<4, 3, T, Q>::col_type & mat<4, 3, T, Q>::operator[](typename mat<4, 3, T, Q>::length_type i) GLM_NOEXCEPT
{ {
assert(i < this->length()); assert(i < this->length());
return this->value[i]; return this->value[i];
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<4, 3, T, Q>::col_type const& mat<4, 3, T, Q>::operator[](typename mat<4, 3, T, Q>::length_type i) const GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<4, 3, T, Q>::col_type const& mat<4, 3, T, Q>::operator[](typename mat<4, 3, T, Q>::length_type i) const GLM_NOEXCEPT
{ {
assert(i < this->length()); assert(i < this->length());
return this->value[i]; return this->value[i];

View File

@ -27,8 +27,8 @@ namespace glm
typedef length_t length_type; typedef length_t length_type;
GLM_FUNC_DECL static GLM_CONSTEXPR length_type length(){return 4;} GLM_FUNC_DECL static GLM_CONSTEXPR length_type length(){return 4;}
GLM_FUNC_DECL col_type & operator[](length_type i); GLM_FUNC_DECL col_type & operator[](length_type i) GLM_NOEXCEPT;
GLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const; GLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const GLM_NOEXCEPT;
// -- Constructors -- // -- Constructors --

View File

@ -286,14 +286,14 @@ namespace glm
// -- Accesses -- // -- Accesses --
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER typename mat<4, 4, T, Q>::col_type & mat<4, 4, T, Q>::operator[](typename mat<4, 4, T, Q>::length_type i) GLM_FUNC_QUALIFIER typename mat<4, 4, T, Q>::col_type & mat<4, 4, T, Q>::operator[](typename mat<4, 4, T, Q>::length_type i) GLM_NOEXCEPT
{ {
assert(i < this->length()); assert(i < this->length());
return this->value[i]; return this->value[i];
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<4, 4, T, Q>::col_type const& mat<4, 4, T, Q>::operator[](typename mat<4, 4, T, Q>::length_type i) const GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<4, 4, T, Q>::col_type const& mat<4, 4, T, Q>::operator[](typename mat<4, 4, T, Q>::length_type i) const GLM_NOEXCEPT
{ {
assert(i < this->length()); assert(i < this->length());
return this->value[i]; return this->value[i];

View File

@ -51,91 +51,91 @@ namespace std
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
struct hash<glm::vec<1, T,Q> > struct hash<glm::vec<1, T,Q> >
{ {
GLM_FUNC_DECL size_t operator()(glm::vec<1, T, Q> const& v) const; GLM_FUNC_DECL size_t operator()(glm::vec<1, T, Q> const& v) const GLM_NOEXCEPT;
}; };
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
struct hash<glm::vec<2, T,Q> > struct hash<glm::vec<2, T,Q> >
{ {
GLM_FUNC_DECL size_t operator()(glm::vec<2, T, Q> const& v) const; GLM_FUNC_DECL size_t operator()(glm::vec<2, T, Q> const& v) const GLM_NOEXCEPT;
}; };
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
struct hash<glm::vec<3, T,Q> > struct hash<glm::vec<3, T,Q> >
{ {
GLM_FUNC_DECL size_t operator()(glm::vec<3, T, Q> const& v) const; GLM_FUNC_DECL size_t operator()(glm::vec<3, T, Q> const& v) const GLM_NOEXCEPT;
}; };
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
struct hash<glm::vec<4, T,Q> > struct hash<glm::vec<4, T,Q> >
{ {
GLM_FUNC_DECL size_t operator()(glm::vec<4, T, Q> const& v) const; GLM_FUNC_DECL size_t operator()(glm::vec<4, T, Q> const& v) const GLM_NOEXCEPT;
}; };
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
struct hash<glm::qua<T,Q>> struct hash<glm::qua<T,Q>>
{ {
GLM_FUNC_DECL size_t operator()(glm::qua<T, Q> const& q) const; GLM_FUNC_DECL size_t operator()(glm::qua<T, Q> const& q) const GLM_NOEXCEPT;
}; };
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
struct hash<glm::tdualquat<T,Q> > struct hash<glm::tdualquat<T,Q> >
{ {
GLM_FUNC_DECL size_t operator()(glm::tdualquat<T,Q> const& q) const; GLM_FUNC_DECL size_t operator()(glm::tdualquat<T,Q> const& q) const GLM_NOEXCEPT;
}; };
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
struct hash<glm::mat<2, 2, T,Q> > struct hash<glm::mat<2, 2, T,Q> >
{ {
GLM_FUNC_DECL size_t operator()(glm::mat<2, 2, T,Q> const& m) const; GLM_FUNC_DECL size_t operator()(glm::mat<2, 2, T,Q> const& m) const GLM_NOEXCEPT;
}; };
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
struct hash<glm::mat<2, 3, T,Q> > struct hash<glm::mat<2, 3, T,Q> >
{ {
GLM_FUNC_DECL size_t operator()(glm::mat<2, 3, T,Q> const& m) const; GLM_FUNC_DECL size_t operator()(glm::mat<2, 3, T,Q> const& m) const GLM_NOEXCEPT;
}; };
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
struct hash<glm::mat<2, 4, T,Q> > struct hash<glm::mat<2, 4, T,Q> >
{ {
GLM_FUNC_DECL size_t operator()(glm::mat<2, 4, T,Q> const& m) const; GLM_FUNC_DECL size_t operator()(glm::mat<2, 4, T,Q> const& m) const GLM_NOEXCEPT;
}; };
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
struct hash<glm::mat<3, 2, T,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_FUNC_DECL size_t operator()(glm::mat<3, 2, T,Q> const& m) const GLM_NOEXCEPT;
}; };
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
struct hash<glm::mat<3, 3, T,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_FUNC_DECL size_t operator()(glm::mat<3, 3, T,Q> const& m) const GLM_NOEXCEPT;
}; };
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
struct hash<glm::mat<3, 4, T,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_FUNC_DECL size_t operator()(glm::mat<3, 4, T,Q> const& m) const GLM_NOEXCEPT;
}; };
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
struct hash<glm::mat<4, 2, T,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_FUNC_DECL size_t operator()(glm::mat<4, 2, T,Q> const& m) const GLM_NOEXCEPT;
}; };
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
struct hash<glm::mat<4, 3, T,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_FUNC_DECL size_t operator()(glm::mat<4, 3, T,Q> const& m) const GLM_NOEXCEPT;
}; };
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
struct hash<glm::mat<4, 4, T,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_FUNC_DECL size_t operator()(glm::mat<4, 4, T,Q> const& m) const GLM_NOEXCEPT;
}; };
} // namespace std } // namespace std

View File

@ -13,14 +13,14 @@ namespace detail
namespace std namespace std
{ {
template<typename T, glm::qualifier Q> 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_FUNC_QUALIFIER size_t hash<glm::vec<1, T, Q>>::operator()(glm::vec<1, T, Q> const& v) const GLM_NOEXCEPT
{ {
hash<T> hasher; hash<T> hasher;
return hasher(v.x); return hasher(v.x);
} }
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
GLM_FUNC_QUALIFIER size_t hash<glm::vec<2, T, Q>>::operator()(glm::vec<2, T, Q> const& v) const GLM_FUNC_QUALIFIER size_t hash<glm::vec<2, T, Q>>::operator()(glm::vec<2, T, Q> const& v) const GLM_NOEXCEPT
{ {
size_t seed = 0; size_t seed = 0;
hash<T> hasher; hash<T> hasher;
@ -30,7 +30,7 @@ namespace std
} }
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
GLM_FUNC_QUALIFIER size_t hash<glm::vec<3, T, Q>>::operator()(glm::vec<3, T, Q> const& v) const GLM_FUNC_QUALIFIER size_t hash<glm::vec<3, T, Q>>::operator()(glm::vec<3, T, Q> const& v) const GLM_NOEXCEPT
{ {
size_t seed = 0; size_t seed = 0;
hash<T> hasher; hash<T> hasher;
@ -41,7 +41,7 @@ namespace std
} }
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
GLM_FUNC_QUALIFIER size_t hash<glm::vec<4, T, Q>>::operator()(glm::vec<4, T, Q> const& v) const GLM_FUNC_QUALIFIER size_t hash<glm::vec<4, T, Q>>::operator()(glm::vec<4, T, Q> const& v) const GLM_NOEXCEPT
{ {
size_t seed = 0; size_t seed = 0;
hash<T> hasher; hash<T> hasher;
@ -53,7 +53,7 @@ namespace std
} }
template<typename T, glm::qualifier Q> 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_FUNC_QUALIFIER size_t hash<glm::qua<T, Q>>::operator()(glm::qua<T,Q> const& q) const GLM_NOEXCEPT
{ {
size_t seed = 0; size_t seed = 0;
hash<T> hasher; hash<T> hasher;
@ -65,7 +65,7 @@ namespace std
} }
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
GLM_FUNC_QUALIFIER size_t hash<glm::tdualquat<T, Q>>::operator()(glm::tdualquat<T, Q> const& q) const GLM_FUNC_QUALIFIER size_t hash<glm::tdualquat<T, Q>>::operator()(glm::tdualquat<T, Q> const& q) const GLM_NOEXCEPT
{ {
size_t seed = 0; size_t seed = 0;
hash<glm::qua<T, Q>> hasher; hash<glm::qua<T, Q>> hasher;
@ -75,7 +75,7 @@ namespace std
} }
template<typename T, glm::qualifier Q> 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_FUNC_QUALIFIER size_t hash<glm::mat<2, 2, T, Q>>::operator()(glm::mat<2, 2, T, Q> const& m) const GLM_NOEXCEPT
{ {
size_t seed = 0; size_t seed = 0;
hash<glm::vec<2, T, Q>> hasher; hash<glm::vec<2, T, Q>> hasher;
@ -85,7 +85,7 @@ namespace std
} }
template<typename T, glm::qualifier Q> 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_FUNC_QUALIFIER size_t hash<glm::mat<2, 3, T, Q>>::operator()(glm::mat<2, 3, T, Q> const& m) const GLM_NOEXCEPT
{ {
size_t seed = 0; size_t seed = 0;
hash<glm::vec<3, T, Q>> hasher; hash<glm::vec<3, T, Q>> hasher;
@ -95,7 +95,7 @@ namespace std
} }
template<typename T, glm::qualifier Q> 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_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; size_t seed = 0;
hash<glm::vec<4, T, Q>> hasher; hash<glm::vec<4, T, Q>> hasher;
@ -105,7 +105,7 @@ namespace std
} }
template<typename T, glm::qualifier Q> 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_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; size_t seed = 0;
hash<glm::vec<2, T, Q>> hasher; hash<glm::vec<2, T, Q>> hasher;
@ -116,7 +116,7 @@ namespace std
} }
template<typename T, glm::qualifier Q> 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_FUNC_QUALIFIER size_t hash<glm::mat<3, 3, T, Q>>::operator()(glm::mat<3, 3, T, Q> const& m) const GLM_NOEXCEPT
{ {
size_t seed = 0; size_t seed = 0;
hash<glm::vec<3, T, Q>> hasher; hash<glm::vec<3, T, Q>> hasher;
@ -127,7 +127,7 @@ namespace std
} }
template<typename T, glm::qualifier Q> 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_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; size_t seed = 0;
hash<glm::vec<4, T, Q>> hasher; hash<glm::vec<4, T, Q>> hasher;
@ -138,7 +138,7 @@ namespace std
} }
template<typename T, glm::qualifier Q> 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_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; size_t seed = 0;
hash<glm::vec<2, T, Q>> hasher; hash<glm::vec<2, T, Q>> hasher;
@ -150,7 +150,7 @@ namespace std
} }
template<typename T, glm::qualifier Q> 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_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; size_t seed = 0;
hash<glm::vec<3, T, Q>> hasher; hash<glm::vec<3, T, Q>> hasher;
@ -162,7 +162,7 @@ namespace std
} }
template<typename T, glm::qualifier Q> 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_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; size_t seed = 0;
hash<glm::vec<4, T, Q>> hasher; hash<glm::vec<4, T, Q>> hasher;

View File

@ -18,6 +18,7 @@ glmCreateTestGTC(gtx_fast_trigonometry)
glmCreateTestGTC(gtx_functions) glmCreateTestGTC(gtx_functions)
glmCreateTestGTC(gtx_gradient_paint) glmCreateTestGTC(gtx_gradient_paint)
glmCreateTestGTC(gtx_handed_coordinate_space) glmCreateTestGTC(gtx_handed_coordinate_space)
glmCreateTestGTC(gtx_hash)
glmCreateTestGTC(gtx_integer) glmCreateTestGTC(gtx_integer)
glmCreateTestGTC(gtx_intersect) glmCreateTestGTC(gtx_intersect)
glmCreateTestGTC(gtx_io) glmCreateTestGTC(gtx_io)

55
test/gtx/gtx_hash.cpp Normal file
View File

@ -0,0 +1,55 @@
#define GLM_ENABLE_EXPERIMENTAL
#include <glm/gtx/hash.hpp>
#include <unordered_map>
int test_compile()
{
int Error = 0;
// Vector types
std::unordered_map<glm::vec1, int> map_vec1;
Error += ++map_vec1[glm::vec1(0.0f)];
std::unordered_map<glm::vec2, int> map_vec2;
Error += ++map_vec2[glm::vec2(0.0f)];
std::unordered_map<glm::vec3, int> map_vec3;
Error += ++map_vec3[glm::vec3(0.0f)];
std::unordered_map<glm::vec4, int> map_vec4;
Error += ++map_vec4[glm::vec4(0.0f)];
// Quaternion types
std::unordered_map<glm::quat, int> map_quat;
Error += ++map_quat[glm::quat(0.0f, glm::vec3(0.0f))];
std::unordered_map<glm::dualquat, int> map_dualquat;
Error += ++map_dualquat[glm::dualquat(glm::vec3(0.0f))];
// Matrix types
std::unordered_map<glm::mat2x2, int> map_mat2x2;
Error += ++map_mat2x2[glm::mat2x2(0.0f)];
std::unordered_map<glm::mat2x3, int> map_mat2x3;
Error += ++map_mat2x3[glm::mat2x3(0.0f)];
std::unordered_map<glm::mat2x4, int> map_mat2x4;
Error += ++map_mat2x4[glm::mat2x4(0.0f)];
std::unordered_map<glm::mat3x2, int> map_mat3x2;
Error += ++map_mat3x2[glm::mat3x2(0.0f)];
std::unordered_map<glm::mat3x3, int> map_mat3x3;
Error += ++map_mat3x3[glm::mat3x3(0.0f)];
std::unordered_map<glm::mat3x4, int> map_mat3x4;
Error += ++map_mat3x4[glm::mat3x4(0.0f)];
std::unordered_map<glm::mat4x2, int> map_mat4x2;
Error += ++map_mat4x2[glm::mat4x2(0.0f)];
std::unordered_map<glm::mat4x3, int> map_mat4x3;
Error += ++map_mat4x3[glm::mat4x3(0.0f)];
std::unordered_map<glm::mat4x4, int> map_mat4x4;
Error += ++map_mat4x4[glm::mat4x4(0.0f)];
return Error > 0 ? 0 : 1;
}
int main()
{
int Error = 0;
Error += test_compile();
return Error;
}