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/cmCPluginAPI.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/cmCPluginAPI.cxx')
-rw-r--r-- | Source/cmCPluginAPI.cxx | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index c0088ac..576d2c3 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -683,26 +683,24 @@ void CCONV cmSourceFileSetName(void* arg, const char* name, const char* dir, } // Next, try the various source extensions - for (std::vector<std::string>::const_iterator ext = sourceExts.begin(); - ext != sourceExts.end(); ++ext) { + for (std::string const& ext : sourceExts) { hname = pathname; hname += "."; - hname += *ext; + hname += ext; if (cmSystemTools::FileExists(hname)) { - sf->SourceExtension = *ext; + sf->SourceExtension = ext; sf->FullPath = hname; return; } } // Finally, try the various header extensions - for (std::vector<std::string>::const_iterator ext = headerExts.begin(); - ext != headerExts.end(); ++ext) { + for (std::string const& ext : headerExts) { hname = pathname; hname += "."; - hname += *ext; + hname += ext; if (cmSystemTools::FileExists(hname)) { - sf->SourceExtension = *ext; + sf->SourceExtension = ext; sf->FullPath = hname; return; } @@ -711,13 +709,11 @@ void CCONV cmSourceFileSetName(void* arg, const char* name, const char* dir, std::ostringstream e; e << "Cannot find source file \"" << pathname << "\""; e << "\n\nTried extensions"; - for (std::vector<std::string>::const_iterator ext = sourceExts.begin(); - ext != sourceExts.end(); ++ext) { - e << " ." << *ext; + for (std::string const& ext : sourceExts) { + e << " ." << ext; } - for (std::vector<std::string>::const_iterator ext = headerExts.begin(); - ext != headerExts.end(); ++ext) { - e << " ." << *ext; + for (std::string const& ext : headerExts) { + e << " ." << ext; } cmSystemTools::Error(e.str()); } |