diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2017-12-14 00:29:30 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2019-05-23 17:30:51 +0200 |
commit | b4a88aa7589d9d09fd54a5a7df29036a74293116 (patch) | |
tree | d503c037f6113520eb59595cae35ba35dec28edf /examples/qtconcurrent | |
parent | 923e08132cfd0c9140e705a7f0f27b3432f94695 (diff) |
examples: port away from Java-style iterators
There's no reason to use them here, the Mutable is misleading in a
few instances, ranged-for is much simpler, and more future-proof.
Change-Id: Ifd5eaae95bbaa0b4cf0f435e6cfee6d778817b44
Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'examples/qtconcurrent')
-rw-r--r-- | examples/qtconcurrent/wordcount/main.cpp | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/examples/qtconcurrent/wordcount/main.cpp b/examples/qtconcurrent/wordcount/main.cpp index ff7ea24ee7..32cb4d0e08 100644 --- a/examples/qtconcurrent/wordcount/main.cpp +++ b/examples/qtconcurrent/wordcount/main.cpp @@ -126,11 +126,8 @@ WordCount countWords(const QString &file) // at a time. void reduce(WordCount &result, const WordCount &w) { - QMapIterator<QString, int> i(w); - while (i.hasNext()) { - i.next(); + for (auto i = w.begin(), end = w.end(); i != end; ++i) result[i.key()] += i.value(); - } } int main(int argc, char** argv) |