From 43b6a4901206f49cd5b6f08206543d07c9ee875d Mon Sep 17 00:00:00 2001 From: Scott Mansell Date: Fri, 3 Feb 2023 13:00:26 +1300 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Mai --- Source/Core/Common/EventHook.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Core/Common/EventHook.h b/Source/Core/Common/EventHook.h index 903ff3ae36..f4d6ea0863 100644 --- a/Source/Core/Common/EventHook.h +++ b/Source/Core/Common/EventHook.h @@ -46,7 +46,7 @@ private: struct HookImpl : public HookBase { ~HookImpl() override { Event::Remove(this); } - HookImpl(CallbackType callback, std::string name) : m_fn(callback), m_name(name) {} + HookImpl(CallbackType callback, std::string name) : m_fn(std::move(callback)), m_name(std::move(name)) {} CallbackType m_fn; std::string m_name; }; @@ -56,12 +56,12 @@ public: static EventHook Register(CallbackType callback, std::string name) { DEBUG_LOG_FMT(COMMON, "Registering {} handler at {} event hook", name, EventName.value); - auto handle = std::make_unique(callback, name); + auto handle = std::make_unique(callback, std::move(name)); m_listeners.push_back(handle.get()); return handle; } - static void Trigger(CallbackArgs... args) + static void Trigger(const CallbackArgs&... args) { for (auto& handle : m_listeners) handle->m_fn(args...);