fixed dispatcher + minor changes
This commit is contained in:
@@ -47,14 +47,10 @@ class Dispatcher final {
|
||||
using sink_type = typename SigH<void(const Event &)>::sink_type;
|
||||
|
||||
void publish() override {
|
||||
for(const auto &event: events[current]) {
|
||||
signal.publish(event);
|
||||
}
|
||||
|
||||
events[current].clear();
|
||||
|
||||
++current;
|
||||
const auto &curr = current++;
|
||||
current %= std::extent<decltype(events)>::value;
|
||||
std::for_each(events[curr].cbegin(), events[curr].cend(), [this](const auto &event) { signal.publish(event); });
|
||||
events[curr].clear();
|
||||
}
|
||||
|
||||
inline sink_type sink() noexcept {
|
||||
|
||||
@@ -306,9 +306,9 @@ public:
|
||||
* @param args Arguments to use to invoke listeners.
|
||||
*/
|
||||
void publish(Args... args) {
|
||||
for(auto &&call: calls) {
|
||||
std::for_each(calls.begin(), calls.end(), [&args...](auto &&call) {
|
||||
call.second(call.first, args...);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -319,9 +319,7 @@ public:
|
||||
collector_type collect(Args... args) {
|
||||
collector_type collector;
|
||||
|
||||
for(auto pos = calls.size(); pos; --pos) {
|
||||
auto &call = calls[pos-1];
|
||||
|
||||
for(auto &&call: calls) {
|
||||
if(!this->invoke(collector, call.second, call.first, args...)) {
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user