summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qmap.h
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2020-02-26 01:00:25 +0100
committerEdward Welbourne <edward.welbourne@qt.io>2020-02-26 18:39:21 +0100
commit75c0ffaf6d2b92cdf26092e01acdd5af4afeac97 (patch)
treebb9e85c21248790ec99b3665928872e39b14db64 /src/corelib/tools/qmap.h
parent4753d69d8934258de7fb64550e50a5cbb9b5603f (diff)
parent462c2745a5168a5b57381d05779b5d16aebe018e (diff)
Merge remote-tracking branch 'origin/5.15' into dev
Conflicts: examples/network/bearermonitor/CMakeLists.txt examples/network/CMakeLists.txt src/corelib/tools/qlinkedlist.h src/sql/kernel/qsqldriver_p.h src/sql/kernel/qsqlresult_p.h src/widgets/kernel/qwidget.cpp src/widgets/kernel/qwidget_p.h tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp tests/auto/tools/moc/allmocs_baseline_in.json Change-Id: I21a3c34570ae79ea9d30107fae71759d7eac17d9
Diffstat (limited to 'src/corelib/tools/qmap.h')
-rw-r--r--src/corelib/tools/qmap.h41
1 files changed, 22 insertions, 19 deletions
diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h
index a70b355c67..a971919e54 100644
--- a/src/corelib/tools/qmap.h
+++ b/src/corelib/tools/qmap.h
@@ -1086,14 +1086,14 @@ public:
QList<Key> uniqueKeys() const;
QList<T> values(const Key &key) const;
- using typename QMap<Key, T>::iterator;
- using typename QMap<Key, T>::const_iterator;
-
inline typename QMap<Key, T>::iterator replace(const Key &key, const T &value)
{ return QMap<Key, T>::insert(key, value); }
- iterator insert(const Key &key, const T &value);
- iterator insert(const_iterator pos, const Key &key, const T &value);
+ typename QMap<Key, T>::iterator insert(const Key &key, const T &value);
+ //! [qmultimap-insert-pos]
+ typename QMap<Key, T>::iterator insert(typename QMap<Key, T>::const_iterator pos,
+ const Key &key, const T &value);
+ //! [qmultimap-unite]
QMultiMap &unite(const QMultiMap &other);
inline QMultiMap &operator+=(const QMultiMap &other)
{ return unite(other); }
@@ -1151,7 +1151,7 @@ Q_OUTOFLINE_TEMPLATE QList<Key> QMultiMap<Key, T>::uniqueKeys() const
{
QList<Key> res;
res.reserve(size()); // May be too much, but assume short lifetime
- const_iterator i = this->begin();
+ typename QMap<Key, T>::const_iterator i = this->begin();
if (i != this->end()) {
for (;;) {
const Key &aKey = i.key();
@@ -1172,7 +1172,7 @@ Q_OUTOFLINE_TEMPLATE QList<T> QMultiMap<Key, T>::values(const Key &akey) const
QList<T> res;
Node *n = this->d->findNode(akey);
if (n) {
- const_iterator it(n);
+ typename QMap<Key, T>::const_iterator it(n);
do {
res.append(*it);
++it;
@@ -1182,8 +1182,8 @@ Q_OUTOFLINE_TEMPLATE QList<T> QMultiMap<Key, T>::values(const Key &akey) const
}
template <class Key, class T>
-Q_INLINE_TEMPLATE typename QMultiMap<Key, T>::iterator QMultiMap<Key, T>::insert(const Key &akey,
- const T &avalue)
+Q_INLINE_TEMPLATE typename QMap<Key, T>::iterator QMultiMap<Key, T>::insert(const Key &akey,
+ const T &avalue)
{
detach();
Node* y = this->d->end();
@@ -1195,11 +1195,13 @@ Q_INLINE_TEMPLATE typename QMultiMap<Key, T>::iterator QMultiMap<Key, T>::insert
x = left ? x->leftNode() : x->rightNode();
}
Node *z = this->d->createNode(akey, avalue, y, left);
- return iterator(z);
+ return typename QMap<Key, T>::iterator(z);
}
+#ifndef Q_CLANG_QDOC
template <class Key, class T>
-typename QMultiMap<Key, T>::iterator QMultiMap<Key, T>::insert(const_iterator pos, const Key &akey, const T &avalue)
+typename QMap<Key, T>::iterator QMultiMap<Key, T>::insert(typename QMap<Key, T>::const_iterator pos,
+ const Key &akey, const T &avalue)
{
if (this->d->ref.isShared())
return insert(akey, avalue);
@@ -1216,7 +1218,7 @@ typename QMultiMap<Key, T>::iterator QMultiMap<Key, T>::insert(const_iterator po
if (!qMapLessThanKey(n->key, akey))
return insert(akey, avalue); // ignore hint
Node *z = this->d->createNode(akey, avalue, n, false); // insert right most
- return iterator(z);
+ return typename QMap<Key, T>::iterator(z);
}
return insert(akey, avalue);
} else {
@@ -1229,7 +1231,7 @@ typename QMultiMap<Key, T>::iterator QMultiMap<Key, T>::insert(const_iterator po
if (pos == this->constBegin()) {
// There is no previous value (insert left most)
Node *z = this->d->createNode(akey, avalue, this->begin().i, true);
- return iterator(z);
+ return typename QMap<Key, T>::iterator(z);
} else {
Node *prev = const_cast<Node*>(pos.i->previousNode());
if (!qMapLessThanKey(prev->key, akey))
@@ -1238,11 +1240,11 @@ typename QMultiMap<Key, T>::iterator QMultiMap<Key, T>::insert(const_iterator po
// Hint is ok - do insert
if (prev->right == nullptr) {
Node *z = this->d->createNode(akey, avalue, prev, false);
- return iterator(z);
+ return typename QMap<Key, T>::iterator(z);
}
if (next->left == nullptr) {
Node *z = this->d->createNode(akey, avalue, next, true);
- return iterator(z);
+ return typename QMap<Key, T>::iterator(z);
}
Q_ASSERT(false); // We should have prev->right == nullptr or next->left == nullptr.
return insert(akey, avalue);
@@ -1254,14 +1256,15 @@ template <class Key, class T>
Q_INLINE_TEMPLATE QMultiMap<Key, T> &QMultiMap<Key, T>::unite(const QMultiMap<Key, T> &other)
{
QMultiMap<Key, T> copy(other);
- const_iterator it = copy.constEnd();
- const const_iterator b = copy.constBegin();
+ typename QMap<Key, T>::const_iterator it = copy.constEnd();
+ const typename QMap<Key, T>::const_iterator b = copy.constBegin();
while (it != b) {
--it;
insert(it.key(), it.value());
}
return *this;
}
+#endif // Q_CLANG_QDOC
template <class Key, class T>
Q_INLINE_TEMPLATE bool QMultiMap<Key, T>::contains(const Key &key, const T &value) const
@@ -1293,8 +1296,8 @@ Q_INLINE_TEMPLATE int QMultiMap<Key, T>::count(const Key &akey) const
QMultiMap::Node *lastNode;
this->d->nodeRange(akey, &firstNode, &lastNode);
- const_iterator ci_first(firstNode);
- const const_iterator ci_last(lastNode);
+ typename QMap<Key, T>::const_iterator ci_first(firstNode);
+ const typename QMap<Key, T>::const_iterator ci_last(lastNode);
int cnt = 0;
while (ci_first != ci_last) {
++cnt;