input: fix warning about nodiscard

std::any_of is used here in a way it was never meant to be used...
Instead just write out the loop
This commit is contained in:
Xaver Hugl 2024-04-25 19:22:49 +02:00
parent 4a70793e2b
commit 4dffc09aaa

View file

@ -178,7 +178,6 @@ public:
* The method @p function is invoked on each input filter. Processing is stopped if * The method @p function is invoked on each input filter. Processing is stopped if
* a filter returns @c true for @p function. * a filter returns @c true for @p function.
* *
* The UnaryPredicate is defined like the UnaryPredicate of std::any_of.
* The signature of the function should be equivalent to the following: * The signature of the function should be equivalent to the following:
* @code * @code
* bool function(const InputEventFilter *spy); * bool function(const InputEventFilter *spy);
@ -190,7 +189,11 @@ public:
template<class UnaryPredicate> template<class UnaryPredicate>
void processFilters(UnaryPredicate function) void processFilters(UnaryPredicate function)
{ {
std::any_of(m_filters.constBegin(), m_filters.constEnd(), function); for (const auto filter : std::as_const(m_filters)) {
if (function(filter)) {
return;
}
}
} }
/** /**