diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2018-01-17 14:06:28 +0100 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2018-01-17 20:43:48 +0000 |
commit | 9ddcd554d3df9cceaba7f2fcbfe1444edcd6efad (patch) | |
tree | 216651af2a80ff1d9626a91bb4a29a87a3d1370f /src/app | |
parent | 0ba653daf4661f16d3e4e644df60424c24f81862 (diff) |
Replace some uses of find_if with any_of and none_of
Calls to find_if that just compare the result with an end iterator are
replaced by calls to any_of or none_of. This leads to shorter, more
expressive code. For increased readability, versions of any_of/none_of
are provided that operate on whole containers instead of iterators.
Change-Id: Ia4ff449176f22f1820635e810724983866d3265e
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/app')
-rw-r--r-- | src/app/qbs-setup-qt/setupqt.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/app/qbs-setup-qt/setupqt.cpp b/src/app/qbs-setup-qt/setupqt.cpp index 9cd5be283..7f9d98d81 100644 --- a/src/app/qbs-setup-qt/setupqt.cpp +++ b/src/app/qbs-setup-qt/setupqt.cpp @@ -61,6 +61,7 @@ #include <algorithm> namespace qbs { +using Internal::none_of; using Internal::contains; using Internal::HostOsInfo; using Internal::Tr; @@ -110,10 +111,9 @@ QList<QtEnvironment> SetupQt::fetchEnvironments() const auto qmakePaths = collectQmakePaths(); for (const QString &qmakePath : qmakePaths) { const QtEnvironment env = fetchEnvironment(qmakePath); - if (std::find_if(qtEnvironments.cbegin(), qtEnvironments.cend(), - [&env](const QtEnvironment &otherEnv) { - return env.includePath == otherEnv.includePath; - }) == qtEnvironments.cend()) { + if (none_of(qtEnvironments, [&env](const QtEnvironment &otherEnv) { + return env.includePath == otherEnv.includePath; + })) { qtEnvironments.push_back(env); } } |