Replace for-loop with std::any_of.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
tastytea 2019-12-29 04:00:48 +01:00
parent 51673c7f2a
commit bc2364875d
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
1 changed files with 4 additions and 10 deletions

View File

@ -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<string>("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;