mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-30 11:10:06 -05:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user