From ea87825d58ab5b58dd360c3f080518c07a865db0 Mon Sep 17 00:00:00 2001 From: crupest Date: Fri, 19 Apr 2019 23:20:09 +0800 Subject: ... --- include/cru/common/event.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'include/cru/common') 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 void Raise(Args&&... args) { - for (const auto& handler : handlers_) - (handler.second)(std::forward(args)...); + std::list handlers; + for (const auto& [key, handler] : handlers_) handlers.push_back(handler); + for (const auto& handler : handlers) handler(std::forward(args)...); } protected: -- cgit v1.2.3