diff --git a/BAN/include/BAN/Function.h b/BAN/include/BAN/Function.h index a01bd370..94068720 100644 --- a/BAN/include/BAN/Function.h +++ b/BAN/include/BAN/Function.h @@ -20,13 +20,13 @@ namespace BAN new (m_storage) CallablePointer(function); } template - Function(Ret(Own::*function)(Args...), Own* owner) + Function(Ret(Own::*function)(Args...), Own& owner) { static_assert(sizeof(CallableMember) <= m_size); new (m_storage) CallableMember(function, owner); } template - Function(Ret(Own::*function)(Args...) const, const Own* owner) + Function(Ret(Own::*function)(Args...) const, const Own& owner) { static_assert(sizeof(CallableMemberConst) <= m_size); new (m_storage) CallableMemberConst(function, owner); @@ -91,36 +91,36 @@ namespace BAN template struct CallableMember : public CallableBase { - CallableMember(Ret(Own::*function)(Args...), Own* owner) + CallableMember(Ret(Own::*function)(Args...), Own& owner) : m_owner(owner) , m_function(function) { } virtual Ret call(Args... args) const override { - return (m_owner->*m_function)(forward(args)...); + return (m_owner.*m_function)(forward(args)...); } private: - Own* m_owner = nullptr; + Own& m_owner; Ret(Own::*m_function)(Args...) = nullptr; }; template struct CallableMemberConst : public CallableBase { - CallableMemberConst(Ret(Own::*function)(Args...) const, const Own* owner) + CallableMemberConst(Ret(Own::*function)(Args...) const, const Own& owner) : m_owner(owner) , m_function(function) { } virtual Ret call(Args... args) const override { - return (m_owner->*m_function)(forward(args)...); + return (m_owner.*m_function)(forward(args)...); } private: - const Own* m_owner = nullptr; + const Own& m_owner; Ret(Own::*m_function)(Args...) const = nullptr; };