From 14420b359b2d14d202df8df841af5e88f16352a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20=C4=8Cuki=C4=87?= Date: Fri, 10 Jan 2020 18:13:41 +0100 Subject: Add operator-> to the key-value iterator for QHash and QMap This patch adds the arrow operator to the stl-like key-value iterator (QKeyValueIterator) for QMap and QHash. This allows using normal member access syntax it->first and it->second instead of having to use (*it).first and (*it).second. [ChangeLog][QtCore][Containers] Added operator-> to the key-value iterator for QHash/QMap. Change-Id: I9cfa6480784ebce147fcfbf37fec5ad0080e2899 Reviewed-by: Vitaly Fanaskov --- 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 b98ac38288..134b3ff4c0 100644 --- a/tests/auto/corelib/tools/qhash/tst_qhash.cpp +++ b/tests/auto/corelib/tools/qhash/tst_qhash.cpp @@ -1144,6 +1144,12 @@ void tst_QHash::keyValueIterator() entry_type pair(it.key(), it.value()); QCOMPARE(*key_value_it, pair); + QCOMPARE(key_value_it->first, pair.first); + QCOMPARE(key_value_it->second, pair.second); + QCOMPARE(&(*key_value_it).first, &it.key()); + QCOMPARE(&key_value_it->first, &it.key()); + QCOMPARE(&(*key_value_it).second, &it.value()); + QCOMPARE(&key_value_it->second, &it.value()); ++key_value_it; ++it; } -- cgit v1.2.3