Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
DelegateSignatureImpl.inl
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3// Only designed to be included directly by Delegate.h
4#if !defined( __Delegate_h__ ) || !defined( FUNC_INCLUDING_INLINE_IMPL )
5 #error "This inline header must only be included by Delegate.h"
6#endif
7
8#pragma once
9
10// HEADER_UNIT_SKIP - Not included directly
11
12#include "CoreTypes.h"
13#include "Misc/AssertionMacros.h"
14#include "Misc/Crc.h"
15#include "UObject/NameTypes.h"
16#include "UObject/ScriptDelegates.h"
17//#include "UObject/WeakObjectPtrTemplates.h"
18#include "Templates/IsConst.h"
19#include "Templates/RemoveReference.h"
20#include "Templates/SharedPointer.h"
21#include "Templates/UnrealTemplate.h"
22#include <type_traits>
23
24class FDelegateBase;
25class FDelegateHandle;
27struct FWeakObjectPtr;
28template <typename FuncType, typename UserPolicy> struct IBaseDelegateInstance;
29template <typename T> struct TObjectPtr;
30
31template <typename T>
32T* ToRawPtr(const TObjectPtr<T>& Ptr);
33
34template <typename To, typename From>
35To* Cast(From* Src);
36
37template<typename UserPolicy> class TMulticastDelegateBase;
38template<typename UserPolicy> class TTSMulticastDelegateBase;
39
40/**
41 * Unicast delegate template class.
42 *
43 * Use the various DECLARE_DELEGATE macros to create the actual delegate type, templated to
44 * the function signature the delegate is compatible with. Then, you can create an instance
45 * of that class when you want to bind a function to the delegate.
46 */
47template <typename DelegateSignature, typename UserPolicy = FDefaultDelegateUserPolicy>
49{
50 static_assert(sizeof(UserPolicy) == 0, "Expected a function signature for the delegate template parameter");
51};
52
53template <typename InRetValType, typename... ParamTypes, typename UserPolicy>
54class TDelegate<InRetValType(ParamTypes...), UserPolicy> : public TDelegateBase<UserPolicy>
55{
57 using FuncType = InRetValType (ParamTypes...);
58 using DelegateInstanceInterfaceType = IBaseDelegateInstance<FuncType, UserPolicy>;
59
60 using DelegateType = typename UserPolicy::FDelegateExtras;
61 using DelegateInstanceType = typename UserPolicy::FDelegateInstanceExtras;
62 using MulticastDelegateType = typename UserPolicy::FMulticastDelegateExtras;
63
64 static_assert(std::is_convertible_v<DelegateType*, FDelegateBase*>, "UserPolicy::FDelegateExtras should publicly inherit FDelegateBase");
65 static_assert(std::is_convertible_v<DelegateInstanceType*, IDelegateInstance*>, "UserPolicy::FDelegateInstanceExtras should publicly inherit IDelegateInstance");
66 static_assert(std::is_convertible_v<MulticastDelegateType*, TMulticastDelegateBase<UserPolicy>*> || std::is_convertible_v<MulticastDelegateType*, TTSMulticastDelegateBase<UserPolicy>*>, "UserPolicy::FMulticastDelegateExtras should publicly inherit TMulticastDelegateBase<UserPolicy> or TTSMulticastDelegateBase<UserPolicy>");
67
68 template <typename>
70
71 template <typename>
73
74public:
75 // Make sure FDelegateBase's public functions are publicly exposed through the TDelegate API
76 using Super::Unbind;
78
79private:
80 // Make sure FDelegateBase's protected functions are not accidentally exposed through the TDelegate API
82
83public:
84 /** Type definition for return value type. */
85 typedef InRetValType RetValType;
86 typedef InRetValType TFuncType(ParamTypes...);
87
88 /* Helper typedefs for getting a member function pointer type for the delegate with a given payload */
89 template <typename... VarTypes> using TFuncPtr = RetValType(*)(ParamTypes..., VarTypes...);
90 template <typename UserClass, typename... VarTypes> using TMethodPtr = typename TMemFunPtrType<false, UserClass, RetValType(ParamTypes..., VarTypes...)>::Type;
91 template <typename UserClass, typename... VarTypes> using TConstMethodPtr = typename TMemFunPtrType<true, UserClass, RetValType(ParamTypes..., VarTypes...)>::Type;
92
93 /** Declare the user's shared pointer-based delegate instance types. */
94 template <typename UserClass > struct UE_DEPRECATED(5.1, "DelegateType::TSPMethodDelegate<UserClass, ...>::FMethodPtr has been deprecated - use DelegateType::TMethodPtr<UserClass, ...> instead") TSPMethodDelegate : TBaseSPMethodDelegateInstance<false, UserClass, ESPMode::ThreadSafe, FuncType, UserPolicy > { typedef TBaseSPMethodDelegateInstance<false, UserClass, ESPMode::ThreadSafe, FuncType, UserPolicy > Super; TSPMethodDelegate (const TSharedRef< UserClass, ESPMode::ThreadSafe >& InUserObject, typename Super::FMethodPtr InMethodPtr ) : Super(InUserObject, InMethodPtr ) {} };
95 template <typename UserClass > struct UE_DEPRECATED(5.1, "DelegateType::TSPMethodDelegate_Const<UserClass, ...>::FMethodPtr has been deprecated - use DelegateType::TConstMethodPtr<UserClass, ...> instead") TSPMethodDelegate_Const : TBaseSPMethodDelegateInstance<true , UserClass, ESPMode::ThreadSafe, FuncType, UserPolicy > { typedef TBaseSPMethodDelegateInstance<true , UserClass, ESPMode::ThreadSafe, FuncType, UserPolicy > Super; TSPMethodDelegate_Const (const TSharedRef< UserClass, ESPMode::ThreadSafe >& InUserObject, typename Super::FMethodPtr InMethodPtr ) : Super(InUserObject, InMethodPtr ) {} };
96 template <typename UserClass, typename Var1Type > struct UE_DEPRECATED(5.1, "DelegateType::TSPMethodDelegate_OneVar<UserClass, ...>::FMethodPtr has been deprecated - use DelegateType::TMethodPtr<UserClass, ...> instead") TSPMethodDelegate_OneVar : TBaseSPMethodDelegateInstance<false, UserClass, ESPMode::ThreadSafe, FuncType, UserPolicy, Var1Type > { typedef TBaseSPMethodDelegateInstance<false, UserClass, ESPMode::ThreadSafe, FuncType, UserPolicy, Var1Type > Super; TSPMethodDelegate_OneVar (const TSharedRef< UserClass, ESPMode::ThreadSafe >& InUserObject, typename Super::FMethodPtr InMethodPtr, Var1Type Var1 ) : Super(InUserObject, InMethodPtr, Var1 ) {} };
97 template <typename UserClass, typename Var1Type > struct UE_DEPRECATED(5.1, "DelegateType::TSPMethodDelegate_OneVar_Const<UserClass, ...>::FMethodPtr has been deprecated - use DelegateType::TConstMethodPtr<UserClass, ...> instead") TSPMethodDelegate_OneVar_Const : TBaseSPMethodDelegateInstance<true , UserClass, ESPMode::ThreadSafe, FuncType, UserPolicy, Var1Type > { typedef TBaseSPMethodDelegateInstance<true , UserClass, ESPMode::ThreadSafe, FuncType, UserPolicy, Var1Type > Super; TSPMethodDelegate_OneVar_Const (const TSharedRef< UserClass, ESPMode::ThreadSafe >& InUserObject, typename Super::FMethodPtr InMethodPtr, Var1Type Var1 ) : Super(InUserObject, InMethodPtr, Var1 ) {} };
98 template <typename UserClass, typename Var1Type, typename Var2Type > struct UE_DEPRECATED(5.1, "DelegateType::TSPMethodDelegate_TwoVars<UserClass, ...>::FMethodPtr has been deprecated - use DelegateType::TMethodPtr<UserClass, ...> instead") TSPMethodDelegate_TwoVars : TBaseSPMethodDelegateInstance<false, UserClass, ESPMode::ThreadSafe, FuncType, UserPolicy, Var1Type, Var2Type > { typedef TBaseSPMethodDelegateInstance<false, UserClass, ESPMode::ThreadSafe, FuncType, UserPolicy, Var1Type, Var2Type > Super; TSPMethodDelegate_TwoVars (const TSharedRef< UserClass, ESPMode::ThreadSafe >& InUserObject, typename Super::FMethodPtr InMethodPtr, Var1Type Var1, Var2Type Var2 ) : Super(InUserObject, InMethodPtr, Var1, Var2 ) {} };
99 template <typename UserClass, typename Var1Type, typename Var2Type > struct UE_DEPRECATED(5.1, "DelegateType::TSPMethodDelegate_TwoVars_Const<UserClass, ...>::FMethodPtr has been deprecated - use DelegateType::TConstMethodPtr<UserClass, ...> instead") TSPMethodDelegate_TwoVars_Const : TBaseSPMethodDelegateInstance<true , UserClass, ESPMode::ThreadSafe, FuncType, UserPolicy, Var1Type, Var2Type > { typedef TBaseSPMethodDelegateInstance<true , UserClass, ESPMode::ThreadSafe, FuncType, UserPolicy, Var1Type, Var2Type > Super; TSPMethodDelegate_TwoVars_Const (const TSharedRef< UserClass, ESPMode::ThreadSafe >& InUserObject, typename Super::FMethodPtr InMethodPtr, Var1Type Var1, Var2Type Var2 ) : Super(InUserObject, InMethodPtr, Var1, Var2 ) {} };
100 template <typename UserClass, typename Var1Type, typename Var2Type, typename Var3Type > struct UE_DEPRECATED(5.1, "DelegateType::TSPMethodDelegate_ThreeVars<UserClass, ...>::FMethodPtr has been deprecated - use DelegateType::TMethodPtr<UserClass, ...> instead") TSPMethodDelegate_ThreeVars : TBaseSPMethodDelegateInstance<false, UserClass, ESPMode::ThreadSafe, FuncType, UserPolicy, Var1Type, Var2Type, Var3Type > { typedef TBaseSPMethodDelegateInstance<false, UserClass, ESPMode::ThreadSafe, FuncType, UserPolicy, Var1Type, Var2Type, Var3Type > Super; TSPMethodDelegate_ThreeVars (const TSharedRef< UserClass, ESPMode::ThreadSafe >& InUserObject, typename Super::FMethodPtr InMethodPtr, Var1Type Var1, Var2Type Var2, Var3Type Var3 ) : Super(InUserObject, InMethodPtr, Var1, Var2, Var3 ) {} };
101 template <typename UserClass, typename Var1Type, typename Var2Type, typename Var3Type > struct UE_DEPRECATED(5.1, "DelegateType::TSPMethodDelegate_ThreeVars_Const<UserClass, ...>::FMethodPtr has been deprecated - use DelegateType::TConstMethodPtr<UserClass, ...> instead") TSPMethodDelegate_ThreeVars_Const : TBaseSPMethodDelegateInstance<true , UserClass, ESPMode::ThreadSafe, FuncType, UserPolicy, Var1Type, Var2Type, Var3Type > { typedef TBaseSPMethodDelegateInstance<true , UserClass, ESPMode::ThreadSafe, FuncType, UserPolicy, Var1Type, Var2Type, Var3Type > Super; TSPMethodDelegate_ThreeVars_Const(const TSharedRef< UserClass, ESPMode::ThreadSafe >& InUserObject, typename Super::FMethodPtr InMethodPtr, Var1Type Var1, Var2Type Var2, Var3Type Var3 ) : Super(InUserObject, InMethodPtr, Var1, Var2, Var3 ) {} };
102 template <typename UserClass, typename Var1Type, typename Var2Type, typename Var3Type, typename Var4Type> struct UE_DEPRECATED(5.1, "DelegateType::TSPMethodDelegate_FourVars<UserClass, ...>::FMethodPtr has been deprecated - use DelegateType::TMethodPtr<UserClass, ...> instead") TSPMethodDelegate_FourVars : TBaseSPMethodDelegateInstance<false, UserClass, ESPMode::ThreadSafe, FuncType, UserPolicy, Var1Type, Var2Type, Var3Type, Var4Type> { typedef TBaseSPMethodDelegateInstance<false, UserClass, ESPMode::ThreadSafe, FuncType, UserPolicy, Var1Type, Var2Type, Var3Type, Var4Type> Super; TSPMethodDelegate_FourVars (const TSharedRef< UserClass, ESPMode::ThreadSafe >& InUserObject, typename Super::FMethodPtr InMethodPtr, Var1Type Var1, Var2Type Var2, Var3Type Var3, Var4Type Var4) : Super(InUserObject, InMethodPtr, Var1, Var2, Var3, Var4) {} };
103 template <typename UserClass, typename Var1Type, typename Var2Type, typename Var3Type, typename Var4Type> struct UE_DEPRECATED(5.1, "DelegateType::TSPMethodDelegate_FourVars_Const<UserClass, ...>::FMethodPtr has been deprecated - use DelegateType::TConstMethodPtr<UserClass, ...> instead") TSPMethodDelegate_FourVars_Const : TBaseSPMethodDelegateInstance<true , UserClass, ESPMode::ThreadSafe, FuncType, UserPolicy, Var1Type, Var2Type, Var3Type, Var4Type> { typedef TBaseSPMethodDelegateInstance<true , UserClass, ESPMode::ThreadSafe, FuncType, UserPolicy, Var1Type, Var2Type, Var3Type, Var4Type> Super; TSPMethodDelegate_FourVars_Const (const TSharedRef< UserClass, ESPMode::ThreadSafe >& InUserObject, typename Super::FMethodPtr InMethodPtr, Var1Type Var1, Var2Type Var2, Var3Type Var3, Var4Type Var4) : Super(InUserObject, InMethodPtr, Var1, Var2, Var3, Var4) {} };
104
105 /** Declare the user's shared pointer-based delegate instance types. */
106 template <typename UserClass > struct UE_DEPRECATED(5.1, "DelegateType::TThreadSafeSPMethodDelegate<UserClass, ...>::FMethodPtr has been deprecated - use DelegateType::TMethodPtr<UserClass, ...> instead") TThreadSafeSPMethodDelegate : TBaseSPMethodDelegateInstance<false, UserClass, ESPMode::ThreadSafe, FuncType, UserPolicy > { typedef TBaseSPMethodDelegateInstance<false, UserClass, ESPMode::ThreadSafe, FuncType, UserPolicy > Super; TThreadSafeSPMethodDelegate (const TSharedRef<UserClass, ESPMode::ThreadSafe>& InUserObject, typename Super::FMethodPtr InMethodPtr ) : Super(InUserObject, InMethodPtr ) {} };
107 template <typename UserClass > struct UE_DEPRECATED(5.1, "DelegateType::TThreadSafeSPMethodDelegate_Const<UserClass, ...>::FMethodPtr has been deprecated - use DelegateType::TConstMethodPtr<UserClass, ...> instead") TThreadSafeSPMethodDelegate_Const : TBaseSPMethodDelegateInstance<true , UserClass, ESPMode::ThreadSafe, FuncType, UserPolicy > { typedef TBaseSPMethodDelegateInstance<true , UserClass, ESPMode::ThreadSafe, FuncType, UserPolicy > Super; TThreadSafeSPMethodDelegate_Const (const TSharedRef<UserClass, ESPMode::ThreadSafe>& InUserObject, typename Super::FMethodPtr InMethodPtr ) : Super(InUserObject, InMethodPtr ) {} };
108 template <typename UserClass, typename Var1Type > struct UE_DEPRECATED(5.1, "DelegateType::TThreadSafeSPMethodDelegate_OneVar<UserClass, ...>::FMethodPtr has been deprecated - use DelegateType::TMethodPtr<UserClass, ...> instead") TThreadSafeSPMethodDelegate_OneVar : TBaseSPMethodDelegateInstance<false, UserClass, ESPMode::ThreadSafe, FuncType, UserPolicy, Var1Type > { typedef TBaseSPMethodDelegateInstance<false, UserClass, ESPMode::ThreadSafe, FuncType, UserPolicy, Var1Type > Super; TThreadSafeSPMethodDelegate_OneVar (const TSharedRef<UserClass, ESPMode::ThreadSafe>& InUserObject, typename Super::FMethodPtr InMethodPtr, Var1Type Var1 ) : Super(InUserObject, InMethodPtr, Var1 ) {} };
109 template <typename UserClass, typename Var1Type > struct UE_DEPRECATED(5.1, "DelegateType::TThreadSafeSPMethodDelegate_OneVar_Const<UserClass, ...>::FMethodPtr has been deprecated - use DelegateType::TConstMethodPtr<UserClass, ...> instead") TThreadSafeSPMethodDelegate_OneVar_Const : TBaseSPMethodDelegateInstance<true , UserClass, ESPMode::ThreadSafe, FuncType, UserPolicy, Var1Type > { typedef TBaseSPMethodDelegateInstance<true , UserClass, ESPMode::ThreadSafe, FuncType, UserPolicy, Var1Type > Super; TThreadSafeSPMethodDelegate_OneVar_Const (const TSharedRef<UserClass, ESPMode::ThreadSafe>& InUserObject, typename Super::FMethodPtr InMethodPtr, Var1Type Var1 ) : Super(InUserObject, InMethodPtr, Var1 ) {} };
110 template <typename UserClass, typename Var1Type, typename Var2Type > struct UE_DEPRECATED(5.1, "DelegateType::TThreadSafeSPMethodDelegate_TwoVars<UserClass, ...>::FMethodPtr has been deprecated - use DelegateType::TMethodPtr<UserClass, ...> instead") TThreadSafeSPMethodDelegate_TwoVars : TBaseSPMethodDelegateInstance<false, UserClass, ESPMode::ThreadSafe, FuncType, UserPolicy, Var1Type, Var2Type > { typedef TBaseSPMethodDelegateInstance<false, UserClass, ESPMode::ThreadSafe, FuncType, UserPolicy, Var1Type, Var2Type > Super; TThreadSafeSPMethodDelegate_TwoVars (const TSharedRef<UserClass, ESPMode::ThreadSafe>& InUserObject, typename Super::FMethodPtr InMethodPtr, Var1Type Var1, Var2Type Var2 ) : Super(InUserObject, InMethodPtr, Var1, Var2 ) {} };
111 template <typename UserClass, typename Var1Type, typename Var2Type > struct UE_DEPRECATED(5.1, "DelegateType::TThreadSafeSPMethodDelegate_TwoVars_Const<UserClass, ...>::FMethodPtr has been deprecated - use DelegateType::TConstMethodPtr<UserClass, ...> instead") TThreadSafeSPMethodDelegate_TwoVars_Const : TBaseSPMethodDelegateInstance<true , UserClass, ESPMode::ThreadSafe, FuncType, UserPolicy, Var1Type, Var2Type > { typedef TBaseSPMethodDelegateInstance<true , UserClass, ESPMode::ThreadSafe, FuncType, UserPolicy, Var1Type, Var2Type > Super; TThreadSafeSPMethodDelegate_TwoVars_Const (const TSharedRef<UserClass, ESPMode::ThreadSafe>& InUserObject, typename Super::FMethodPtr InMethodPtr, Var1Type Var1, Var2Type Var2 ) : Super(InUserObject, InMethodPtr, Var1, Var2 ) {} };
112 template <typename UserClass, typename Var1Type, typename Var2Type, typename Var3Type > struct UE_DEPRECATED(5.1, "DelegateType::TThreadSafeSPMethodDelegate_ThreeVars<UserClass, ...>::FMethodPtr has been deprecated - use DelegateType::TMethodPtr<UserClass, ...> instead") TThreadSafeSPMethodDelegate_ThreeVars : TBaseSPMethodDelegateInstance<false, UserClass, ESPMode::ThreadSafe, FuncType, UserPolicy, Var1Type, Var2Type, Var3Type > { typedef TBaseSPMethodDelegateInstance<false, UserClass, ESPMode::ThreadSafe, FuncType, UserPolicy, Var1Type, Var2Type, Var3Type > Super; TThreadSafeSPMethodDelegate_ThreeVars (const TSharedRef<UserClass, ESPMode::ThreadSafe>& InUserObject, typename Super::FMethodPtr InMethodPtr, Var1Type Var1, Var2Type Var2, Var3Type Var3 ) : Super(InUserObject, InMethodPtr, Var1, Var2, Var3 ) {} };
113 template <typename UserClass, typename Var1Type, typename Var2Type, typename Var3Type > struct UE_DEPRECATED(5.1, "DelegateType::TThreadSafeSPMethodDelegate_ThreeVars_Const<UserClass, ...>::FMethodPtr has been deprecated - use DelegateType::TConstMethodPtr<UserClass, ...> instead") TThreadSafeSPMethodDelegate_ThreeVars_Const : TBaseSPMethodDelegateInstance<true , UserClass, ESPMode::ThreadSafe, FuncType, UserPolicy, Var1Type, Var2Type, Var3Type > { typedef TBaseSPMethodDelegateInstance<true , UserClass, ESPMode::ThreadSafe, FuncType, UserPolicy, Var1Type, Var2Type, Var3Type > Super; TThreadSafeSPMethodDelegate_ThreeVars_Const(const TSharedRef<UserClass, ESPMode::ThreadSafe>& InUserObject, typename Super::FMethodPtr InMethodPtr, Var1Type Var1, Var2Type Var2, Var3Type Var3 ) : Super(InUserObject, InMethodPtr, Var1, Var2, Var3 ) {} };
114 template <typename UserClass, typename Var1Type, typename Var2Type, typename Var3Type, typename Var4Type> struct UE_DEPRECATED(5.1, "DelegateType::TThreadSafeSPMethodDelegate_FourVars<UserClass, ...>::FMethodPtr has been deprecated - use DelegateType::TMethodPtr<UserClass, ...> instead") TThreadSafeSPMethodDelegate_FourVars : TBaseSPMethodDelegateInstance<false, UserClass, ESPMode::ThreadSafe, FuncType, UserPolicy, Var1Type, Var2Type, Var3Type, Var4Type> { typedef TBaseSPMethodDelegateInstance<false, UserClass, ESPMode::ThreadSafe, FuncType, UserPolicy, Var1Type, Var2Type, Var3Type, Var4Type> Super; TThreadSafeSPMethodDelegate_FourVars (const TSharedRef<UserClass, ESPMode::ThreadSafe>& InUserObject, typename Super::FMethodPtr InMethodPtr, Var1Type Var1, Var2Type Var2, Var3Type Var3, Var4Type Var4) : Super(InUserObject, InMethodPtr, Var1, Var2, Var3, Var4) {} };
115 template <typename UserClass, typename Var1Type, typename Var2Type, typename Var3Type, typename Var4Type> struct UE_DEPRECATED(5.1, "DelegateType::TThreadSafeSPMethodDelegate_FourVars_Const<UserClass, ...>::FMethodPtr has been deprecated - use DelegateType::TConstMethodPtr<UserClass, ...> instead") TThreadSafeSPMethodDelegate_FourVars_Const : TBaseSPMethodDelegateInstance<true , UserClass, ESPMode::ThreadSafe, FuncType, UserPolicy, Var1Type, Var2Type, Var3Type, Var4Type> { typedef TBaseSPMethodDelegateInstance<true , UserClass, ESPMode::ThreadSafe, FuncType, UserPolicy, Var1Type, Var2Type, Var3Type, Var4Type> Super; TThreadSafeSPMethodDelegate_FourVars_Const (const TSharedRef<UserClass, ESPMode::ThreadSafe>& InUserObject, typename Super::FMethodPtr InMethodPtr, Var1Type Var1, Var2Type Var2, Var3Type Var3, Var4Type Var4) : Super(InUserObject, InMethodPtr, Var1, Var2, Var3, Var4) {} };
116
117 /** Declare the user's C++ pointer-based delegate instance types. */
118 template <typename UserClass > struct UE_DEPRECATED(5.1, "DelegateType::TRawMethodDelegate<UserClass, ...>::FMethodPtr has been deprecated - use DelegateType::TMethodPtr<UserClass, ...> instead") TRawMethodDelegate : TBaseRawMethodDelegateInstance<false, UserClass, FuncType, UserPolicy > { typedef TBaseRawMethodDelegateInstance<false, UserClass, FuncType, UserPolicy > Super; TRawMethodDelegate (UserClass* InUserObject, typename Super::FMethodPtr InMethodPtr ) : Super(InUserObject, InMethodPtr ) {} };
119 template <typename UserClass > struct UE_DEPRECATED(5.1, "DelegateType::TRawMethodDelegate_Const<UserClass, ...>::FMethodPtr has been deprecated - use DelegateType::TConstMethodPtr<UserClass, ...> instead") TRawMethodDelegate_Const : TBaseRawMethodDelegateInstance<true , UserClass, FuncType, UserPolicy > { typedef TBaseRawMethodDelegateInstance<true , UserClass, FuncType, UserPolicy > Super; TRawMethodDelegate_Const (UserClass* InUserObject, typename Super::FMethodPtr InMethodPtr ) : Super(InUserObject, InMethodPtr ) {} };
120 template <typename UserClass, typename Var1Type > struct UE_DEPRECATED(5.1, "DelegateType::TRawMethodDelegate_OneVar<UserClass, ...>::FMethodPtr has been deprecated - use DelegateType::TMethodPtr<UserClass, ...> instead") TRawMethodDelegate_OneVar : TBaseRawMethodDelegateInstance<false, UserClass, FuncType, UserPolicy, Var1Type > { typedef TBaseRawMethodDelegateInstance<false, UserClass, FuncType, UserPolicy, Var1Type > Super; TRawMethodDelegate_OneVar (UserClass* InUserObject, typename Super::FMethodPtr InMethodPtr, Var1Type Var1 ) : Super(InUserObject, InMethodPtr, Var1 ) {} };
121 template <typename UserClass, typename Var1Type > struct UE_DEPRECATED(5.1, "DelegateType::TRawMethodDelegate_OneVar_Const<UserClass, ...>::FMethodPtr has been deprecated - use DelegateType::TConstMethodPtr<UserClass, ...> instead") TRawMethodDelegate_OneVar_Const : TBaseRawMethodDelegateInstance<true , UserClass, FuncType, UserPolicy, Var1Type > { typedef TBaseRawMethodDelegateInstance<true , UserClass, FuncType, UserPolicy, Var1Type > Super; TRawMethodDelegate_OneVar_Const (UserClass* InUserObject, typename Super::FMethodPtr InMethodPtr, Var1Type Var1 ) : Super(InUserObject, InMethodPtr, Var1 ) {} };
122 template <typename UserClass, typename Var1Type, typename Var2Type > struct UE_DEPRECATED(5.1, "DelegateType::TRawMethodDelegate_TwoVars<UserClass, ...>::FMethodPtr has been deprecated - use DelegateType::TMethodPtr<UserClass, ...> instead") TRawMethodDelegate_TwoVars : TBaseRawMethodDelegateInstance<false, UserClass, FuncType, UserPolicy, Var1Type, Var2Type > { typedef TBaseRawMethodDelegateInstance<false, UserClass, FuncType, UserPolicy, Var1Type, Var2Type > Super; TRawMethodDelegate_TwoVars (UserClass* InUserObject, typename Super::FMethodPtr InMethodPtr, Var1Type Var1, Var2Type Var2 ) : Super(InUserObject, InMethodPtr, Var1, Var2 ) {} };
123 template <typename UserClass, typename Var1Type, typename Var2Type > struct UE_DEPRECATED(5.1, "DelegateType::TRawMethodDelegate_TwoVars_Const<UserClass, ...>::FMethodPtr has been deprecated - use DelegateType::TConstMethodPtr<UserClass, ...> instead") TRawMethodDelegate_TwoVars_Const : TBaseRawMethodDelegateInstance<true , UserClass, FuncType, UserPolicy, Var1Type, Var2Type > { typedef TBaseRawMethodDelegateInstance<true , UserClass, FuncType, UserPolicy, Var1Type, Var2Type > Super; TRawMethodDelegate_TwoVars_Const (UserClass* InUserObject, typename Super::FMethodPtr InMethodPtr, Var1Type Var1, Var2Type Var2 ) : Super(InUserObject, InMethodPtr, Var1, Var2 ) {} };
124 template <typename UserClass, typename Var1Type, typename Var2Type, typename Var3Type > struct UE_DEPRECATED(5.1, "DelegateType::TRawMethodDelegate_ThreeVars<UserClass, ...>::FMethodPtr has been deprecated - use DelegateType::TMethodPtr<UserClass, ...> instead") TRawMethodDelegate_ThreeVars : TBaseRawMethodDelegateInstance<false, UserClass, FuncType, UserPolicy, Var1Type, Var2Type, Var3Type > { typedef TBaseRawMethodDelegateInstance<false, UserClass, FuncType, UserPolicy, Var1Type, Var2Type, Var3Type > Super; TRawMethodDelegate_ThreeVars (UserClass* InUserObject, typename Super::FMethodPtr InMethodPtr, Var1Type Var1, Var2Type Var2, Var3Type Var3 ) : Super(InUserObject, InMethodPtr, Var1, Var2, Var3 ) {} };
125 template <typename UserClass, typename Var1Type, typename Var2Type, typename Var3Type > struct UE_DEPRECATED(5.1, "DelegateType::TRawMethodDelegate_ThreeVars_Const<UserClass, ...>::FMethodPtr has been deprecated - use DelegateType::TConstMethodPtr<UserClass, ...> instead") TRawMethodDelegate_ThreeVars_Const : TBaseRawMethodDelegateInstance<true , UserClass, FuncType, UserPolicy, Var1Type, Var2Type, Var3Type > { typedef TBaseRawMethodDelegateInstance<true , UserClass, FuncType, UserPolicy, Var1Type, Var2Type, Var3Type > Super; TRawMethodDelegate_ThreeVars_Const(UserClass* InUserObject, typename Super::FMethodPtr InMethodPtr, Var1Type Var1, Var2Type Var2, Var3Type Var3 ) : Super(InUserObject, InMethodPtr, Var1, Var2, Var3 ) {} };
126 template <typename UserClass, typename Var1Type, typename Var2Type, typename Var3Type, typename Var4Type> struct UE_DEPRECATED(5.1, "DelegateType::TRawMethodDelegate_FourVars<UserClass, ...>::FMethodPtr has been deprecated - use DelegateType::TMethodPtr<UserClass, ...> instead") TRawMethodDelegate_FourVars : TBaseRawMethodDelegateInstance<false, UserClass, FuncType, UserPolicy, Var1Type, Var2Type, Var3Type, Var4Type> { typedef TBaseRawMethodDelegateInstance<false, UserClass, FuncType, UserPolicy, Var1Type, Var2Type, Var3Type, Var4Type> Super; TRawMethodDelegate_FourVars (UserClass* InUserObject, typename Super::FMethodPtr InMethodPtr, Var1Type Var1, Var2Type Var2, Var3Type Var3, Var4Type Var4) : Super(InUserObject, InMethodPtr, Var1, Var2, Var3, Var4) {} };
127 template <typename UserClass, typename Var1Type, typename Var2Type, typename Var3Type, typename Var4Type> struct UE_DEPRECATED(5.1, "DelegateType::TRawMethodDelegate_FourVars_Const<UserClass, ...>::FMethodPtr has been deprecated - use DelegateType::TConstMethodPtr<UserClass, ...> instead") TRawMethodDelegate_FourVars_Const : TBaseRawMethodDelegateInstance<true , UserClass, FuncType, UserPolicy, Var1Type, Var2Type, Var3Type, Var4Type> { typedef TBaseRawMethodDelegateInstance<true , UserClass, FuncType, UserPolicy, Var1Type, Var2Type, Var3Type, Var4Type> Super; TRawMethodDelegate_FourVars_Const (UserClass* InUserObject, typename Super::FMethodPtr InMethodPtr, Var1Type Var1, Var2Type Var2, Var3Type Var3, Var4Type Var4) : Super(InUserObject, InMethodPtr, Var1, Var2, Var3, Var4) {} };
128
129 /** Declare the user's UFunction-based delegate instance types. */
130 template <typename UObjectTemplate > struct UE_DEPRECATED(5.1, "DelegateType::TUFunctionDelegateBinding has been deprecated") TUFunctionDelegateBinding : TBaseUFunctionDelegateInstance<UObjectTemplate, FuncType, UserPolicy > { typedef TBaseUFunctionDelegateInstance<UObjectTemplate, FuncType, UserPolicy > Super; TUFunctionDelegateBinding (UObjectTemplate* InUserObject, const FName& InFunctionName ) : Super(InUserObject, InFunctionName ) {} };
131 template <typename UObjectTemplate, typename Var1Type > struct UE_DEPRECATED(5.1, "DelegateType::TUFunctionDelegateBinding_OneVar has been deprecated") TUFunctionDelegateBinding_OneVar : TBaseUFunctionDelegateInstance<UObjectTemplate, FuncType, UserPolicy, Var1Type > { typedef TBaseUFunctionDelegateInstance<UObjectTemplate, FuncType, UserPolicy, Var1Type > Super; TUFunctionDelegateBinding_OneVar (UObjectTemplate* InUserObject, const FName& InFunctionName, Var1Type Var1 ) : Super(InUserObject, InFunctionName, Var1 ) {} };
132 template <typename UObjectTemplate, typename Var1Type, typename Var2Type > struct UE_DEPRECATED(5.1, "DelegateType::TUFunctionDelegateBinding_TwoVars has been deprecated") TUFunctionDelegateBinding_TwoVars : TBaseUFunctionDelegateInstance<UObjectTemplate, FuncType, UserPolicy, Var1Type, Var2Type > { typedef TBaseUFunctionDelegateInstance<UObjectTemplate, FuncType, UserPolicy, Var1Type, Var2Type > Super; TUFunctionDelegateBinding_TwoVars (UObjectTemplate* InUserObject, const FName& InFunctionName, Var1Type Var1, Var2Type Var2 ) : Super(InUserObject, InFunctionName, Var1, Var2 ) {} };
133 template <typename UObjectTemplate, typename Var1Type, typename Var2Type, typename Var3Type > struct UE_DEPRECATED(5.1, "DelegateType::TUFunctionDelegateBinding_ThreeVars has been deprecated") TUFunctionDelegateBinding_ThreeVars : TBaseUFunctionDelegateInstance<UObjectTemplate, FuncType, UserPolicy, Var1Type, Var2Type, Var3Type > { typedef TBaseUFunctionDelegateInstance<UObjectTemplate, FuncType, UserPolicy, Var1Type, Var2Type, Var3Type > Super; TUFunctionDelegateBinding_ThreeVars(UObjectTemplate* InUserObject, const FName& InFunctionName, Var1Type Var1, Var2Type Var2, Var3Type Var3 ) : Super(InUserObject, InFunctionName, Var1, Var2, Var3 ) {} };
134 template <typename UObjectTemplate, typename Var1Type, typename Var2Type, typename Var3Type, typename Var4Type> struct UE_DEPRECATED(5.1, "DelegateType::TUFunctionDelegateBinding_FourVars has been deprecated") TUFunctionDelegateBinding_FourVars : TBaseUFunctionDelegateInstance<UObjectTemplate, FuncType, UserPolicy, Var1Type, Var2Type, Var3Type, Var4Type> { typedef TBaseUFunctionDelegateInstance<UObjectTemplate, FuncType, UserPolicy, Var1Type, Var2Type, Var3Type, Var4Type> Super; TUFunctionDelegateBinding_FourVars (UObjectTemplate* InUserObject, const FName& InFunctionName, Var1Type Var1, Var2Type Var2, Var3Type Var3, Var4Type Var4) : Super(InUserObject, InFunctionName, Var1, Var2, Var3, Var4) {} };
135
136 /** Declare the user's UObject-based delegate instance types. */
137 template <typename UserClass > struct UE_DEPRECATED(5.1, "DelegateType::TUObjectMethodDelegate<UserClass, ...>::FMethodPtr has been deprecated - use DelegateType::TMethodPtr<UserClass, ...> instead") TUObjectMethodDelegate : TBaseUObjectMethodDelegateInstance<false, UserClass, FuncType, UserPolicy > { typedef TBaseUObjectMethodDelegateInstance<false, UserClass, FuncType, UserPolicy > Super; TUObjectMethodDelegate (UserClass* InUserObject, typename Super::FMethodPtr InMethodPtr ) : Super(InUserObject, InMethodPtr ) {} };
138 template <typename UserClass > struct UE_DEPRECATED(5.1, "DelegateType::TUObjectMethodDelegate_Const<UserClass, ...>::FMethodPtr has been deprecated - use DelegateType::TConstMethodPtr<UserClass, ...> instead") TUObjectMethodDelegate_Const : TBaseUObjectMethodDelegateInstance<true , UserClass, FuncType, UserPolicy > { typedef TBaseUObjectMethodDelegateInstance<true , UserClass, FuncType, UserPolicy > Super; TUObjectMethodDelegate_Const (UserClass* InUserObject, typename Super::FMethodPtr InMethodPtr ) : Super(InUserObject, InMethodPtr ) {} };
139 template <typename UserClass, typename Var1Type > struct UE_DEPRECATED(5.1, "DelegateType::TUObjectMethodDelegate_OneVar<UserClass, ...>::FMethodPtr has been deprecated - use DelegateType::TMethodPtr<UserClass, ...> instead") TUObjectMethodDelegate_OneVar : TBaseUObjectMethodDelegateInstance<false, UserClass, FuncType, UserPolicy, Var1Type > { typedef TBaseUObjectMethodDelegateInstance<false, UserClass, FuncType, UserPolicy, Var1Type > Super; TUObjectMethodDelegate_OneVar (UserClass* InUserObject, typename Super::FMethodPtr InMethodPtr, Var1Type Var1 ) : Super(InUserObject, InMethodPtr, Var1 ) {} };
140 template <typename UserClass, typename Var1Type > struct UE_DEPRECATED(5.1, "DelegateType::TUObjectMethodDelegate_OneVar_Const<UserClass, ...>::FMethodPtr has been deprecated - use DelegateType::TConstMethodPtr<UserClass, ...> instead") TUObjectMethodDelegate_OneVar_Const : TBaseUObjectMethodDelegateInstance<true , UserClass, FuncType, UserPolicy, Var1Type > { typedef TBaseUObjectMethodDelegateInstance<true , UserClass, FuncType, UserPolicy, Var1Type > Super; TUObjectMethodDelegate_OneVar_Const (UserClass* InUserObject, typename Super::FMethodPtr InMethodPtr, Var1Type Var1 ) : Super(InUserObject, InMethodPtr, Var1 ) {} };
141 template <typename UserClass, typename Var1Type, typename Var2Type > struct UE_DEPRECATED(5.1, "DelegateType::TUObjectMethodDelegate_TwoVars<UserClass, ...>::FMethodPtr has been deprecated - use DelegateType::TMethodPtr<UserClass, ...> instead") TUObjectMethodDelegate_TwoVars : TBaseUObjectMethodDelegateInstance<false, UserClass, FuncType, UserPolicy, Var1Type, Var2Type > { typedef TBaseUObjectMethodDelegateInstance<false, UserClass, FuncType, UserPolicy, Var1Type, Var2Type > Super; TUObjectMethodDelegate_TwoVars (UserClass* InUserObject, typename Super::FMethodPtr InMethodPtr, Var1Type Var1, Var2Type Var2 ) : Super(InUserObject, InMethodPtr, Var1, Var2 ) {} };
142 template <typename UserClass, typename Var1Type, typename Var2Type > struct UE_DEPRECATED(5.1, "DelegateType::TUObjectMethodDelegate_TwoVars_Const<UserClass, ...>::FMethodPtr has been deprecated - use DelegateType::TConstMethodPtr<UserClass, ...> instead") TUObjectMethodDelegate_TwoVars_Const : TBaseUObjectMethodDelegateInstance<true , UserClass, FuncType, UserPolicy, Var1Type, Var2Type > { typedef TBaseUObjectMethodDelegateInstance<true , UserClass, FuncType, UserPolicy, Var1Type, Var2Type > Super; TUObjectMethodDelegate_TwoVars_Const (UserClass* InUserObject, typename Super::FMethodPtr InMethodPtr, Var1Type Var1, Var2Type Var2 ) : Super(InUserObject, InMethodPtr, Var1, Var2 ) {} };
143 template <typename UserClass, typename Var1Type, typename Var2Type, typename Var3Type > struct UE_DEPRECATED(5.1, "DelegateType::TUObjectMethodDelegate_ThreeVars<UserClass, ...>::FMethodPtr has been deprecated - use DelegateType::TMethodPtr<UserClass, ...> instead") TUObjectMethodDelegate_ThreeVars : TBaseUObjectMethodDelegateInstance<false, UserClass, FuncType, UserPolicy, Var1Type, Var2Type, Var3Type > { typedef TBaseUObjectMethodDelegateInstance<false, UserClass, FuncType, UserPolicy, Var1Type, Var2Type, Var3Type > Super; TUObjectMethodDelegate_ThreeVars (UserClass* InUserObject, typename Super::FMethodPtr InMethodPtr, Var1Type Var1, Var2Type Var2, Var3Type Var3 ) : Super(InUserObject, InMethodPtr, Var1, Var2, Var3 ) {} };
144 template <typename UserClass, typename Var1Type, typename Var2Type, typename Var3Type > struct UE_DEPRECATED(5.1, "DelegateType::TUObjectMethodDelegate_ThreeVars_Const<UserClass, ...>::FMethodPtr has been deprecated - use DelegateType::TConstMethodPtr<UserClass, ...> instead") TUObjectMethodDelegate_ThreeVars_Const : TBaseUObjectMethodDelegateInstance<true , UserClass, FuncType, UserPolicy, Var1Type, Var2Type, Var3Type > { typedef TBaseUObjectMethodDelegateInstance<true , UserClass, FuncType, UserPolicy, Var1Type, Var2Type, Var3Type > Super; TUObjectMethodDelegate_ThreeVars_Const(UserClass* InUserObject, typename Super::FMethodPtr InMethodPtr, Var1Type Var1, Var2Type Var2, Var3Type Var3 ) : Super(InUserObject, InMethodPtr, Var1, Var2, Var3 ) {} };
145 template <typename UserClass, typename Var1Type, typename Var2Type, typename Var3Type, typename Var4Type> struct UE_DEPRECATED(5.1, "DelegateType::TUObjectMethodDelegate_FourVars<UserClass, ...>::FMethodPtr has been deprecated - use DelegateType::TMethodPtr<UserClass, ...> instead") TUObjectMethodDelegate_FourVars : TBaseUObjectMethodDelegateInstance<false, UserClass, FuncType, UserPolicy, Var1Type, Var2Type, Var3Type, Var4Type> { typedef TBaseUObjectMethodDelegateInstance<false, UserClass, FuncType, UserPolicy, Var1Type, Var2Type, Var3Type, Var4Type> Super; TUObjectMethodDelegate_FourVars (UserClass* InUserObject, typename Super::FMethodPtr InMethodPtr, Var1Type Var1, Var2Type Var2, Var3Type Var3, Var4Type Var4) : Super(InUserObject, InMethodPtr, Var1, Var2, Var3, Var4) {} };
146 template <typename UserClass, typename Var1Type, typename Var2Type, typename Var3Type, typename Var4Type> struct UE_DEPRECATED(5.1, "DelegateType::TUObjectMethodDelegate_FourVars_Const<UserClass, ...>::FMethodPtr has been deprecated - use DelegateType::TConstMethodPtr<UserClass, ...> instead") TUObjectMethodDelegate_FourVars_Const : TBaseUObjectMethodDelegateInstance<true , UserClass, FuncType, UserPolicy, Var1Type, Var2Type, Var3Type, Var4Type> { typedef TBaseUObjectMethodDelegateInstance<true , UserClass, FuncType, UserPolicy, Var1Type, Var2Type, Var3Type, Var4Type> Super; TUObjectMethodDelegate_FourVars_Const (UserClass* InUserObject, typename Super::FMethodPtr InMethodPtr, Var1Type Var1, Var2Type Var2, Var3Type Var3, Var4Type Var4) : Super(InUserObject, InMethodPtr, Var1, Var2, Var3, Var4) {} };
147
148 /** Declare the user's static function pointer delegate instance types. */
149 template <typename... VarTypes > struct UE_DEPRECATED(5.1, "DelegateType::FStaticDelegate<...>::FFuncPtr has been deprecated - use DelegateType::TFuncPtr<...> instead") FStaticDelegate : TBaseStaticDelegateInstance<FuncType, UserPolicy, VarTypes... > { typedef TBaseStaticDelegateInstance<FuncType, UserPolicy, VarTypes... > Super; FStaticDelegate ( typename Super::FFuncPtr InFuncPtr, VarTypes... Vars ) : Super(InFuncPtr, Vars... ) {} };
150
151public:
152
153 /**
154 * Static: Creates a raw C++ pointer global function delegate
155 */
156 template <typename... VarTypes>
157 UE_NODISCARD inline static TDelegate<RetValType(ParamTypes...), UserPolicy> CreateStatic(typename TIdentity<RetValType (*)(ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
158 {
161 return Result;
162 }
163
164 /**
165 * Static: Creates a C++ lambda delegate
166 * technically this works for any functor types, but lambdas are the primary use case
167 */
168 template<typename FunctorType, typename... VarTypes>
169 UE_NODISCARD inline static TDelegate<RetValType(ParamTypes...), UserPolicy> CreateLambda(FunctorType&& InFunctor, VarTypes&&... Vars)
170 {
173 return Result;
174 }
175
176 /**
177 * Static: Creates a weak object C++ lambda delegate
178 * technically this works for any functor types, but lambdas are the primary use case
179 */
180 template<typename UserClass, typename FunctorType, typename... VarTypes>
181 UE_NODISCARD inline static TDelegate<RetValType(ParamTypes...), UserPolicy> CreateWeakLambda(UserClass* InUserObject, FunctorType&& InFunctor, VarTypes&&... Vars)
182 {
185 return Result;
186 }
187
188 /**
189 * Static: Creates a raw C++ pointer member function delegate.
190 *
191 * Raw pointer doesn't use any sort of reference, so may be unsafe to call if the object was
192 * deleted out from underneath your delegate. Be careful when calling Execute()!
193 */
194 template <typename UserClass, typename... VarTypes>
195 UE_NODISCARD inline static TDelegate<RetValType(ParamTypes...), UserPolicy> CreateRaw(UserClass* InUserObject, typename TMemFunPtrType<false, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
196 {
197 static_assert(!TIsConst<UserClass>::Value, "Attempting to bind a delegate with a const object pointer and non-const member function.");
198
201 return Result;
202 }
203 template <typename UserClass, typename... VarTypes>
204 UE_NODISCARD inline static TDelegate<RetValType(ParamTypes...), UserPolicy> CreateRaw(const UserClass* InUserObject, typename TMemFunPtrType<true, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
205 {
208 return Result;
209 }
210
211 /**
212 * Static: Creates a shared pointer-based member function delegate.
213 *
214 * Shared pointer delegates keep a weak reference to your object.
215 * You can use ExecuteIfBound() to call them.
216 */
217 template <typename UserClass, ESPMode Mode, typename... VarTypes>
218 UE_NODISCARD inline static TDelegate<RetValType(ParamTypes...), UserPolicy> CreateSP(const TSharedRef<UserClass, Mode>& InUserObjectRef, typename TMemFunPtrType<false, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
219 {
220 static_assert(!TIsConst<UserClass>::Value, "Attempting to bind a delegate with a const object pointer and non-const member function.");
221
224 return Result;
225 }
226 template <typename UserClass, ESPMode Mode, typename... VarTypes>
227 UE_NODISCARD inline static TDelegate<RetValType(ParamTypes...), UserPolicy> CreateSP(const TSharedRef<UserClass, Mode>& InUserObjectRef, typename TMemFunPtrType<true, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
228 {
231 return Result;
232 }
233
234 /**
235 * Static: Creates a shared pointer-based member function delegate.
236 *
237 * Shared pointer delegates keep a weak reference to your object.
238 * You can use ExecuteIfBound() to call them.
239 */
240 template <typename UserClass, typename... VarTypes>
241 UE_NODISCARD inline static TDelegate<RetValType(ParamTypes...), UserPolicy> CreateSP(UserClass* InUserObject, typename TMemFunPtrType<false, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
242 {
243 static_assert(!TIsConst<UserClass>::Value, "Attempting to bind a delegate with a const object pointer and non-const member function.");
244
247 return Result;
248 }
249 template <typename UserClass, typename... VarTypes>
250 UE_NODISCARD inline static TDelegate<RetValType(ParamTypes...), UserPolicy> CreateSP(const UserClass* InUserObject, typename TMemFunPtrType<true, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
251 {
254 return Result;
255 }
256
257 /**
258 * Static: Creates a shared pointer-based (thread-safe) member function delegate.
259 *
260 * Shared pointer delegates keep a weak reference to your object.
261 * You can use ExecuteIfBound() to call them.
262 *
263 * Note: This function is redundant, but is retained for backwards compatibility. CreateSP() works in both thread-safe and not-thread-safe modes and should be preferred.
264 */
265 template <typename UserClass, typename... VarTypes>
266 UE_NODISCARD inline static TDelegate<RetValType(ParamTypes...), UserPolicy> CreateThreadSafeSP(const TSharedRef<UserClass, ESPMode::ThreadSafe>& InUserObjectRef, typename TMemFunPtrType<false, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
267 {
268 static_assert(!TIsConst<UserClass>::Value, "Attempting to bind a delegate with a const object pointer and non-const member function.");
269
272 return Result;
273 }
274 template <typename UserClass, typename... VarTypes>
275 UE_NODISCARD inline static TDelegate<RetValType(ParamTypes...), UserPolicy> CreateThreadSafeSP(const TSharedRef<UserClass, ESPMode::ThreadSafe>& InUserObjectRef, typename TMemFunPtrType<true, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
276 {
279 return Result;
280 }
281
282 /**
283 * Static: Creates a shared pointer-based (thread-safe) member function delegate.
284 *
285 * Shared pointer delegates keep a weak reference to your object.
286 * You can use ExecuteIfBound() to call them.
287 *
288 * Note: This function is redundant, but is retained for backwards compatibility. CreateSP() works in both thread-safe and not-thread-safe modes and should be preferred.
289 */
290 template <typename UserClass, typename... VarTypes>
291 UE_NODISCARD inline static TDelegate<RetValType(ParamTypes...), UserPolicy> CreateThreadSafeSP(UserClass* InUserObject, typename TMemFunPtrType<false, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
292 {
293 static_assert(!TIsConst<UserClass>::Value, "Attempting to bind a delegate with a const object pointer and non-const member function.");
294
297 return Result;
298 }
299 template <typename UserClass, typename... VarTypes>
300 UE_NODISCARD inline static TDelegate<RetValType(ParamTypes...), UserPolicy> CreateThreadSafeSP(const UserClass* InUserObject, typename TMemFunPtrType<true, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
301 {
304 return Result;
305 }
306
307 /**
308 * Static: Creates a UFunction-based member function delegate.
309 *
310 * UFunction delegates keep a weak reference to your object.
311 * You can use ExecuteIfBound() to call them.
312 */
313 template <typename UObjectTemplate, typename... VarTypes>
314 UE_NODISCARD inline static TDelegate<RetValType(ParamTypes...), UserPolicy> CreateUFunction(UObjectTemplate* InUserObject, const FName& InFunctionName, VarTypes&&... Vars)
315 {
318 return Result;
319 }
320 template <typename UObjectTemplate, typename... VarTypes>
321 UE_NODISCARD inline static TDelegate<RetValType(ParamTypes...), UserPolicy> CreateUFunction(TObjectPtr<UObjectTemplate> InUserObject, const FName& InFunctionName, VarTypes&&... Vars)
322 {
325 return Result;
326 }
327
328 /**
329 * Static: Creates a UObject-based member function delegate.
330 *
331 * UObject delegates keep a weak reference to your object.
332 * You can use ExecuteIfBound() to call them.
333 */
334 template <typename UserClass, typename... VarTypes>
335 UE_NODISCARD inline static TDelegate<RetValType(ParamTypes...), UserPolicy> CreateUObject(UserClass* InUserObject, typename TMemFunPtrType<false, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
336 {
337 static_assert(!TIsConst<UserClass>::Value, "Attempting to bind a delegate with a const object pointer and non-const member function.");
338
341 return Result;
342 }
343 template <typename UserClass, typename... VarTypes>
344 UE_NODISCARD inline static TDelegate<RetValType(ParamTypes...), UserPolicy> CreateUObject(const UserClass* InUserObject, typename TMemFunPtrType<true, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
345 {
348 return Result;
349 }
350 template <typename UserClass, typename... VarTypes>
351 UE_NODISCARD inline static TDelegate<RetValType(ParamTypes...), UserPolicy> CreateUObject(TObjectPtr<UserClass> InUserObject, typename TMemFunPtrType<false, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
352 {
353 static_assert(!TIsConst<UserClass>::Value, "Attempting to bind a delegate with a const object pointer and non-const member function.");
354
357 return Result;
358 }
359 template <typename UserClass, typename... VarTypes>
360 UE_NODISCARD inline static TDelegate<RetValType(ParamTypes...), UserPolicy> CreateUObject(TObjectPtr<UserClass> InUserObject, typename TMemFunPtrType<true, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
361 {
364 return Result;
365 }
366
367public:
368
369 /**
370 * Default constructor
371 */
372 inline TDelegate()
373 {
374 }
375
376 /**
377 * 'Null' constructor
378 */
379 inline TDelegate(TYPE_OF_NULLPTR)
380 {
381 }
382
383 /**
384 * Destructor.
385 */
386 inline ~TDelegate()
387 {
388 Unbind();
389 }
390
391 /**
392 * Move constructor.
393 *
394 * @param Other The delegate object to move from.
395 */
396 TDelegate(TDelegate&& Other) = default;
397
398 /**
399 * Creates and initializes a new instance from an existing delegate object.
400 *
401 * @param Other The delegate object to copy from.
402 */
403 inline TDelegate(const TDelegate& Other)
404 {
405 *this = Other;
406 }
407
408 /**
409 * Move assignment operator.
410 *
411 * @param OtherDelegate Delegate object to copy from
412 */
413 TDelegate& operator=(TDelegate&& Other) = default;
414
415 /**
416 * Assignment operator.
417 *
418 * @param OtherDelegate Delegate object to copy from
419 */
420 inline TDelegate& operator=(const TDelegate& Other)
421 {
422 if (&Other != this)
423 {
424 // this down-cast is OK! allows for managing invocation list in the base class without requiring virtual functions
426
427 if (OtherInstance != nullptr)
428 {
430 }
431 else
432 {
433 Unbind();
434 }
435 }
436
437 return *this;
438 }
439
440public:
441
442 /**
443 * Binds a raw C++ pointer global function delegate
444 */
445 template <typename... VarTypes>
446 inline void BindStatic(typename TBaseStaticDelegateInstance<FuncType, UserPolicy, std::decay_t<VarTypes>...>::FFuncPtr InFunc, VarTypes&&... Vars)
447 {
449 }
450
451 /**
452 * Static: Binds a C++ lambda delegate
453 * technically this works for any functor types, but lambdas are the primary use case
454 */
455 template<typename FunctorType, typename... VarTypes>
456 inline void BindLambda(FunctorType&& InFunctor, VarTypes&&... Vars)
457 {
459 }
460
461 /**
462 * Static: Binds a weak object C++ lambda delegate
463 * technically this works for any functor types, but lambdas are the primary use case
464 */
465 template<typename UserClass, typename FunctorType, typename... VarTypes>
466 inline void BindWeakLambda(UserClass* InUserObject, FunctorType&& InFunctor, VarTypes&&... Vars)
467 {
469 }
470
471 /**
472 * Binds a raw C++ pointer delegate.
473 *
474 * Raw pointer doesn't use any sort of reference, so may be unsafe to call if the object was
475 * deleted out from underneath your delegate. Be careful when calling Execute()!
476 */
477 template <typename UserClass, typename... VarTypes>
478 inline void BindRaw(UserClass* InUserObject, typename TMemFunPtrType<false, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
479 {
480 static_assert(!TIsConst<UserClass>::Value, "Attempting to bind a delegate with a const object pointer and non-const member function.");
481
483 }
484 template <typename UserClass, typename... VarTypes>
485 inline void BindRaw(const UserClass* InUserObject, typename TMemFunPtrType<true, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
486 {
488 }
489
490 /**
491 * Binds a shared pointer-based member function delegate. Shared pointer delegates keep a weak reference to your object. You can use ExecuteIfBound() to call them.
492 */
493 template <typename UserClass, ESPMode Mode, typename... VarTypes>
494 inline void BindSP(const TSharedRef<UserClass, Mode>& InUserObjectRef, typename TMemFunPtrType<false, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
495 {
496 static_assert(!TIsConst<UserClass>::Value, "Attempting to bind a delegate with a const object pointer and non-const member function.");
497
499 }
500 template <typename UserClass, ESPMode Mode, typename... VarTypes>
501 inline void BindSP(const TSharedRef<UserClass, Mode>& InUserObjectRef, typename TMemFunPtrType<true, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
502 {
504 }
505
506 /**
507 * Binds a shared pointer-based member function delegate.
508 *
509 * Shared pointer delegates keep a weak reference to your object.
510 * You can use ExecuteIfBound() to call them.
511 */
512 template <typename UserClass, typename... VarTypes>
513 inline void BindSP(UserClass* InUserObject, typename TMemFunPtrType<false, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
514 {
515 static_assert(!TIsConst<UserClass>::Value, "Attempting to bind a delegate with a const object pointer and non-const member function.");
516
518 }
519 template <typename UserClass, typename... VarTypes>
520 inline void BindSP(const UserClass* InUserObject, typename TMemFunPtrType<true, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
521 {
523 }
524
525 /**
526 * Binds a shared pointer-based (thread-safe) member function delegate.
527 *
528 * Shared pointer delegates keep a weak reference to your object.
529 * You can use ExecuteIfBound() to call them.
530 *
531 * Note: This function is redundant, but is retained for backwards compatibility. BindSP() works in both thread-safe and not-thread-safe modes and should be preferred.
532 */
533 template <typename UserClass, typename... VarTypes>
534 inline void BindThreadSafeSP(const TSharedRef<UserClass, ESPMode::ThreadSafe>& InUserObjectRef, typename TMemFunPtrType<false, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
535 {
536 static_assert(!TIsConst<UserClass>::Value, "Attempting to bind a delegate with a const object pointer and non-const member function.");
537
539 }
540 template <typename UserClass, typename... VarTypes>
541 inline void BindThreadSafeSP(const TSharedRef<UserClass, ESPMode::ThreadSafe>& InUserObjectRef, typename TMemFunPtrType<true, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
542 {
544 }
545
546 /**
547 * Binds a shared pointer-based (thread-safe) member function delegate.
548 *
549 * Shared pointer delegates keep a weak reference to your object.
550 * You can use ExecuteIfBound() to call them.
551 *
552 * Note: This function is redundant, but is retained for backwards compatibility. BindSP() works in both thread-safe and not-thread-safe modes and should be preferred.
553 */
554 template <typename UserClass, typename... VarTypes>
555 inline void BindThreadSafeSP(UserClass* InUserObject, typename TMemFunPtrType<false, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
556 {
557 static_assert(!TIsConst<UserClass>::Value, "Attempting to bind a delegate with a const object pointer and non-const member function.");
558
560 }
561 template <typename UserClass, typename... VarTypes>
562 inline void BindThreadSafeSP(const UserClass* InUserObject, typename TMemFunPtrType<true, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
563 {
565 }
566
567 /**
568 * Binds a UFunction-based member function delegate.
569 *
570 * UFunction delegates keep a weak reference to your object.
571 * You can use ExecuteIfBound() to call them.
572 */
573 template <typename UObjectTemplate, typename... VarTypes>
574 inline void BindUFunction(UObjectTemplate* InUserObject, const FName& InFunctionName, VarTypes&&... Vars)
575 {
577 }
578 template <typename UObjectTemplate, typename... VarTypes>
579 inline void BindUFunction(TObjectPtr<UObjectTemplate> InUserObject, const FName& InFunctionName, VarTypes&&... Vars)
580 {
582 }
583
584 /**
585 * Binds a UObject-based member function delegate.
586 *
587 * UObject delegates keep a weak reference to your object.
588 * You can use ExecuteIfBound() to call them.
589 */
590 template <typename UserClass, typename... VarTypes>
591 inline void BindUObject(UserClass* InUserObject, typename TMemFunPtrType<false, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
592 {
593 static_assert(!TIsConst<UserClass>::Value, "Attempting to bind a delegate with a const object pointer and non-const member function.");
594
596 }
597 template <typename UserClass, typename... VarTypes>
598 inline void BindUObject(const UserClass* InUserObject, typename TMemFunPtrType<true, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
599 {
601 }
602 template <typename UserClass, typename... VarTypes>
603 inline void BindUObject(TObjectPtr<UserClass> InUserObject, typename TMemFunPtrType<false, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
604 {
605 static_assert(!TIsConst<UserClass>::Value, "Attempting to bind a delegate with a const object pointer and non-const member function.");
606
608 }
609 template <typename UserClass, typename... VarTypes>
610 inline void BindUObject(TObjectPtr<UserClass> InUserObject, typename TMemFunPtrType<true, UserClass, RetValType (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
611 {
613 }
614
615public:
616 /**
617 * Execute the delegate.
618 *
619 * If the function pointer is not valid, an error will occur. Check IsBound() before
620 * calling this method or use ExecuteIfBound() instead.
621 *
622 * @see ExecuteIfBound
623 */
624 FORCEINLINE RetValType Execute(ParamTypes... Params) const
625 {
627
628 // If this assert goes off, Execute() was called before a function was bound to the delegate.
629 // Consider using ExecuteIfSafe() instead.
631
633 }
634
635 /**
636 * Execute the delegate, but only if the function pointer is still valid
637 *
638 * @return Returns true if the function was executed
639 */
640 // NOTE: Currently only delegates with no return value support ExecuteIfBound()
641 template <
642 // This construct is intended to disable this function when RetValType != void.
643 // DummyRetValType exists to create a substitution which can fail, to achieve SFINAE.
644 typename DummyRetValType = RetValType,
645 std::enable_if_t<std::is_void<DummyRetValType>::value>* = nullptr
646 >
647 inline bool ExecuteIfBound(ParamTypes... Params) const
648 {
650 {
651 return Ptr->ExecuteIfSafe(Params...);
652 }
653
654 return false;
655 }
656
657protected:
658 /**
659 * Returns a pointer to the correctly-typed delegate instance.
660 */
661 FORCEINLINE DelegateInstanceInterfaceType* GetDelegateInstanceProtected() const
662 {
664 }
665};
666
667/**
668 * Multicast delegate template base class, used for both normal and event multicast delegates.
669 *
670 * This class implements the functionality of multicast delegates. It is templated to the function signature
671 * that it is compatible with. Use the various DECLARE_MULTICAST_DELEGATE and DECLARE_EVENT macros to create
672 * actual delegate types.
673 *
674 * Multicast delegates offer no guarantees for the calling order of bound functions. As bindings get added
675 * and removed over time, the calling order may change. Only bindings without return values are supported.
676 */
677template <typename DelegateSignature, typename UserPolicy = FDefaultDelegateUserPolicy>
679{
680 static_assert(sizeof(DelegateSignature) == 0, "Expected a function signature for the delegate template parameter");
681};
682
683template <typename RetValType, typename... ParamTypes, typename UserPolicy>
684class TMulticastDelegate<RetValType(ParamTypes...), UserPolicy>
685{
686 static_assert(sizeof(RetValType) == 0, "The return type of a multicast delegate must be void");
687};
688
689template <typename... ParamTypes, typename UserPolicy>
690class TMulticastDelegate<void(ParamTypes...), UserPolicy> : public UserPolicy::FMulticastDelegateExtras
691{
692 using Super = typename UserPolicy::FMulticastDelegateExtras;
693 using InvocationListType = typename Super::InvocationListType;
694 using DelegateInstanceInterfaceType = IBaseDelegateInstance<void (ParamTypes...), UserPolicy>;
695
696public:
697 /** Type definition for unicast delegate classes whose delegate instances are compatible with this delegate. */
698 using FDelegate = TDelegate<void(ParamTypes...), UserPolicy>;
699
700public:
701 // Make sure TMulticastDelegateBase's public functions are publicly exposed through the TMulticastDelegate API
702 using Super::Clear;
703 using Super::IsBound;
704 using Super::IsBoundToObject;
705 using Super::RemoveAll;
706 using Super::GetAllocatedSize;
707
708private:
709 // Make sure TMulticastDelegateBase's protected functions are not accidentally exposed through the TMulticastDelegate API
710 using Super::AddDelegateInstance;
711 using Super::RemoveDelegateInstance;
712 using Super::GetDelegateInstanceProtectedHelper;
713
714public:
715 /**
716 * Adds a delegate instance to this multicast delegate's invocation list.
717 *
718 * @param Delegate The delegate to add.
719 */
720 FDelegateHandle Add(FDelegate&& InNewDelegate)
721 {
723 }
724
725 /**
726 * Adds a delegate instance to this multicast delegate's invocation list.
727 *
728 * @param Delegate The delegate to add.
729 */
730 FDelegateHandle Add(const FDelegate& InNewDelegate)
731 {
733 }
734
735 /**
736 * Adds a raw C++ pointer global function delegate
737 *
738 * @param InFunc Function pointer
739 */
740 template <typename... VarTypes>
741 inline FDelegateHandle AddStatic(typename TBaseStaticDelegateInstance<void (ParamTypes...), UserPolicy, std::decay_t<VarTypes>...>::FFuncPtr InFunc, VarTypes&&... Vars)
742 {
744 }
745
746 /**
747 * Adds a C++ lambda delegate
748 * technically this works for any functor types, but lambdas are the primary use case
749 *
750 * @param InFunctor Functor (e.g. Lambda)
751 */
752 template<typename FunctorType, typename... VarTypes>
753 inline FDelegateHandle AddLambda(FunctorType&& InFunctor, VarTypes&&... Vars)
754 {
756 }
757
758 /**
759 * Adds a weak object C++ lambda delegate
760 * technically this works for any functor types, but lambdas are the primary use case
761 *
762 * @param InUserObject User object to bind to
763 * @param InFunctor Functor (e.g. Lambda)
764 */
765 template<typename UserClass, typename FunctorType, typename... VarTypes>
766 inline FDelegateHandle AddWeakLambda(UserClass* InUserObject, FunctorType&& InFunctor, VarTypes&&... Vars)
767 {
769 }
770
771 /**
772 * Adds a raw C++ pointer delegate.
773 *
774 * Raw pointer doesn't use any sort of reference, so may be unsafe to call if the object was
775 * deleted out from underneath your delegate. Be careful when calling Execute()!
776 *
777 * @param InUserObject User object to bind to
778 * @param InFunc Class method function address
779 */
780 template <typename UserClass, typename... VarTypes>
781 inline FDelegateHandle AddRaw(UserClass* InUserObject, typename TMemFunPtrType<false, UserClass, void (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
782 {
783 static_assert(!TIsConst<UserClass>::Value, "Attempting to bind a delegate with a const object pointer and non-const member function.");
784
786 }
787 template <typename UserClass, typename... VarTypes>
788 inline FDelegateHandle AddRaw(const UserClass* InUserObject, typename TMemFunPtrType<true, UserClass, void (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
789 {
791 }
792
793 /**
794 * Adds a shared pointer-based member function delegate.
795 *
796 * Shared pointer delegates keep a weak reference to your object.
797 *
798 * @param InUserObjectRef User object to bind to
799 * @param InFunc Class method function address
800 */
801 template <typename UserClass, ESPMode Mode, typename... VarTypes>
802 inline FDelegateHandle AddSP(const TSharedRef<UserClass, Mode>& InUserObjectRef, typename TMemFunPtrType<false, UserClass, void (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
803 {
804 static_assert(!TIsConst<UserClass>::Value, "Attempting to bind a delegate with a const object pointer and non-const member function.");
805
807 }
808 template <typename UserClass, ESPMode Mode, typename... VarTypes>
809 inline FDelegateHandle AddSP(const TSharedRef<UserClass, Mode>& InUserObjectRef, typename TMemFunPtrType<true, UserClass, void (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
810 {
812 }
813
814 /**
815 * Adds a shared pointer-based member function delegate.
816 *
817 * Shared pointer delegates keep a weak reference to your object.
818 *
819 * @param InUserObject User object to bind to
820 * @param InFunc Class method function address
821 */
822 template <typename UserClass, typename... VarTypes>
823 inline FDelegateHandle AddSP(UserClass* InUserObject, typename TMemFunPtrType<false, UserClass, void (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
824 {
825 static_assert(!TIsConst<UserClass>::Value, "Attempting to bind a delegate with a const object pointer and non-const member function.");
826
828 }
829 template <typename UserClass, typename... VarTypes>
830 inline FDelegateHandle AddSP(const UserClass* InUserObject, typename TMemFunPtrType<true, UserClass, void (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
831 {
833 }
834
835 /**
836 * Adds a shared pointer-based (thread-safe) member function delegate. Shared pointer delegates keep a weak reference to your object.
837 *
838 * @param InUserObjectRef User object to bind to
839 * @param InFunc Class method function address
840 *
841 * Note: This function is redundant, but is retained for backwards compatibility. AddSP() works in both thread-safe and not-thread-safe modes and should be preferred.
842 */
843 template <typename UserClass, typename... VarTypes>
844 inline FDelegateHandle AddThreadSafeSP(const TSharedRef<UserClass, ESPMode::ThreadSafe>& InUserObjectRef, typename TMemFunPtrType<false, UserClass, void (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
845 {
846 static_assert(!TIsConst<UserClass>::Value, "Attempting to bind a delegate with a const object pointer and non-const member function.");
847
849 }
850 template <typename UserClass, typename... VarTypes>
851 inline FDelegateHandle AddThreadSafeSP(const TSharedRef<UserClass, ESPMode::ThreadSafe>& InUserObjectRef, typename TMemFunPtrType<true, UserClass, void (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
852 {
854 }
855
856 /**
857 * Adds a shared pointer-based (thread-safe) member function delegate.
858 *
859 * Shared pointer delegates keep a weak reference to your object.
860 *
861 * @param InUserObject User object to bind to
862 * @param InFunc Class method function address
863 *
864 * Note: This function is redundant, but is retained for backwards compatibility. AddSP() works in both thread-safe and not-thread-safe modes and should be preferred.
865 */
866 template <typename UserClass, typename... VarTypes>
867 inline FDelegateHandle AddThreadSafeSP(UserClass* InUserObject, typename TMemFunPtrType<false, UserClass, void (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
868 {
869 static_assert(!TIsConst<UserClass>::Value, "Attempting to bind a delegate with a const object pointer and non-const member function.");
870
872 }
873 template <typename UserClass, typename... VarTypes>
874 inline FDelegateHandle AddThreadSafeSP(const UserClass* InUserObject, typename TMemFunPtrType<true, UserClass, void (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
875 {
877 }
878
879 /**
880 * Adds a UFunction-based member function delegate.
881 *
882 * UFunction delegates keep a weak reference to your object.
883 *
884 * @param InUserObject User object to bind to
885 * @param InFunctionName Class method function address
886 */
887 template <typename UObjectTemplate, typename... VarTypes>
888 inline FDelegateHandle AddUFunction(UObjectTemplate* InUserObject, const FName& InFunctionName, VarTypes&&... Vars)
889 {
891 }
892 template <typename UObjectTemplate, typename... VarTypes>
893 inline FDelegateHandle AddUFunction(TObjectPtr<UObjectTemplate> InUserObject, const FName& InFunctionName, VarTypes&&... Vars)
894 {
896 }
897
898 /**
899 * Adds a UObject-based member function delegate.
900 *
901 * UObject delegates keep a weak reference to your object.
902 *
903 * @param InUserObject User object to bind to
904 * @param InFunc Class method function address
905 */
906 template <typename UserClass, typename... VarTypes>
907 inline FDelegateHandle AddUObject(UserClass* InUserObject, typename TMemFunPtrType<false, UserClass, void (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
908 {
909 static_assert(!TIsConst<UserClass>::Value, "Attempting to bind a delegate with a const object pointer and non-const member function.");
910
912 }
913 template <typename UserClass, typename... VarTypes>
914 inline FDelegateHandle AddUObject(const UserClass* InUserObject, typename TMemFunPtrType<true, UserClass, void (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
915 {
917 }
918 template <typename UserClass, typename... VarTypes>
919 inline FDelegateHandle AddUObject(TObjectPtr<UserClass> InUserObject, typename TMemFunPtrType<false, UserClass, void (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
920 {
921 static_assert(!TIsConst<UserClass>::Value, "Attempting to bind a delegate with a const object pointer and non-const member function.");
922
924 }
925 template <typename UserClass, typename... VarTypes>
926 inline FDelegateHandle AddUObject(TObjectPtr<UserClass> InUserObject, typename TMemFunPtrType<true, UserClass, void (ParamTypes..., std::decay_t<VarTypes>...)>::Type InFunc, VarTypes&&... Vars)
927 {
929 }
930
931public:
932
933 /**
934 * Removes a delegate instance from this multi-cast delegate's invocation list (performance is O(N)).
935 *
936 * Note that the order of the delegate instances may not be preserved!
937 *
938 * @param Handle The handle of the delegate instance to remove.
939 * @return true if the delegate was successfully removed.
940 */
941 bool Remove( FDelegateHandle Handle )
942 {
943 bool bResult = false;
944 if (Handle.IsValid())
945 {
947 }
948 return bResult;
949 }
950
951 /**
952 * Hidden default constructor.
953 */
954 inline TMulticastDelegate( ) { }
955
956 /**
957 * Hidden copy constructor (for proper deep copies).
958 *
959 * @param Other The multicast delegate to copy from.
960 */
962 {
963 *this = Other;
964 }
965
966 /**
967 * Hidden assignment operator (for proper deep copies).
968 *
969 * @param Other The delegate to assign from.
970 * @return This instance.
971 */
973 {
974 if (&Other != this)
975 {
977 }
978 return *this;
979 }
980
981 /**
982 * Broadcasts this delegate to all bound objects, except to those that may have expired.
983 *
984 * The constness of this method is a lie, but it allows for broadcasting from const functions.
985 */
986 void Broadcast(ParamTypes... Params) const
987 {
989 }
990};
991
992template <typename DelegateSignature>
993using TTSMulticastDelegate = TMulticastDelegate<DelegateSignature, FDefaultTSDelegateUserPolicy>;
994
995
996/**
997 * Dynamic delegate template class (UObject-based, serializable). You'll use the various DECLARE_DYNAMIC_DELEGATE
998 * macros to create the actual delegate type, templated to the function signature the delegate is compatible with.
999 * Then, you can create an instance of that class when you want to assign functions to the delegate.
1000 */
1001template <typename TWeakPtr, typename RetValType, typename... ParamTypes>
1003{
1004public:
1005 /**
1006 * Default constructor
1007 */
1009
1010 /**
1011 * Construction from an FScriptDelegate must be explicit. This is really only used by UObject system internals.
1012 *
1013 * @param InScriptDelegate The delegate to construct from by copying
1014 */
1015 explicit TBaseDynamicDelegate( const TScriptDelegate<TWeakPtr>& InScriptDelegate )
1017 { }
1018
1019 /**
1020 * Templated helper class to define a typedef for user's method pointer, then used below
1021 */
1022 template< class UserClass >
1024 {
1025 public:
1026 typedef RetValType (UserClass::*FMethodPtr)(ParamTypes... Params);
1027 };
1028
1029 /**
1030 * Binds a UObject instance and a UObject method address to this delegate.
1031 *
1032 * @param InUserObject UObject instance
1033 * @param InMethodPtr Member function address pointer
1034 * @param InFunctionName Name of member function, without class name
1035 *
1036 * NOTE: Do not call this function directly. Instead, call BindDynamic() which is a macro proxy function that
1037 * automatically sets the function name string for the caller.
1038 */
1039 template< class UserClass >
1040 void __Internal_BindDynamic( UserClass* InUserObject, typename TMethodPtrResolver< UserClass >::FMethodPtr InMethodPtr, FName InFunctionName )
1041 {
1042 check( InUserObject != nullptr && InMethodPtr != nullptr );
1043
1044 // NOTE: We're not actually storing the incoming method pointer or calling it. We simply require it for type-safety reasons.
1045
1046 // NOTE: If you hit a compile error on the following line, it means you're trying to use a non-UObject type
1047 // with this delegate, which is not supported
1048 this->Object = Cast<UObject>(InUserObject);
1049
1050 // Store the function name. The incoming function name was generated by a macro and includes the method's class name.
1052
1053 ensureMsgf(this->IsBound(), TEXT("Unable to bind delegate to '%s' (function might not be marked as a UFUNCTION or object may be pending kill)"), *InFunctionName.ToString());
1054 }
1055 template< class UserClass >
1056 void __Internal_BindDynamic( TObjectPtr<UserClass> InUserObject, typename TMethodPtrResolver< UserClass >::FMethodPtr InMethodPtr, FName InFunctionName )
1057 {
1059 }
1060
1061 friend uint32 GetTypeHash(const TBaseDynamicDelegate& Key)
1062 {
1063 return FCrc::MemCrc_DEPRECATED(&Key,sizeof(Key));
1064 }
1065
1066 // NOTE: Execute() method must be defined in derived classes
1067
1068 // NOTE: ExecuteIfBound() method must be defined in derived classes
1069};
1070
1071
1072/**
1073 * Dynamic multi-cast delegate template class (UObject-based, serializable). You'll use the various
1074 * DECLARE_DYNAMIC_MULTICAST_DELEGATE macros to create the actual delegate type, templated to the function
1075 * signature the delegate is compatible with. Then, you can create an instance of that class when you
1076 * want to assign functions to the delegate.
1077 */
1078template <typename TWeakPtr, typename RetValType, typename... ParamTypes>
1080{
1081public:
1082 /** The actual single-cast delegate class for this multi-cast delegate */
1083 typedef TBaseDynamicDelegate<FWeakObjectPtr, RetValType, ParamTypes...> FDelegate;
1084
1085 /**
1086 * Default constructor
1087 */
1089
1090 /**
1091 * Construction from an FMulticastScriptDelegate must be explicit. This is really only used by UObject system internals.
1092 *
1093 * @param InScriptDelegate The delegate to construct from by copying
1094 */
1095 explicit TBaseDynamicMulticastDelegate( const TMulticastScriptDelegate<TWeakPtr>& InMulticastScriptDelegate )
1097 { }
1098
1099 /**
1100 * Tests if a UObject instance and a UObject method address pair are already bound to this multi-cast delegate.
1101 *
1102 * @param InUserObject UObject instance
1103 * @param InMethodPtr Member function address pointer
1104 * @param InFunctionName Name of member function, without class name
1105 * @return True if the instance/method is already bound.
1106 *
1107 * NOTE: Do not call this function directly. Instead, call IsAlreadyBound() which is a macro proxy function that
1108 * automatically sets the function name string for the caller.
1109 */
1110 template< class UserClass >
1111 bool __Internal_IsAlreadyBound( UserClass* InUserObject, typename FDelegate::template TMethodPtrResolver< UserClass >::FMethodPtr InMethodPtr, FName InFunctionName ) const
1112 {
1113 check( InUserObject != nullptr && InMethodPtr != nullptr );
1114
1115 // NOTE: We're not actually using the incoming method pointer or calling it. We simply require it for type-safety reasons.
1116
1117 return this->Contains( InUserObject, InFunctionName );
1118 }
1119 template< class UserClass >
1120 bool __Internal_IsAlreadyBound( TObjectPtr<UserClass> InUserObject, typename FDelegate::template TMethodPtrResolver< UserClass >::FMethodPtr InMethodPtr, FName InFunctionName ) const
1121 {
1123 }
1124
1125 /**
1126 * Binds a UObject instance and a UObject method address to this multi-cast delegate.
1127 *
1128 * @param InUserObject UObject instance
1129 * @param InMethodPtr Member function address pointer
1130 * @param InFunctionName Name of member function, without class name
1131 *
1132 * NOTE: Do not call this function directly. Instead, call AddDynamic() which is a macro proxy function that
1133 * automatically sets the function name string for the caller.
1134 */
1135 template< class UserClass >
1136 void __Internal_AddDynamic( UserClass* InUserObject, typename FDelegate::template TMethodPtrResolver< UserClass >::FMethodPtr InMethodPtr, FName InFunctionName )
1137 {
1138 check( InUserObject != nullptr && InMethodPtr != nullptr );
1139
1140 // NOTE: We're not actually storing the incoming method pointer or calling it. We simply require it for type-safety reasons.
1141
1144
1145 this->Add( NewDelegate );
1146 }
1147 template< class UserClass >
1148 void __Internal_AddDynamic( TObjectPtr<UserClass> InUserObject, typename FDelegate::template TMethodPtrResolver< UserClass >::FMethodPtr InMethodPtr, FName InFunctionName )
1149 {
1151 }
1152
1153 /**
1154 * Binds a UObject instance and a UObject method address to this multi-cast delegate, but only if it hasn't been bound before.
1155 *
1156 * @param InUserObject UObject instance
1157 * @param InMethodPtr Member function address pointer
1158 * @param InFunctionName Name of member function, without class name
1159 *
1160 * NOTE: Do not call this function directly. Instead, call AddUniqueDynamic() which is a macro proxy function that
1161 * automatically sets the function name string for the caller.
1162 */
1163 template< class UserClass >
1164 void __Internal_AddUniqueDynamic( UserClass* InUserObject, typename FDelegate::template TMethodPtrResolver< UserClass >::FMethodPtr InMethodPtr, FName InFunctionName )
1165 {
1166 check( InUserObject != nullptr && InMethodPtr != nullptr );
1167
1168 // NOTE: We're not actually storing the incoming method pointer or calling it. We simply require it for type-safety reasons.
1169
1172
1173 this->AddUnique( NewDelegate );
1174 }
1175 template< class UserClass >
1176 void __Internal_AddUniqueDynamic( TObjectPtr<UserClass> InUserObject, typename FDelegate::template TMethodPtrResolver< UserClass >::FMethodPtr InMethodPtr, FName InFunctionName )
1177 {
1179 }
1180
1181 /**
1182 * Unbinds a UObject instance and a UObject method address from this multi-cast delegate.
1183 *
1184 * @param InUserObject UObject instance
1185 * @param InMethodPtr Member function address pointer
1186 * @param InFunctionName Name of member function, without class name
1187 *
1188 * NOTE: Do not call this function directly. Instead, call RemoveDynamic() which is a macro proxy function that
1189 * automatically sets the function name string for the caller.
1190 */
1191 template< class UserClass >
1192 void __Internal_RemoveDynamic( UserClass* InUserObject, typename FDelegate::template TMethodPtrResolver< UserClass >::FMethodPtr InMethodPtr, FName InFunctionName )
1193 {
1194 check( InUserObject != nullptr && InMethodPtr != nullptr );
1195
1196 // NOTE: We're not actually storing the incoming method pointer or calling it. We simply require it for type-safety reasons.
1197
1199 }
1200 template< class UserClass >
1201 void __Internal_RemoveDynamic( TObjectPtr<UserClass> InUserObject, typename FDelegate::template TMethodPtrResolver< UserClass >::FMethodPtr InMethodPtr, FName InFunctionName )
1202 {
1204 }
1205
1206 // NOTE: Broadcast() method must be defined in derived classes
1207};
#define checkSlow(expr)
#define check(expr)
#define ensureMsgf( InExpression, InFormat,...)
#define UE_DEPRECATED(Version, Message)
T * ToRawPtr(const TObjectPtr< T > &Ptr)
Definition ObjectPtr.h:828
To * Cast(From *Src)
#define FORCEINLINE
Definition Platform.h:644
#define UE_NODISCARD
Definition Platform.h:660
void __Internal_BindDynamic(UserClass *InUserObject, typename TMethodPtrResolver< UserClass >::FMethodPtr InMethodPtr, FName InFunctionName)
friend uint32 GetTypeHash(const TBaseDynamicDelegate &Key)
void __Internal_BindDynamic(TObjectPtr< UserClass > InUserObject, typename TMethodPtrResolver< UserClass >::FMethodPtr InMethodPtr, FName InFunctionName)
TBaseDynamicDelegate(const TScriptDelegate< TWeakPtr > &InScriptDelegate)
bool __Internal_IsAlreadyBound(UserClass *InUserObject, typename FDelegate::template TMethodPtrResolver< UserClass >::FMethodPtr InMethodPtr, FName InFunctionName) const
TBaseDynamicMulticastDelegate(const TMulticastScriptDelegate< TWeakPtr > &InMulticastScriptDelegate)
void __Internal_AddUniqueDynamic(TObjectPtr< UserClass > InUserObject, typename FDelegate::template TMethodPtrResolver< UserClass >::FMethodPtr InMethodPtr, FName InFunctionName)
void __Internal_AddUniqueDynamic(UserClass *InUserObject, typename FDelegate::template TMethodPtrResolver< UserClass >::FMethodPtr InMethodPtr, FName InFunctionName)
void __Internal_RemoveDynamic(UserClass *InUserObject, typename FDelegate::template TMethodPtrResolver< UserClass >::FMethodPtr InMethodPtr, FName InFunctionName)
void __Internal_RemoveDynamic(TObjectPtr< UserClass > InUserObject, typename FDelegate::template TMethodPtrResolver< UserClass >::FMethodPtr InMethodPtr, FName InFunctionName)
void __Internal_AddDynamic(TObjectPtr< UserClass > InUserObject, typename FDelegate::template TMethodPtrResolver< UserClass >::FMethodPtr InMethodPtr, FName InFunctionName)
bool __Internal_IsAlreadyBound(TObjectPtr< UserClass > InUserObject, typename FDelegate::template TMethodPtrResolver< UserClass >::FMethodPtr InMethodPtr, FName InFunctionName) const
void __Internal_AddDynamic(UserClass *InUserObject, typename FDelegate::template TMethodPtrResolver< UserClass >::FMethodPtr InMethodPtr, FName InFunctionName)
TBaseDynamicDelegate< FWeakObjectPtr, RetValType, ParamTypes... > FDelegate
void BindThreadSafeSP(UserClass *InUserObject, typename TMemFunPtrType< false, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
void BindUObject(UserClass *InUserObject, typename TMemFunPtrType< false, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
static UE_NODISCARD TDelegate< RetValType(ParamTypes...), UserPolicy > CreateThreadSafeSP(const TSharedRef< UserClass, ESPMode::ThreadSafe > &InUserObjectRef, typename TMemFunPtrType< false, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
void BindLambda(FunctorType &&InFunctor, VarTypes &&... Vars)
static UE_NODISCARD TDelegate< RetValType(ParamTypes...), UserPolicy > CreateUObject(TObjectPtr< UserClass > InUserObject, typename TMemFunPtrType< false, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
void BindUFunction(TObjectPtr< UObjectTemplate > InUserObject, const FName &InFunctionName, VarTypes &&... Vars)
FORCEINLINE RetValType Execute(ParamTypes... Params) const
static UE_NODISCARD TDelegate< RetValType(ParamTypes...), UserPolicy > CreateStatic(typename TIdentity< RetValType(*)(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
static UE_NODISCARD TDelegate< RetValType(ParamTypes...), UserPolicy > CreateSP(UserClass *InUserObject, typename TMemFunPtrType< false, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
static UE_NODISCARD TDelegate< RetValType(ParamTypes...), UserPolicy > CreateSP(const TSharedRef< UserClass, Mode > &InUserObjectRef, typename TMemFunPtrType< false, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
void BindThreadSafeSP(const UserClass *InUserObject, typename TMemFunPtrType< true, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
static UE_NODISCARD TDelegate< RetValType(ParamTypes...), UserPolicy > CreateUObject(UserClass *InUserObject, typename TMemFunPtrType< false, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
static UE_NODISCARD TDelegate< RetValType(ParamTypes...), UserPolicy > CreateLambda(FunctorType &&InFunctor, VarTypes &&... Vars)
static UE_NODISCARD TDelegate< RetValType(ParamTypes...), UserPolicy > CreateRaw(const UserClass *InUserObject, typename TMemFunPtrType< true, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
void BindSP(UserClass *InUserObject, typename TMemFunPtrType< false, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
void BindUFunction(UObjectTemplate *InUserObject, const FName &InFunctionName, VarTypes &&... Vars)
void BindThreadSafeSP(const TSharedRef< UserClass, ESPMode::ThreadSafe > &InUserObjectRef, typename TMemFunPtrType< false, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
static UE_NODISCARD TDelegate< RetValType(ParamTypes...), UserPolicy > CreateRaw(UserClass *InUserObject, typename TMemFunPtrType< false, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
static UE_NODISCARD TDelegate< RetValType(ParamTypes...), UserPolicy > CreateUFunction(TObjectPtr< UObjectTemplate > InUserObject, const FName &InFunctionName, VarTypes &&... Vars)
static UE_NODISCARD TDelegate< RetValType(ParamTypes...), UserPolicy > CreateThreadSafeSP(UserClass *InUserObject, typename TMemFunPtrType< false, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
void BindSP(const TSharedRef< UserClass, Mode > &InUserObjectRef, typename TMemFunPtrType< false, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
void BindSP(const UserClass *InUserObject, typename TMemFunPtrType< true, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
void BindRaw(const UserClass *InUserObject, typename TMemFunPtrType< true, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
void BindWeakLambda(UserClass *InUserObject, FunctorType &&InFunctor, VarTypes &&... Vars)
static UE_NODISCARD TDelegate< RetValType(ParamTypes...), UserPolicy > CreateUObject(const UserClass *InUserObject, typename TMemFunPtrType< true, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
FORCEINLINE DelegateInstanceInterfaceType * GetDelegateInstanceProtected() const
void BindStatic(typename TBaseStaticDelegateInstance< FuncType, UserPolicy, std::decay_t< VarTypes >... >::FFuncPtr InFunc, VarTypes &&... Vars)
void BindUObject(TObjectPtr< UserClass > InUserObject, typename TMemFunPtrType< false, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
static UE_NODISCARD TDelegate< RetValType(ParamTypes...), UserPolicy > CreateUFunction(UObjectTemplate *InUserObject, const FName &InFunctionName, VarTypes &&... Vars)
void BindUObject(const UserClass *InUserObject, typename TMemFunPtrType< true, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
static UE_NODISCARD TDelegate< RetValType(ParamTypes...), UserPolicy > CreateSP(const UserClass *InUserObject, typename TMemFunPtrType< true, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
TDelegate & operator=(TDelegate &&Other)=default
void BindRaw(UserClass *InUserObject, typename TMemFunPtrType< false, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
static UE_NODISCARD TDelegate< RetValType(ParamTypes...), UserPolicy > CreateThreadSafeSP(const UserClass *InUserObject, typename TMemFunPtrType< true, UserClass, RetValType(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
static UE_NODISCARD TDelegate< RetValType(ParamTypes...), UserPolicy > CreateWeakLambda(UserClass *InUserObject, FunctorType &&InFunctor, VarTypes &&... Vars)
FDelegateHandle Add(const FDelegate &InNewDelegate)
FDelegateHandle AddUObject(UserClass *InUserObject, typename TMemFunPtrType< false, UserClass, void(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
FDelegateHandle AddThreadSafeSP(UserClass *InUserObject, typename TMemFunPtrType< false, UserClass, void(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
FDelegateHandle AddThreadSafeSP(const UserClass *InUserObject, typename TMemFunPtrType< true, UserClass, void(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
FDelegateHandle AddUObject(const UserClass *InUserObject, typename TMemFunPtrType< true, UserClass, void(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
FDelegateHandle AddSP(UserClass *InUserObject, typename TMemFunPtrType< false, UserClass, void(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
FDelegateHandle AddThreadSafeSP(const TSharedRef< UserClass, ESPMode::ThreadSafe > &InUserObjectRef, typename TMemFunPtrType< false, UserClass, void(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
FDelegateHandle AddSP(const UserClass *InUserObject, typename TMemFunPtrType< true, UserClass, void(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
FDelegateHandle AddRaw(const UserClass *InUserObject, typename TMemFunPtrType< true, UserClass, void(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
FDelegateHandle AddWeakLambda(UserClass *InUserObject, FunctorType &&InFunctor, VarTypes &&... Vars)
FDelegateHandle AddStatic(typename TBaseStaticDelegateInstance< void(ParamTypes...), UserPolicy, std::decay_t< VarTypes >... >::FFuncPtr InFunc, VarTypes &&... Vars)
FDelegateHandle AddUFunction(UObjectTemplate *InUserObject, const FName &InFunctionName, VarTypes &&... Vars)
FDelegateHandle AddRaw(UserClass *InUserObject, typename TMemFunPtrType< false, UserClass, void(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
FDelegateHandle AddUFunction(TObjectPtr< UObjectTemplate > InUserObject, const FName &InFunctionName, VarTypes &&... Vars)
FDelegateHandle AddLambda(FunctorType &&InFunctor, VarTypes &&... Vars)
FDelegateHandle AddUObject(TObjectPtr< UserClass > InUserObject, typename TMemFunPtrType< false, UserClass, void(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
FDelegateHandle AddSP(const TSharedRef< UserClass, Mode > &InUserObjectRef, typename TMemFunPtrType< false, UserClass, void(ParamTypes..., std::decay_t< VarTypes >...)>::Type InFunc, VarTypes &&... Vars)
TMulticastDelegate & operator=(const TMulticastDelegate &Other)
Definition json.hpp:4518