Well, you are missingJust use a crucial functionlambda for the predicate, namelyand then use the power of containsAny(). Using that, your filter-decision can be done with a simplestandard algorithms and selfshort-explanatory expressioncircuiting. Now, your code is far easier to understand and shorter, and needs neither continue nor breakNo need for any convoluted or exotic control-flow:
void ParsingTools::filterStrings (QStringList& list)
{
for (int i = list.size(); i--;) {
const auto& s = list[i];
auto contains = [&](const QString& x) { return s.contains(x); };
if (s.size() != m_Length
|| !containsAny(s, m_Include) || containsAny(s, m_Exclude)
|| !std::all_of(m_Include.begin(), filterStringOutm_Include.end(i);, contains)
}
}
And the missing helper, using standard algorithms:
bool containsAny(const QString& s, const QStringList& list)
{
return || std::any_of(listm_Exclude.begin(), listm_Exclude.end(), contains))
[&](const QString& x){ return s.containsfilterStringOut(xi);
});
}