diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2015-12-28 15:58:03 +0100 |
---|---|---|
committer | Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com> | 2015-12-30 11:37:53 +0000 |
commit | d681107f1fcbaabe7da27ac51563434b81b95d8e (patch) | |
tree | 5060bcb500d29f3d50c82b640bfcd89bfdd50d2f /tests | |
parent | ad74c953998133887ac2362800772e0fa01dd3da (diff) |
Add qHash(std::pair)
We already include <utility> in <qglobal.h>, so we might
as well provide a qHash() overload for std::pair.
[ChangeLog][QtCore] Added qHash(std::pair), defined in
<QHashFunctions>.
Change-Id: I0f61c513e82e05ce9d2e56bcf18f3be9e2da4da9
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp b/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp index bde9433a24..6cd8c3d29d 100644 --- a/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp +++ b/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp @@ -115,6 +115,22 @@ void tst_QHashFunctions::qhash() QVERIFY(qHash(pA) != qHash(pB)); } + + { + std::pair<int, int> p12(1, 2); + std::pair<int, int> p21(2, 1); + + using QT_PREPEND_NAMESPACE(qHash); + + QVERIFY(qHash(p12) == qHash(p12)); + QVERIFY(qHash(p21) == qHash(p21)); + QVERIFY(qHash(p12) != qHash(p21)); + + std::pair<int, int> pA(0x12345678, 0x12345678); + std::pair<int, int> pB(0x12345675, 0x12345675); + + QVERIFY(qHash(pA) != qHash(pB)); + } } void tst_QHashFunctions::fp_qhash_of_zero_is_zero() |