From bc2364875d8a8ca377931b4342786c54c609165d Mon Sep 17 00:00:00 2001 From: tastytea Date: Sun, 29 Dec 2019 04:00:48 +0100 Subject: [PATCH] Replace for-loop with std::any_of. --- src/document.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/document.cpp b/src/document.cpp index a5998d9..53811a1 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -35,6 +35,7 @@ namespace mastorss { using boost::regex; using boost::regex_replace; +using std::any_of; using std::transform; using std::ifstream; using std::istringstream; @@ -162,17 +163,10 @@ void Document::parse_rss(const pt::ptree &tree) break; } - bool skipthis{false}; string title{rssitem.get("title")}; - for (const auto &skip : _profiledata.skip) - { - if (title.substr(0, skip.length()) == skip) - { - skipthis = true; - break; - } - } - if (skipthis) + if (any_of(_profiledata.skip.begin(), _profiledata.skip.end(), + [&title](const string &skip) + { return title.substr(0, skip.size()) == skip; })) { BOOST_LOG_TRIVIAL(debug) << "Skipped GUID: " << guid; continue;