summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/io/qurlquery.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/corelib/io/qurlquery.cpp b/src/corelib/io/qurlquery.cpp
index a6351d3a21..231a26c211 100644
--- a/src/corelib/io/qurlquery.cpp
+++ b/src/corelib/io/qurlquery.cpp
@@ -43,6 +43,8 @@
#include <QtCore/qhashfunctions.h>
#include <QtCore/qstringlist.h>
+#include <algorithm>
+
QT_BEGIN_NAMESPACE
/*!
@@ -754,14 +756,12 @@ void QUrlQuery::removeQueryItem(const QString &key)
void QUrlQuery::removeAllQueryItems(const QString &key)
{
if (d.constData()) {
- QString encodedKey = d->recodeFromUser(key);
- Map::iterator it = d->itemList.begin();
- while (it != d->itemList.end()) {
- if (it->first == encodedKey)
- it = d->itemList.erase(it);
- else
- ++it;
- }
+ const QString encodedKey = d->recodeFromUser(key);
+ auto firstEqualsEncodedKey = [&encodedKey](const QPair<QString, QString> &item) {
+ return item.first == encodedKey;
+ };
+ const auto end = d->itemList.end();
+ d->itemList.erase(std::remove_if(d->itemList.begin(), end, firstEqualsEncodedKey), end);
}
}