From 55242cdd99a37e5166ba4d46a26ae39ce97a1066 Mon Sep 17 00:00:00 2001 From: _Redstone_c_ Date: Tue, 3 Jan 2023 20:40:27 +0800 Subject: [PATCH] refactor(templates): remove TFunctionRef::IsValid() etc to avoid ambiguity --- Redcraft.Utility/Source/Public/Templates/Function.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Redcraft.Utility/Source/Public/Templates/Function.h b/Redcraft.Utility/Source/Public/Templates/Function.h index 42a932e..8fc4b9e 100644 --- a/Redcraft.Utility/Source/Public/Templates/Function.h +++ b/Redcraft.Utility/Source/Public/Templates/Function.h @@ -478,11 +478,11 @@ public: FORCEINLINE ResultType operator()(Ts... Args) const&& requires (CSameAs) { return CallImpl(Forward(Args)...); } /** @return false if instance stores a callable function target, true otherwise. */ - NODISCARD FORCEINLINE constexpr bool operator==(nullptr_t) const& { return !IsValid(); } + NODISCARD FORCEINLINE constexpr bool operator==(nullptr_t) const& requires (!bIsRef) { return !IsValid(); } /** @return true if instance stores a callable function target, false otherwise. */ - NODISCARD FORCEINLINE constexpr bool IsValid() const { return Storage.IsValid(); } - NODISCARD FORCEINLINE constexpr explicit operator bool() const { return Storage.IsValid(); } + NODISCARD FORCEINLINE constexpr bool IsValid() const requires (!bIsRef) { return Storage.IsValid(); } + NODISCARD FORCEINLINE constexpr explicit operator bool() const requires (!bIsRef) { return Storage.IsValid(); } private: @@ -492,7 +492,7 @@ private: FORCEINLINE ResultType CallImpl(Ts&&... Args) const { - checkf(IsValid(), TEXT("Attempting to call an unbound TFunction!")); + checkf(Storage.IsValid(), TEXT("Attempting to call an unbound TFunction!")); CallableType Callable = reinterpret_cast(Storage.GetCallable()); return Callable(Storage.GetValuePtr(), Forward(Args)...); }