[cppcheck] convert several functions to use std::all_of
std::all_of becomes constexpr in C++20. I'm not sure it results in better performance. Found with useStlAlgorithm Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
@@ -19,6 +19,8 @@
|
||||
|
||||
#include "AndSongFilter.hxx"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
ISongFilterPtr
|
||||
AndSongFilter::Clone() const noexcept
|
||||
{
|
||||
@@ -54,9 +56,5 @@ AndSongFilter::ToExpression() const noexcept
|
||||
bool
|
||||
AndSongFilter::Match(const LightSong &song) const noexcept
|
||||
{
|
||||
for (const auto &i : items)
|
||||
if (!i->Match(song))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return std::all_of(items.begin(), items.end(), [&song](const auto &i) { return i->Match(song); });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user