From f8c30759d98603908b408464ea6d98413fc81eec Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Mon, 26 Oct 2020 09:30:49 +0100 Subject: Make the QMultiHash(const QHash &) constructor explicit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit And add a QMultiHash::unite(const QHash &) method to avoid a copy of the data when inserting a QHash into a multi hash. Change-Id: I864aa9d2b9b7b2c367c3c4d140a2ce2f5408ae09 Reviewed-by: MÃ¥rten Nordheim Reviewed-by: Thiago Macieira --- tests/auto/corelib/tools/qhash/tst_qhash.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests/auto/corelib/tools/qhash') diff --git a/tests/auto/corelib/tools/qhash/tst_qhash.cpp b/tests/auto/corelib/tools/qhash/tst_qhash.cpp index d63ed7043e..3174bd60b8 100644 --- a/tests/auto/corelib/tools/qhash/tst_qhash.cpp +++ b/tests/auto/corelib/tools/qhash/tst_qhash.cpp @@ -1320,6 +1320,12 @@ void tst_QHash::qmultihash_specific() QVERIFY(map1.remove(42,5)); QVERIFY(map2.remove(42,5)); QVERIFY(map1 == map2); + + QHash hash; + hash.insert(-1, -1); + map2.unite(hash); + QCOMPARE(map2.count(), 6); + QCOMPARE(map2[-1], -1); } } -- cgit v1.2.3