Commit 9af80eb5 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

EventManager: Do not copy the given function when it's an lvalue

parent 450c0776
......@@ -51,9 +51,6 @@ class Media;
class EventManager : public Internal<libvlc_event_manager_t>
template <typename T>
using Decay = typename std::decay<T>::type;
template <typename T>
using DecayPtr = typename std::add_pointer<typename std::decay<T>::type>::type;
......@@ -111,7 +108,10 @@ private:
EventHandler(const EventHandler&) = delete;
Decay<Func> m_userCallback;
// Deduced type is Func& in case of lvalue; Func in case of rvalue.
// So we hold a reference to the callback when passed a lvalue, we
// copy construct it when passing a rvalue
Func m_userCallback;
// EventManager always outlive EventHandler, no need for smart pointer
EventManager* m_eventManager;
Wrapper m_wrapper;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment