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>
This commit is contained in:
parent
f07c27eec1
commit
8933d7c1f9
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user