From 8933d7c1f90d12a89ba6e8205efaaa8c3a53ec8e Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 22 Jul 2014 16:08:22 -0700 Subject: 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 Reviewed-by: Marc Mutz --- src/corelib/tools/qhash.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/corelib') 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 -- cgit v1.2.3