summaryrefslogtreecommitdiffstats
path: root/Source/cmFindPackageCommand.cxx
diff options
context:
space:
mode:
authorAlex Turbov <i.zaufi@gmail.com>2022-06-27 02:18:54 (GMT)
committerAlex Turbov <i.zaufi@gmail.com>2022-07-11 13:14:01 (GMT)
commit1bed0be2cd0913a2d0f21c4ff5ebe058e23fdfb5 (patch)
tree849a6b68735e3ef410548cb4692dee7f15879c98 /Source/cmFindPackageCommand.cxx
parenta08160685531d926774d4c994dbc76845e254aed (diff)
downloadCMake-1bed0be2cd0913a2d0f21c4ff5ebe058e23fdfb5.zip
CMake-1bed0be2cd0913a2d0f21c4ff5ebe058e23fdfb5.tar.gz
CMake-1bed0be2cd0913a2d0f21c4ff5ebe058e23fdfb5.tar.bz2
cmFindPackageCommand: Use `std::any_of` instead of "manual" `for` loops
Diffstat (limited to 'Source/cmFindPackageCommand.cxx')
-rw-r--r--Source/cmFindPackageCommand.cxx40
1 files changed, 16 insertions, 24 deletions
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 4ad9124..5dab179 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -2279,12 +2279,10 @@ private:
std::vector<std::string> const& Vector;
bool Search(std::string const& parent, cmFileList& lister) override
{
- for (std::string const& i : this->Vector) {
- if (this->Consider(parent + i, lister)) {
- return true;
- }
- }
- return false;
+ return std::any_of(this->Vector.cbegin(), this->Vector.cend(),
+ [this, &parent, &lister](std::string const& i) {
+ return this->Consider(parent + i, lister);
+ });
}
std::unique_ptr<cmFileListGeneratorBase> Clone() const override
{
@@ -2349,12 +2347,10 @@ private:
this->SortOrder, this->SortDirection);
}
- for (std::string const& i : matches) {
- if (this->Consider(parent + i, lister)) {
- return true;
- }
- }
- return false;
+ return std::any_of(matches.cbegin(), matches.cend(),
+ [this, &parent, &lister](std::string const& i) {
+ return this->Consider(parent + i, lister);
+ });
}
std::unique_ptr<cmFileListGeneratorBase> Clone() const override
{
@@ -2401,12 +2397,10 @@ private:
}
}
- for (std::string const& i : matches) {
- if (this->Consider(parent + i, lister)) {
- return true;
- }
- }
- return false;
+ return std::any_of(matches.cbegin(), matches.cend(),
+ [this, &parent, &lister](std::string const& i) {
+ return this->Consider(parent + i, lister);
+ });
}
std::unique_ptr<cmFileListGeneratorBase> Clone() const override
{
@@ -2483,12 +2477,10 @@ private:
std::vector<std::string> const& files = g.GetFiles();
// Look for directories among the matches.
- for (std::string const& f : files) {
- if (this->Consider(f, lister)) {
- return true;
- }
- }
- return false;
+ return std::any_of(files.cbegin(), files.cend(),
+ [this, &lister](std::string const& f) {
+ return this->Consider(f, lister);
+ });
}
std::unique_ptr<cmFileListGeneratorBase> Clone() const override
{