diff --git a/Redcraft.Utility/Source/Public/Templates/Invoke.h b/Redcraft.Utility/Source/Public/Templates/Invoke.h index af53d68..34e213f 100644 --- a/Redcraft.Utility/Source/Public/Templates/Invoke.h +++ b/Redcraft.Utility/Source/Public/Templates/Invoke.h @@ -14,7 +14,7 @@ struct InvokeFunction template static auto Invoke(F&& Object, Types&&... Args) { - return Object(Forward(Args)...); + return Forward(Object)(Forward(Args)...); } }; @@ -22,16 +22,16 @@ struct InvokeMemberFunction { template static auto Invoke(F&& Func, ObjectType&& Object, Types&&... Args) -> - decltype((Object->*Func)(Forward(Args)...)) + decltype((Forward(Object)->*Func)(Forward(Args)...)) { - return (Object->*Func)(Forward(Args)...); + return (Forward(Object)->*Func)(Forward(Args)...); } template static auto Invoke(F&& Func, ObjectType&& Object, Types&&... Args) -> - decltype((Object.*Func)(Forward(Args)...)) + decltype((Forward(Object).*Func)(Forward(Args)...)) { - return (Object.*Func)(Forward(Args)...); + return (Forward(Object).*Func)(Forward(Args)...); } }; @@ -39,16 +39,16 @@ struct InvokeMemberObject { template static auto Invoke(F&& Func, ObjectType&& Object) -> - decltype(Object->*Func) + decltype(Forward(Object)->*Func) { - return (Object->*Func); + return (Forward(Object)->*Func); } template static auto Invoke(F&& Func, ObjectType&& Object) -> - decltype(Object.*Func) + decltype(Forward(Object).*Func) { - return (Object.*Func); + return (Forward(Object).*Func); } }; @@ -81,6 +81,7 @@ NAMESPACE_PRIVATE_END template requires TIsInvocable::Value constexpr auto Invoke(F&& Func, Types&&... Args) + -> decltype(NAMESPACE_PRIVATE::InvokeImpl::Invoke(Forward(Func), Forward(Args)...)) { return NAMESPACE_PRIVATE::InvokeImpl::Invoke(Forward(Func), Forward(Args)...); }