summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-05-28 16:45:00 +0200
committerQt Continuous Integration System <qt-info@nokia.com>2010-05-28 16:45:00 +0200
commit035129c96d714ba6183057ff2b77658d993394db (patch)
tree317249b0df389d4d13616be8903e1d96330a1565
parent25a789c836fd856c0bcda4aeaa51c6e5a99924f5 (diff)
parent9228b527f2fa95aad7f34cbc44905fb8b371bbf7 (diff)
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.6-integration
* '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2: test QMultiMap::operator+= and QMultiHash::operator+= QMultiMap/QMultiHash: must qualify identifier to find this declaration in dependent base class
-rw-r--r--src/corelib/tools/qhash.h9
-rw-r--r--src/corelib/tools/qmap.h9
-rw-r--r--tests/auto/qhash/tst_qhash.cpp20
-rw-r--r--tests/auto/qmap/tst_qmap.cpp20
4 files changed, 44 insertions, 14 deletions
diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h
index 05eae42eff..1d206ce2b8 100644
--- a/src/corelib/tools/qhash.h
+++ b/src/corelib/tools/qhash.h
@@ -927,7 +927,7 @@ public:
{ return QHash<Key, T>::insertMulti(key, value); }
inline QMultiHash &operator+=(const QMultiHash &other)
- { unite(other); return *this; }
+ { this->unite(other); return *this; }
inline QMultiHash operator+(const QMultiHash &other) const
{ QMultiHash result = *this; result += other; return result; }
@@ -1002,12 +1002,7 @@ Q_INLINE_TEMPLATE int QMultiHash<Key, T>::remove(const Key &key, const T &value)
typename QHash<Key, T>::iterator end(QHash<Key, T>::end());
while (i != end && i.key() == key) {
if (i.value() == value) {
-#if defined(Q_CC_RVCT)
- // RVCT has problems with scoping, apparently.
- i = QHash<Key, T>::erase(i);
-#else
- i = erase(i);
-#endif
+ i = this->erase(i);
++n;
} else {
++i;
diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h
index 4679812cb4..75e73f2e52 100644
--- a/src/corelib/tools/qmap.h
+++ b/src/corelib/tools/qmap.h
@@ -953,7 +953,7 @@ public:
{ return QMap<Key, T>::insertMulti(key, value); }
inline QMultiMap &operator+=(const QMultiMap &other)
- { unite(other); return *this; }
+ { this->unite(other); return *this; }
inline QMultiMap operator+(const QMultiMap &other) const
{ QMultiMap result = *this; result += other; return result; }
@@ -1028,12 +1028,7 @@ Q_INLINE_TEMPLATE int QMultiMap<Key, T>::remove(const Key &key, const T &value)
typename QMap<Key, T>::iterator end(QMap<Key, T>::end());
while (i != end && !qMapLessThanKey<Key>(key, i.key())) {
if (i.value() == value) {
-#if defined(Q_CC_RVCT)
- // RVCT has problems with scoping, apparently.
- i = QMap<Key, T>::erase(i);
-#else
- i = erase(i);
-#endif
+ i = this->erase(i);
++n;
} else {
++i;
diff --git a/tests/auto/qhash/tst_qhash.cpp b/tests/auto/qhash/tst_qhash.cpp
index 59576d9470..3a7b54acce 100644
--- a/tests/auto/qhash/tst_qhash.cpp
+++ b/tests/auto/qhash/tst_qhash.cpp
@@ -1154,6 +1154,26 @@ void tst_QHash::qmultihash_specific()
QVERIFY(i.key() == 9);
QVERIFY(i.value() == 98);
}
+
+ {
+ QMultiHash<int, int> map1;
+ map1.insert(42, 1);
+ map1.insert(10, 2);
+ map1.insert(48, 3);
+ QMultiHash<int, int> map2;
+ map2.insert(8, 4);
+ map2.insert(42, 5);
+ map2.insert(95, 12);
+
+ map1+=map2;
+ map2.insert(42, 1);
+ map2.insert(10, 2);
+ map2.insert(48, 3);
+ QCOMPARE(map1.count(), map2.count());
+ QVERIFY(map1.remove(42,5));
+ QVERIFY(map2.remove(42,5));
+ QVERIFY(map1 == map2);
+ }
}
template <typename T>
diff --git a/tests/auto/qmap/tst_qmap.cpp b/tests/auto/qmap/tst_qmap.cpp
index d3ed76dcd4..a1b8de72fd 100644
--- a/tests/auto/qmap/tst_qmap.cpp
+++ b/tests/auto/qmap/tst_qmap.cpp
@@ -837,6 +837,26 @@ void tst_QMap::qmultimap_specific()
QVERIFY(i.key() == 9);
QVERIFY(i.value() == 98);
}
+
+ {
+ QMultiMap<int, int> map1;
+ map1.insert(42, 1);
+ map1.insert(10, 2);
+ map1.insert(48, 3);
+ QMultiMap<int, int> map2;
+ map2.insert(8, 4);
+ map2.insert(42, 5);
+ map2.insert(95, 12);
+
+ map1+=map2;
+ map2.insert(42, 1);
+ map2.insert(10, 2);
+ map2.insert(48, 3);
+ QCOMPARE(map1.count(), map2.count());
+ QVERIFY(map1.remove(42,5));
+ QVERIFY(map2.remove(42,5));
+ QVERIFY(map1 == map2);
+ }
}
QTEST_APPLESS_MAIN(tst_QMap)