diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2014-07-22 16:08:22 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2014-07-23 17:51:12 +0200 |
commit | 8933d7c1f90d12a89ba6e8205efaaa8c3a53ec8e (patch) | |
tree | 487ce4da9126ed9e37032902841c1f7d9561054a /src/corelib | |
parent | f07c27eec117c664e3c0101c3077524647a32662 (diff) |
Document that qHash(T) must be in T's namespace, due to ADL
Due to C++'s rule of Argument-Dependent Lookup, a call to an unqualified
qHash(t) will look up qHash in T's namespace. So edit the docs saying
that it must be "global qHash" to say that it should be in the type's
namespace.
Task-number: QTBUG-34912
Change-Id: I7a72800008ccb710b4bb814e42db7a95f385f53e
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/tools/qhash.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp index 8e4f0f6407..c9271848ec 100644 --- a/src/corelib/tools/qhash.cpp +++ b/src/corelib/tools/qhash.cpp @@ -986,8 +986,8 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW A QHash's key type has additional requirements other than being an assignable data type: it must provide operator==(), and there must also be - a global qHash() function that returns a hash value for an argument of the - key's type. + a qHash() function in the type's namespace that returns a hash value for an + argument of the key's type. The qHash() function computes a numeric value based on a key. It can use any algorithm imaginable, as long as it always returns @@ -2152,8 +2152,8 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW QMultiHash's key and value data types must be \l{assignable data types}. You cannot, for example, store a QWidget as a value; instead, store a QWidget *. In addition, QMultiHash's key type - must provide operator==(), and there must also be a global - qHash() function that returns a hash value for an argument of the + must provide operator==(), and there must also be a qHash() function + in the type's namespace that returns a hash value for an argument of the key's type. See the QHash documentation for details. \sa QHash, QHashIterator, QMutableHashIterator, QMultiMap |