QVarLengthArray: add qHash overload

[ChangeLog][QtCore][QVarLengthArray] Added a qHash overload.

Change-Id: I771203ae3bb575b49f70e9114287dd2690031b42
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Giuseppe D'Angelo 2019-06-23 15:22:28 +02:00
parent 5e86aa93fc
commit 7eb070b450
2 changed files with 16 additions and 0 deletions

View File

@ -44,6 +44,7 @@
#include <QtCore/qglobal.h>
#include <QtCore/qalgorithms.h>
#include <QtCore/qcontainertools_impl.h>
#include <QtCore/qhashfunctions.h>
#include <algorithm>
#include <initializer_list>
@ -599,6 +600,13 @@ inline bool operator>=(const QVarLengthArray<T, Prealloc1> &lhs, const QVarLengt
return !(lhs < rhs);
}
template <typename T, int Prealloc>
uint qHash(const QVarLengthArray<T, Prealloc> &key, uint seed = 0)
noexcept(noexcept(qHashRange(key.cbegin(), key.cend(), seed)))
{
return qHashRange(key.cbegin(), key.cend(), seed);
}
QT_END_NAMESPACE
#endif // QVARLENGTHARRAY_H

View File

@ -903,3 +903,11 @@
\sa indexOf(), lastIndexOf()
*/
/*!
template <typename T, int Prealloc> uint qHash(const QVarLengthArray<T, Prealloc> &key, uint seed = 0)
\relates QVarLengthArray
\since 5.14
Returns the hash value for \a key, using \a seed to seed the
calculation.
*/