Modernize: Use ranged for-loops when possible

Replaced most manual `const_iterator`-based loops and some
reverse-iterator loops with range loops.

Fixes: #18858
This commit is contained in:
Artur Ryt
2019-02-07 22:39:05 +01:00
parent 15bdbec017
commit 01b2d6ab74
46 changed files with 317 additions and 416 deletions
+4 -5
View File
@@ -5,6 +5,7 @@
#include <sstream>
#include <string.h>
#include "cmAlgorithms.h"
#include "cmMakefile.h"
#include "cmSystemTools.h"
@@ -26,15 +27,13 @@ bool cmAddSubDirectoryCommand::InitialPass(
bool excludeFromAll = false;
// process the rest of the arguments looking for optional args
std::vector<std::string>::const_iterator i = args.begin();
++i;
for (; i != args.end(); ++i) {
if (*i == "EXCLUDE_FROM_ALL") {
for (std::string const& arg : cmMakeRange(args).advance(1)) {
if (arg == "EXCLUDE_FROM_ALL") {
excludeFromAll = true;
continue;
}
if (binArg.empty()) {
binArg = *i;
binArg = arg;
} else {
this->SetError("called with incorrect number of arguments");
return false;