From a6ccb1a72173cec6381d519a720dc08cfdc03720 Mon Sep 17 00:00:00 2001 From: David Faure Date: Tue, 8 Feb 2011 16:33:42 +0100 Subject: Fix compilation of QMutableSetIterator::value() with QT_STRICT_ITERATORS Merge-request: 1078 Reviewed-by: Thiago Macieira --- src/corelib/tools/qset.h | 2 +- tests/auto/qset/tst_qset.cpp | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/corelib/tools/qset.h b/src/corelib/tools/qset.h index 8075fbd..1074f99 100644 --- a/src/corelib/tools/qset.h +++ b/src/corelib/tools/qset.h @@ -330,7 +330,7 @@ class QMutableSetIterator typedef typename QSet::iterator iterator; QSet *c; iterator i, n; - inline bool item_exists() const { return n != c->constEnd(); } + inline bool item_exists() const { return c->constEnd() != n; } public: inline QMutableSetIterator(QSet &container) diff --git a/tests/auto/qset/tst_qset.cpp b/tests/auto/qset/tst_qset.cpp index 204ca55..164bf1e 100644 --- a/tests/auto/qset/tst_qset.cpp +++ b/tests/auto/qset/tst_qset.cpp @@ -39,6 +39,7 @@ ** ****************************************************************************/ +//#define QT_STRICT_ITERATORS #include #include @@ -815,6 +816,16 @@ void tst_QSet::javaMutableIterator() int sum = 0; QMutableSetIterator i(set1); while (i.hasNext()) { + i.next(); + sum += toNumber(i.value()); + } + QVERIFY(sum == 24999 * 25000 / 2); + } + + { + int sum = 0; + QMutableSetIterator i(set1); + while (i.hasNext()) { sum += toNumber(i.peekNext()); i.next(); } -- cgit v0.12