qt5base-lts/tests/auto/corelib/tools
Marc Mutz 08373fb02d Add qHashRange and qHashRangeCommutative
qHashRange() takes an (input iterator) range and hashes each element, combining
the hash values using the hash combiner from Boost/N1837 with the magic number
0x9e3779b9, as described here:
http://stackoverflow.com/questions/4948780/magic-number-in-boosthash-combine

qHashRangeCommutative() does the same but with a cummutative combiner (unsigned
addition) to create hash values that are order-independent, e.g. for hashed
containers. The obvious combiner, XOR, is a bad one because it eliminates
duplicate elements. Signed addition cannot be used, since signed overflow
leads to undefined behavior.

[ChangeLog][QtCore] Added qHashRange() and qHashRangeCommutative() functions to aid
implementing qHash() overloads for custom types.

Change-Id: I3c2bbc9ce4bd0455262a70e0cf248486525e534f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-01-09 12:05:35 +01:00
..
collections Update license headers and add new license files 2014-09-24 12:26:19 +02:00
qalgorithms Update license headers and add new license files 2014-09-24 12:26:19 +02:00
qarraydata Update license headers and add new license files 2014-09-24 12:26:19 +02:00
qarraydata_strictiterators Make sure all containers compile in strict-iterator mode 2014-02-22 04:38:01 +01:00
qbitarray Update license headers and add new license files 2014-09-24 12:26:19 +02:00
qbytearray Merge remote-tracking branch 'origin/5.4' into dev 2014-09-29 14:08:49 +02:00
qbytearraylist Update license headers and add new license files 2014-09-24 12:26:19 +02:00
qbytearraymatcher Update license headers and add new license files 2014-09-24 12:26:19 +02:00
qbytedatabuffer Update license headers and add new license files 2014-09-24 12:26:19 +02:00
qcache Update license headers and add new license files 2014-09-24 12:26:19 +02:00
qchar QChar: prepare relational operators for constexpr'ification 2014-12-10 01:26:51 +01:00
qcollator Update license headers and add new license files 2014-09-24 12:26:19 +02:00
qcommandlineparser Update license headers and add new license files 2014-09-24 12:26:19 +02:00
qcontiguouscache Update license headers and add new license files 2014-09-24 12:26:19 +02:00
qcryptographichash Update license headers and add new license files 2014-09-24 12:26:19 +02:00
qdate Update license headers and add new license files 2014-09-24 12:26:19 +02:00
qdatetime Add Objective-C specific type converters to QDateTime 2014-10-07 18:54:21 +02:00
qeasingcurve Merge remote-tracking branch 'origin/5.4' into dev 2014-09-29 14:08:49 +02:00
qelapsedtimer Update license headers and add new license files 2014-09-24 12:26:19 +02:00
qexplicitlyshareddatapointer Update license headers and add new license files 2014-09-24 12:26:19 +02:00
qfreelist Update license headers and add new license files 2014-09-24 12:26:19 +02:00
qhash tst_QHash: Factor qHash()-related test cases into a separate test 2015-01-05 20:18:51 +01:00
qhash_strictiterators Make sure all containers compile in strict-iterator mode 2014-02-22 04:38:01 +01:00
qhashfunctions Add qHashRange and qHashRangeCommutative 2015-01-09 12:05:35 +01:00
qline Update license headers and add new license files 2014-09-24 12:26:19 +02:00
qlinkedlist Update license headers and add new license files 2014-09-24 12:26:19 +02:00
qlist Update license headers and add new license files 2014-09-24 12:26:19 +02:00
qlist_strictiterators Make sure all containers compile in strict-iterator mode 2014-02-22 04:38:01 +01:00
qlocale Update license headers and add new license files 2014-09-24 12:26:19 +02:00
qmap Update license headers and add new license files 2014-09-24 12:26:19 +02:00
qmap_strictiterators Make sure all containers compile in strict-iterator mode 2014-02-22 04:38:01 +01:00
qmargins Update license headers and add new license files 2014-09-24 12:26:19 +02:00
qmessageauthenticationcode Update license headers and add new license files 2014-09-24 12:26:19 +02:00
qpair Update license headers and add new license files 2014-09-24 12:26:19 +02:00
qpoint Update license headers and add new license files 2014-09-24 12:26:19 +02:00
qpointf Update license headers and add new license files 2014-09-24 12:26:19 +02:00
qqueue Update license headers and add new license files 2014-09-24 12:26:19 +02:00
qrect Update license headers and add new license files 2014-09-24 12:26:19 +02:00
qregexp Update license headers and add new license files 2014-09-24 12:26:19 +02:00
qregularexpression Merge remote-tracking branch 'origin/5.4' into dev 2014-09-29 14:08:49 +02:00
qringbuffer Update license headers and add new license files 2014-09-24 12:26:19 +02:00
qscopedpointer Update license headers and add new license files 2014-09-24 12:26:19 +02:00
qscopedvaluerollback Update license headers and add new license files 2014-09-24 12:26:19 +02:00
qset tst_QSet: add a non-trivial test for op== 2015-01-05 20:18:41 +01:00
qsharedpointer tst_QSharedPointer: fix memleak 2014-10-19 13:18:02 +02:00
qsize Update license headers and add new license files 2014-09-24 12:26:19 +02:00
qsizef Update license headers and add new license files 2014-09-24 12:26:19 +02:00
qstl Update license headers and add new license files 2014-09-24 12:26:19 +02:00
qstring Use the new warning enabling/disabling macros in qtbase 2014-12-03 18:09:17 +01:00
qstring_no_cast_from_bytearray Update license headers and add new license files 2014-09-24 12:26:19 +02:00
qstringbuilder Update license headers and add new license files 2014-09-24 12:26:19 +02:00
qstringiterator Update license headers and add new license files 2014-09-24 12:26:19 +02:00
qstringlist Update license headers and add new license files 2014-09-24 12:26:19 +02:00
qstringmatcher Update license headers and add new license files 2014-09-24 12:26:19 +02:00
qstringref Make QStringRef::right() consistent with QString::right() 2014-10-14 11:32:55 +02:00
qtextboundaryfinder Update license headers and add new license files 2014-09-24 12:26:19 +02:00
qtime Update license headers and add new license files 2014-09-24 12:26:19 +02:00
qtimeline Update license headers and add new license files 2014-09-24 12:26:19 +02:00
qtimezone Update license headers and add new license files 2014-09-24 12:26:19 +02:00
qvarlengtharray Update license headers and add new license files 2014-09-24 12:26:19 +02:00
qvector Add a inline QVector::append(const QVector &) overload 2014-11-06 11:33:52 +01:00
qvector_strictiterators Make sure all containers compile in strict-iterator mode 2014-02-22 04:38:01 +01:00
qversionnumber Make QVersionNumber private 2014-11-13 20:04:44 +01:00
tools.pro tst_QHash: Factor qHash()-related test cases into a separate test 2015-01-05 20:18:51 +01:00