diff options
author | Artur Ryt <artur.ryt@gmail.com> | 2019-02-07 21:39:05 (GMT) |
---|---|---|
committer | Artur Ryt <artur.ryt@gmail.com> | 2019-02-07 21:39:05 (GMT) |
commit | 01b2d6ab7465e7f22fb821876027df86b0c8f363 (patch) | |
tree | 7ae313670e3655269ef7f9db6feabdc4bb2aaf25 /Source/cmForEachCommand.cxx | |
parent | 15bdbec0176e3aa620bb5bda3631819c5ca18eaf (diff) | |
download | CMake-01b2d6ab7465e7f22fb821876027df86b0c8f363.zip CMake-01b2d6ab7465e7f22fb821876027df86b0c8f363.tar.gz CMake-01b2d6ab7465e7f22fb821876027df86b0c8f363.tar.bz2 |
Modernize: Use ranged for-loops when possible
Replaced most manual `const_iterator`-based loops and some
reverse-iterator loops with range loops.
Fixes: #18858
Diffstat (limited to 'Source/cmForEachCommand.cxx')
-rw-r--r-- | Source/cmForEachCommand.cxx | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx index e359def..39430d0 100644 --- a/Source/cmForEachCommand.cxx +++ b/Source/cmForEachCommand.cxx @@ -48,12 +48,10 @@ bool cmForEachFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff, if (mf.GetDefinition(this->Args[0])) { oldDef = mf.GetDefinition(this->Args[0]); } - std::vector<std::string>::const_iterator j = this->Args.begin(); - ++j; - for (; j != this->Args.end(); ++j) { + for (std::string const& arg : cmMakeRange(this->Args).advance(1)) { // set the variable to the loop value - mf.AddDefinition(this->Args[0], j->c_str()); + mf.AddDefinition(this->Args[0], arg.c_str()); // Invoke all the functions that were collected in the block. cmExecutionStatus status; for (cmListFileFunction const& func : this->Functions) { |