[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:
@@ -258,11 +258,8 @@ MultipleOutputs::Open(const AudioFormat audio_format)
|
||||
bool
|
||||
MultipleOutputs::IsChunkConsumed(const MusicChunk *chunk) const noexcept
|
||||
{
|
||||
for (const auto &ao : outputs)
|
||||
if (!ao->LockIsChunkConsumed(*chunk))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return std::all_of(outputs.begin(), outputs.end(), [chunk](const auto &ao) {
|
||||
return ao->LockIsChunkConsumed(*chunk); });
|
||||
}
|
||||
|
||||
unsigned
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "Chrono.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
@@ -106,11 +107,7 @@ public:
|
||||
*/
|
||||
gcc_pure
|
||||
bool IsDummy() const noexcept {
|
||||
for (const auto &i : outputs)
|
||||
if (!i->IsDummy())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return std::all_of(outputs.begin(), outputs.end(), [](const auto &i) { return i->IsDummy(); });
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user