Skip to content

Commit

Permalink
sigh: use a range-for loop instead of find_if to suppress the warning…
Browse files Browse the repository at this point in the history
…s due to [[nodiscard]]
  • Loading branch information
skypjack committed Sep 7, 2019
1 parent 2b2bc67 commit 773666b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/entt/signal/sigh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,23 +117,23 @@ class sigh<Ret(Args...)> {
*/
template<typename Func>
void collect(Func func, Args... args) const {
std::find_if(calls.cbegin(), calls.cend(), [func = std::move(func), &args...](auto &&call) {
for(auto &&call: calls) {
if constexpr(std::is_void_v<Ret>) {
if constexpr(std::is_invocable_r_v<bool, Func>) {
call(args...);
return func();
if(func()) { break; }
} else {
call(args...);
return (func(), false);
func();
}
} else {
if constexpr(std::is_invocable_r_v<bool, Func, Ret>) {
return func(call(args...));
if(func(call(args...))) { break; }
} else {
return (func(call(args...)), false);
func(call(args...));
}
}
});
}
}

private:
Expand Down

0 comments on commit 773666b

Please sign in to comment.