diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2012-07-02 09:01:56 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-07-23 19:57:07 +0200 |
commit | 58ec01e278496bdaaee05546beb543a119de4277 (patch) | |
tree | 7a4437101eb0acaff913ad4696626b2b8cfa149d /src/corelib/tools/qhash.h | |
parent | acbfb4d777474aadd28136141082a8114d4310ac (diff) |
More qHash(T, uint) support
Add the seed to QPair, QUuid, QPersistentModelIndex's qHash(), and fix
qHash documentation for them and for many other datatypes.
Change-Id: I1386f3ed42ee1a832371a242ee5c82895ba92c2b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qhash.h')
-rw-r--r-- | src/corelib/tools/qhash.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h index 8f01cd2d91..0c322cddcf 100644 --- a/src/corelib/tools/qhash.h +++ b/src/corelib/tools/qhash.h @@ -103,11 +103,11 @@ template <class T> inline uint qHash(const T *key, uint seed = 0) #pragma warning( pop ) #endif -template <typename T1, typename T2> inline uint qHash(const QPair<T1, T2> &key) +template <typename T1, typename T2> inline uint qHash(const QPair<T1, T2> &key, uint seed = 0) { - uint h1 = qHash(key.first); - uint h2 = qHash(key.second); - return ((h1 << 16) | (h1 >> 16)) ^ h2; + uint h1 = qHash(key.first, seed); + uint h2 = qHash(key.second, seed); + return ((h1 << 16) | (h1 >> 16)) ^ h2 ^ seed; } template<typename T> inline uint qHash(const T &t, uint seed) { return (qHash(t) ^ seed); } |