dispatcher: enqueue works fine with aggregates now (close #491)
This commit is contained in:
@@ -372,7 +372,7 @@ the messages that are still pending are sent to the listeners at once:
|
||||
|
||||
```cpp
|
||||
// emits all the events of the given type at once
|
||||
dispatcher.update<my_event>();
|
||||
dispatcher.update<an_event>();
|
||||
|
||||
// emits all the events queued so far at once
|
||||
dispatcher.update();
|
||||
|
||||
@@ -66,7 +66,11 @@ class dispatcher {
|
||||
|
||||
template<typename... Args>
|
||||
void enqueue(Args &&... args) {
|
||||
events.emplace_back(std::forward<Args>(args)...);
|
||||
if constexpr(std::is_aggregate_v<Event>) {
|
||||
events.push_back(Event{std::forward<Args>(args)...});
|
||||
} else {
|
||||
events.emplace_back(std::forward<Args>(args)...);
|
||||
}
|
||||
}
|
||||
|
||||
id_type type_id() const ENTT_NOEXCEPT override {
|
||||
|
||||
Reference in New Issue
Block a user