8#include "Containers/Map.h"
23template<
class T,
class TWeakObjectPtrBase>
28 template <
class,
class>
35 static_assert(std::is_same_v<TWeakObjectPtrBase*, FWeakObjectPtr*>,
"TWeakObjectPtrBase should not be overridden");
66 static_assert(std::is_convertible_v<T*, const volatile UObject*>,
"TWeakObjectPtr can only be constructed with UObject types");
78 WeakPtr(
Other.WeakPtr)
82#if UE_WITH_REMOTE_OBJECT_HANDLE
122 WeakPtr =
Other.WeakPtr;
142 return (T*)WeakPtr.Get();
163 StrongPtr.Attach((T*)WeakPtr.Pin().Detach());
191 return (T*)WeakPtr.GetEvenIfUnreachable();
211 explicit operator bool()
const =
delete;
246 return WeakPtr.IsValid();
266 return WeakPtr.IsExplicitlyNull();
275 return WeakPtr.HasSameIndexAndSerialNumber(
Other.WeakPtr);
288 return WeakPtr.HasSameIndexAndSerialNumber(
Other.WeakPtr);
291#if UE_WITH_REMOTE_OBJECT_HANDLE
294 return WeakPtr.HasSameObject(
Other);
299 return WeakPtr.GetRemoteId();
305 return WeakPtr.IsRemote();
319 return WeakPtr.GetTypeHash();
327 template <
typename RhsT,
typename = decltype((T*)
nullptr == (RhsT*)
nullptr)>
330 return WeakPtr == Rhs.WeakPtr;
333 template <
typename RhsT,
typename = decltype((T*)
nullptr == (RhsT*)
nullptr)>
345#if !PLATFORM_COMPILER_HAS_GENERATED_COMPARISON_OPERATORS
350 template <
typename RhsT,
typename = decltype((T*)
nullptr != (RhsT*)
nullptr)>
353 return !(*
this == Rhs);
356 template <
typename RhsT,
typename = decltype((T*)
nullptr != (RhsT*)
nullptr)>
359 return !(*
this == Rhs);
364 return !(*
this ==
nullptr);
371 return WeakPtr.Internal_GetObjectItem();
394template <
typename ElementType,
bool bInAllowDuplicateKeys = false>
401 return A.HasSameIndexAndSerialNumber(
B);
413template <
typename KeyType,
typename ValueType,
bool bInAllowDuplicateKeys = false>
420 return A.HasSameIndexAndSerialNumber(
B);
436template<
typename DestArrayType,
typename SourceArrayType>
451template<
typename DestArrayType,
typename SourceArrayType>
476template<
class T,
class TWeakObjectPtrBase>
483#if UE_ENABLE_INCLUDE_ORDER_DEPRECATED_IN_5_4
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
const bool
Definition NetworkReplayStreaming.h:178
#define UE_REQUIRES(...)
Definition Requires.h:86
#define UE_REQUIRES_EXPR(...)
Definition Requires.h:89
FORCEINLINE uint32 GetTypeHash(const TWeakObjectPtr< T > &WeakObjectPtr)
Definition WeakObjectPtrTemplates.h:467
void CopyToWeakArray(DestArrayType &Dest, const SourceArrayType &Src)
Definition WeakObjectPtrTemplates.h:452
void CopyFromWeakArray(DestArrayType &Dest, const SourceArrayType &Src)
Definition WeakObjectPtrTemplates.h:437
FORCEINLINE TWeakObjectPtr< T > MakeWeakObjectPtr(T *Ptr)
Definition WeakObjectPtrTemplates.h:385
FArchive & operator<<(FArchive &Ar, TWeakObjectPtr< T, TWeakObjectPtrBase > &WeakObjectPtr)
Definition WeakObjectPtrTemplates.h:477
Definition Archive.h:1208
virtual void Serialize(void *V, int64 Length)
Definition Archive.h:1689
Definition StrongObjectPtrTemplates.h:26
U16 Index
Definition radfft.cpp:71
Definition SetUtilities.h:36
TTypeTraits< ElementType >::ConstPointerType KeyInitType
Definition SetUtilities.h:37
Definition FieldPath.h:36
Definition RemoteObjectTypes.h:212
Definition UObjectArray.h:50
Definition WeakObjectPtr.h:49
Definition UnrealTypeTraits.h:267
Definition UnrealTypeTraits.h:283
TTypeTraits< KeyType >::ConstPointerType KeyInitType
Definition Map.h:78
Definition WeakObjectPtrTemplates.h:415
static FORCEINLINE uint32 GetKeyHash(KeyInitType Key)
Definition WeakObjectPtrTemplates.h:423
TDefaultMapKeyFuncs< KeyType, ValueType, bInAllowDuplicateKeys >::KeyInitType KeyInitType
Definition WeakObjectPtrTemplates.h:416
static FORCEINLINE bool Matches(KeyInitType A, KeyInitType B)
Definition WeakObjectPtrTemplates.h:418
Definition WeakObjectPtrTemplates.h:396
static FORCEINLINE uint32 GetKeyHash(KeyInitType Key)
Definition WeakObjectPtrTemplates.h:404
static FORCEINLINE bool Matches(KeyInitType A, KeyInitType B)
Definition WeakObjectPtrTemplates.h:399
DefaultKeyFuncs< ElementType, bInAllowDuplicateKeys >::KeyInitType KeyInitType
Definition WeakObjectPtrTemplates.h:397
Definition WeakObjectPtrTemplates.h:25
FORCEINLINE TWeakObjectPtr & operator=(U *Object)
Definition WeakObjectPtrTemplates.h:105
FORCEINLINE T * operator->() const
Definition WeakObjectPtrTemplates.h:205
FORCEINLINE TStrongObjectPtr< T > TryPin(bool &bOutPinValid, bool bEvenIfPendingKill) const
Definition WeakObjectPtrTemplates.h:173
FORCENOINLINE bool UEOpEquals(const RhsT *Rhs) const
Definition WeakObjectPtrTemplates.h:334
FORCEINLINE TWeakObjectPtr(const TWeakObjectPtr< OtherT, TWeakObjectPtrBase > &Other)
Definition WeakObjectPtrTemplates.h:77
FORCEINLINE void Reset()
Definition WeakObjectPtrTemplates.h:92
FORCEINLINE bool IsExplicitlyNull() const
Definition WeakObjectPtrTemplates.h:264
FORCEINLINE TWeakObjectPtr(U Object)
Definition WeakObjectPtrTemplates.h:61
FORCEINLINE bool IsStale(bool bIncludingIfPendingKill=true, bool bThreadsafeTest=false) const
Definition WeakObjectPtrTemplates.h:255
TWeakObjectPtr & operator=(const TWeakObjectPtr &)=default
FORCEINLINE bool operator!=(const RhsT *Rhs) const
Definition WeakObjectPtrTemplates.h:357
FORCEINLINE TStrongObjectPtr< T > Pin(bool bEvenIfPendingKill) const
Definition WeakObjectPtrTemplates.h:150
FORCEINLINE uint32 GetWeakPtrTypeHash() const
Definition WeakObjectPtrTemplates.h:317
FORCEINLINE T & operator*() const
Definition WeakObjectPtrTemplates.h:197
TWeakObjectPtr(const TWeakObjectPtr &)=default
FORCEINLINE TWeakObjectPtr(TYPE_OF_NULLPTR)
Definition WeakObjectPtrTemplates.h:48
friend struct TWeakObjectPtr
Definition WeakObjectPtrTemplates.h:29
FORCEINLINE bool operator!=(const TWeakObjectPtr< RhsT, TWeakObjectPtrBase > &Rhs) const
Definition WeakObjectPtrTemplates.h:351
FORCEINLINE TWeakObjectPtr & operator=(const TWeakObjectPtr< OtherT, TWeakObjectPtrBase > &Other)
Definition WeakObjectPtrTemplates.h:120
FORCEINLINE T * GetEvenIfUnreachable() const
Definition WeakObjectPtrTemplates.h:189
T ElementType
Definition WeakObjectPtrTemplates.h:38
FORCEINLINE bool IsValid() const
Definition WeakObjectPtrTemplates.h:244
FORCEINLINE T * Get() const
Definition WeakObjectPtrTemplates.h:140
FORCEINLINE TStrongObjectPtr< T > TryPin(bool &bOutPinValid) const
Definition WeakObjectPtrTemplates.h:183
FORCEINLINE T * Get(bool bEvenIfPendingKill) const
Definition WeakObjectPtrTemplates.h:132
FORCEINLINE bool IsValid(bool bEvenIfPendingKill, bool bThreadsafeTest=false) const
Definition WeakObjectPtrTemplates.h:232
FORCEINLINE bool HasSameIndexAndSerialNumber(const TWeakObjectPtr &Other) const
Definition WeakObjectPtrTemplates.h:273
FORCENOINLINE bool UEOpEquals(const TWeakObjectPtr< RhsT, TWeakObjectPtrBase > &Rhs) const
Definition WeakObjectPtrTemplates.h:328
FORCEINLINE bool IsRemote() const
Definition WeakObjectPtrTemplates.h:303
FORCEINLINE bool HasSameIndexAndSerialNumber(const TWeakObjectPtr< OtherT, TWeakObjectPtrBase > &Other) const
Definition WeakObjectPtrTemplates.h:286
~TWeakObjectPtr()=default
FORCEINLINE TStrongObjectPtr< T > Pin() const
Definition WeakObjectPtrTemplates.h:160
FORCEINLINE void Serialize(FArchive &Ar)
Definition WeakObjectPtrTemplates.h:311
FORCEINLINE bool operator!=(TYPE_OF_NULLPTR) const
Definition WeakObjectPtrTemplates.h:362
FORCENOINLINE bool UEOpEquals(TYPE_OF_NULLPTR) const
Definition WeakObjectPtrTemplates.h:340