diff options
author | hjk <hjk@qt.io> | 2019-07-29 14:37:58 +0200 |
---|---|---|
committer | hjk <hjk@qt.io> | 2019-07-30 11:16:15 +0000 |
commit | 94a097d95e9bfe485cebd7a5a9acd56301c54f04 (patch) | |
tree | 144c2bea2d0be954c55105ada207b3d7b7213fd7 | |
parent | a8007888e4f6aa6028c9a71dadb0ef7620e67862 (diff) |
Avoid uses of Java-style iterators
Change-Id: I90cece156033b5d223a86016401a2199f5b6c11e
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r-- | src/lib/corelib/generators/generatordata.h | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/src/lib/corelib/generators/generatordata.h b/src/lib/corelib/generators/generatordata.h index b6200339e..da65815ad 100644 --- a/src/lib/corelib/generators/generatordata.h +++ b/src/lib/corelib/generators/generatordata.h @@ -72,21 +72,15 @@ template <typename U> struct IMultiplexableContainer { void forEach(const std::function<void(const QString &configurationName, const U &data)> &func) const { - QMapIterator<QString, U> it(data); - while (it.hasNext()) { - it.next(); + for (auto it = data.cbegin(), end = data.cend(); it != end; ++it) func(it.key(), it.value()); - } } void forEach(const std::function<void(const std::string &configurationName, const U &data)> &func) const { - QMapIterator<QString, U> it(data); - while (it.hasNext()) { - it.next(); + for (auto it = data.cbegin(), end = data.cend(); it != end; ++it) func(it.key().toStdString(), it.value()); - } } const U operator[](const QString &configurationName) const @@ -147,21 +141,15 @@ struct QBS_EXPORT GeneratableProject : public GeneratableProjectData { void forEach(const std::function<void(const QString &configurationName, const Project &data)> &func) const { - QMapIterator<QString, Project> it(projects); - while (it.hasNext()) { - it.next(); + for (auto it = projects.cbegin(), end = projects.cend(); it != end; ++it) func(it.key(), it.value()); - } } void forEach(const std::function<void(const std::string &configurationName, const Project &data)> &func) const { - QMapIterator<QString, Project> it(projects); - while (it.hasNext()) { - it.next(); + for (auto it = projects.cbegin(), end = projects.cend(); it != end; ++it) func(it.key().toStdString(), it.value()); - } } const Project operator[](const QString &configurationName) const |