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/CursesDialog | |
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/CursesDialog')
-rw-r--r-- | Source/CursesDialog/cmCursesLongMessageForm.cxx | 5 | ||||
-rw-r--r-- | Source/CursesDialog/cmCursesMainForm.cxx | 17 |
2 files changed, 8 insertions, 14 deletions
diff --git a/Source/CursesDialog/cmCursesLongMessageForm.cxx b/Source/CursesDialog/cmCursesLongMessageForm.cxx index a41d051..4e887d6 100644 --- a/Source/CursesDialog/cmCursesLongMessageForm.cxx +++ b/Source/CursesDialog/cmCursesLongMessageForm.cxx @@ -19,9 +19,8 @@ cmCursesLongMessageForm::cmCursesLongMessageForm( std::vector<std::string> const& messages, const char* title) { // Append all messages into on big string - std::vector<std::string>::const_iterator it; - for (it = messages.begin(); it != messages.end(); it++) { - this->Messages += (*it); + for (std::string const& message : messages) { + this->Messages += message; // Add one blank line after each message this->Messages += "\n\n"; } diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index 8ca7802..b9a7c85 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -107,10 +107,9 @@ void cmCursesMainForm::InitializeUI() // Count non-internal and non-static entries int count = 0; - for (std::vector<std::string>::const_iterator it = cacheKeys.begin(); - it != cacheKeys.end(); ++it) { + for (std::string const& key : cacheKeys) { cmStateEnums::CacheEntryType t = - this->CMakeInstance->GetState()->GetCacheEntryType(*it); + this->CMakeInstance->GetState()->GetCacheEntryType(key); if (t != cmStateEnums::INTERNAL && t != cmStateEnums::STATIC && t != cmStateEnums::UNINITIALIZED) { ++count; @@ -130,11 +129,9 @@ void cmCursesMainForm::InitializeUI() // Create the composites. // First add entries which are new - for (std::vector<std::string>::const_iterator it = cacheKeys.begin(); - it != cacheKeys.end(); ++it) { - std::string key = *it; + for (std::string const& key : cacheKeys) { cmStateEnums::CacheEntryType t = - this->CMakeInstance->GetState()->GetCacheEntryType(*it); + this->CMakeInstance->GetState()->GetCacheEntryType(key); if (t == cmStateEnums::INTERNAL || t == cmStateEnums::STATIC || t == cmStateEnums::UNINITIALIZED) { continue; @@ -148,11 +145,9 @@ void cmCursesMainForm::InitializeUI() } // then add entries which are old - for (std::vector<std::string>::const_iterator it = cacheKeys.begin(); - it != cacheKeys.end(); ++it) { - std::string key = *it; + for (std::string const& key : cacheKeys) { cmStateEnums::CacheEntryType t = - this->CMakeInstance->GetState()->GetCacheEntryType(*it); + this->CMakeInstance->GetState()->GetCacheEntryType(key); if (t == cmStateEnums::INTERNAL || t == cmStateEnums::STATIC || t == cmStateEnums::UNINITIALIZED) { continue; |