sigh: refine ::collect

This commit is contained in:
Michele Caini
2022-11-14 17:47:48 +01:00
parent fc68c1b290
commit 2f878f8b5a

View File

@@ -190,14 +190,14 @@ public:
template<typename Func>
void collect(Func func, Args... args) const {
for(auto &&call: calls) {
if constexpr(std::is_void_v<Ret>) {
if constexpr(std::is_void_v<Ret> || !std::is_invocable_v<Func, Ret>) {
call(args...);
if constexpr(std::is_invocable_r_v<bool, Func>) {
call(args...);
if(func()) {
break;
}
} else {
call(args...);
func();
}
} else {