diff options
author | crupest <crupest@outlook.com> | 2019-04-19 23:20:09 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2019-04-19 23:20:09 +0800 |
commit | ea87825d58ab5b58dd360c3f080518c07a865db0 (patch) | |
tree | 4b497ef3687d682368e0fde4b86293565583a63a /include/cru/common/event.hpp | |
parent | 7351020a582d70a1495249fba87d342c8a1fb634 (diff) | |
download | cru-ea87825d58ab5b58dd360c3f080518c07a865db0.tar.gz cru-ea87825d58ab5b58dd360c3f080518c07a865db0.tar.bz2 cru-ea87825d58ab5b58dd360c3f080518c07a865db0.zip |
...
Diffstat (limited to 'include/cru/common/event.hpp')
-rw-r--r-- | include/cru/common/event.hpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/include/cru/common/event.hpp b/include/cru/common/event.hpp index 987bcdd6..741dcd99 100644 --- a/include/cru/common/event.hpp +++ b/include/cru/common/event.hpp @@ -102,8 +102,9 @@ class Event : public details::EventBase { template <typename... Args> void Raise(Args&&... args) { - for (const auto& handler : handlers_) - (handler.second)(std::forward<Args>(args)...); + std::list<EventHandler> handlers; + for (const auto& [key, handler] : handlers_) handlers.push_back(handler); + for (const auto& handler : handlers) handler(std::forward<Args>(args)...); } protected: |