UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
TWeakFieldPtr< T > Struct Template Reference

#include <WeakFieldPtr.h>

Public Types

using ElementType = T
 

Public Member Functions

 TWeakFieldPtr ()=default
 
 TWeakFieldPtr (const TWeakFieldPtr &)=default
 
TWeakFieldPtroperator= (const TWeakFieldPtr &)=default
 
 ~TWeakFieldPtr ()=default
 
 TWeakFieldPtr (TYPE_OF_NULLPTR)
 
template<typename U >
 TWeakFieldPtr (U *InField, EDummy1=Dummy1)
 
template<typename OtherT >
 TWeakFieldPtr (const TWeakFieldPtr< OtherT > &Other)
 
void Reset ()
 
template<typename U >
void operator= (U *InField)
 
template<typename OtherT >
void operator= (const TWeakFieldPtr< OtherT > &Other)
 
T * Get (bool bEvenIfPendingKill) const
 
T * Get () const
 
T * GetEvenIfUnreachable () const
 
UE_FORCEINLINE_HINT T & operator* () const
 
UE_FORCEINLINE_HINT T * operator-> () const
 
UE_FORCEINLINE_HINT bool IsValid (bool bEvenIfPendingKill, bool bThreadsafeTest=false) const
 
UE_FORCEINLINE_HINT bool IsValid () const
 
UE_FORCEINLINE_HINT bool IsStale (bool bIncludingIfPendingKill=false, bool bThreadsafeTest=false) const
 
UE_FORCEINLINE_HINT bool HasSameIndexAndSerialNumber (const TWeakFieldPtr &Other) const
 
void Serialize (FArchive &Ar)
 

Friends

template<typename >
struct TWeakFieldPtr
 
template<typename LhsType , typename RhsType UE_REQUIRES_FRIEND>
bool operator== (const TWeakFieldPtr< LhsType > &Lhs, const TWeakFieldPtr< RhsType > &Rhs)
 
template<typename LhsType , typename RhsType UE_REQUIRES_FRIEND>
bool operator== (const TWeakFieldPtr< LhsType > &Lhs, const RhsType *Rhs)
 
template<typename LhsType , typename RhsType UE_REQUIRES_FRIEND>
bool operator== (const LhsType *Lhs, const TWeakFieldPtr< RhsType > &Rhs)
 
template<typename LhsType , typename RhsType UE_REQUIRES_FRIEND>
bool operator!= (const TWeakFieldPtr< LhsType > &Lhs, const TWeakFieldPtr< RhsType > &Rhs)
 
template<typename LhsType , typename RhsType UE_REQUIRES_FRIEND>
bool operator!= (const TWeakFieldPtr< LhsType > &Lhs, const RhsType *Rhs)
 
template<typename LhsType , typename RhsType UE_REQUIRES_FRIEND>
bool operator!= (const LhsType *Lhs, const TWeakFieldPtr< RhsType > &Rhs)
 
UE_FORCEINLINE_HINT friend uint32 GetTypeHash (const TWeakFieldPtr &WeakObjectPtr)
 

Member Typedef Documentation

◆ ElementType

template<class T >
using TWeakFieldPtr< T >::ElementType = T

Constructor & Destructor Documentation

◆ TWeakFieldPtr() [1/5]

template<class T >
TWeakFieldPtr< T >::TWeakFieldPtr ( )
default

◆ TWeakFieldPtr() [2/5]

template<class T >
TWeakFieldPtr< T >::TWeakFieldPtr ( const TWeakFieldPtr< T > &  )
default

◆ ~TWeakFieldPtr()

template<class T >
TWeakFieldPtr< T >::~TWeakFieldPtr ( )
default

◆ TWeakFieldPtr() [3/5]

template<class T >
TWeakFieldPtr< T >::TWeakFieldPtr ( TYPE_OF_NULLPTR  )
inline

Construct from a null pointer

◆ TWeakFieldPtr() [4/5]

template<class T >
template<typename U >
TWeakFieldPtr< T >::TWeakFieldPtr ( U *  InField,
EDummy1  = Dummy1 
)
inline

Construct from an object pointer

Parameters
Objectobject to create a weak pointer to

◆ TWeakFieldPtr() [5/5]

template<class T >
template<typename OtherT >
TWeakFieldPtr< T >::TWeakFieldPtr ( const TWeakFieldPtr< OtherT > &  Other)
inline

Construct from another weak pointer of another type, intended for derived-to-base conversions

Parameters
Otherweak pointer to copy from

Member Function Documentation

◆ Get() [1/2]

template<class T >
T * TWeakFieldPtr< T >::Get ( ) const
inline

Dereference the weak pointer. This is an optimized version implying bEvenIfPendingKill=false.

◆ Get() [2/2]

template<class T >
T * TWeakFieldPtr< T >::Get ( bool  bEvenIfPendingKill) const
inline

Dereference the weak pointer

Parameters
bEvenIfPendingKill,ifthis is true, pendingkill objects are considered valid
Returns
NULL if this object is gone or the weak pointer was NULL, otherwise a valid uobject pointer

◆ GetEvenIfUnreachable()

template<class T >
T * TWeakFieldPtr< T >::GetEvenIfUnreachable ( ) const
inline

Deferences the weak pointer even if its marked RF_Unreachable. This is needed to resolve weak pointers during GC (such as AddReferenceObjects)

◆ HasSameIndexAndSerialNumber()

template<class T >
UE_FORCEINLINE_HINT bool TWeakFieldPtr< T >::HasSameIndexAndSerialNumber ( const TWeakFieldPtr< T > &  Other) const
inline

◆ IsStale()

template<class T >
UE_FORCEINLINE_HINT bool TWeakFieldPtr< T >::IsStale ( bool  bIncludingIfPendingKill = false,
bool  bThreadsafeTest = false 
) const
inline

Slightly different than !IsValid(), returns true if this used to point to a FField, but doesn't any more and has not been assigned or reset in the mean time.

Parameters
bIncludingIfPendingKill,ifthis is true, pendingkill objects are considered stale
bThreadsafeTest,setit to true when testing outside of Game Thread. Results in false if WeakObjPtr point to an existing object (no flags checked)
Returns
true if this used to point at a real object but no longer does.

◆ IsValid() [1/2]

template<class T >
UE_FORCEINLINE_HINT bool TWeakFieldPtr< T >::IsValid ( ) const
inline

Test if this points to a live FField. This is an optimized version implying bEvenIfPendingKill=false, bThreadsafeTest=false.

Returns
true if Get() would return a valid non-null pointer

◆ IsValid() [2/2]

template<class T >
UE_FORCEINLINE_HINT bool TWeakFieldPtr< T >::IsValid ( bool  bEvenIfPendingKill,
bool  bThreadsafeTest = false 
) const
inline

Test if this points to a live FField

Parameters
bEvenIfPendingKill,ifthis is true, pendingkill objects are considered valid
bThreadsafeTest,iftrue then function will just give you information whether referenced FField is gone forever (
Returns
false) or if it is still there (
true, no object flags checked).
true if Get() would return a valid non-null pointer

◆ operator*()

template<class T >
UE_FORCEINLINE_HINT T & TWeakFieldPtr< T >::operator* ( ) const
inline

Dereference the weak pointer

◆ operator->()

template<class T >
UE_FORCEINLINE_HINT T * TWeakFieldPtr< T >::operator-> ( ) const
inline

Dereference the weak pointer

◆ operator=() [1/3]

template<class T >
TWeakFieldPtr & TWeakFieldPtr< T >::operator= ( const TWeakFieldPtr< T > &  )
default

◆ operator=() [2/3]

template<class T >
template<typename OtherT >
void TWeakFieldPtr< T >::operator= ( const TWeakFieldPtr< OtherT > &  Other)
inline

Assign from another weak pointer, intended for derived-to-base conversions

Parameters
Otherweak pointer to copy from

◆ operator=() [3/3]

template<class T >
template<typename U >
void TWeakFieldPtr< T >::operator= ( U *  InField)
inline

Copy from an object pointer

Parameters
Objectobject to create a weak pointer to

◆ Reset()

template<class T >
void TWeakFieldPtr< T >::Reset ( )
inline

Reset the weak pointer back to the NULL state

◆ Serialize()

template<class T >
void TWeakFieldPtr< T >::Serialize ( FArchive Ar)
inline

Friends And Related Symbol Documentation

◆ GetTypeHash

template<class T >
UE_FORCEINLINE_HINT friend uint32 GetTypeHash ( const TWeakFieldPtr< T > &  WeakObjectPtr)
friend

Hash function.

◆ operator!= [1/3]

template<class T >
template<typename LhsType , typename RhsType UE_REQUIRES_FRIEND>
bool operator!= ( const LhsType Lhs,
const TWeakFieldPtr< RhsType > &  Rhs 
)
friend

Compare weak pointers for inequality

Parameters
Lhspointer to compare
Rhsweak pointer to compare

◆ operator!= [2/3]

template<class T >
template<typename LhsType , typename RhsType UE_REQUIRES_FRIEND>
bool operator!= ( const TWeakFieldPtr< LhsType > &  Lhs,
const RhsType Rhs 
)
friend

Compare weak pointers for inequality

Parameters
Lhsweak pointer to compare
Rhspointer to compare

◆ operator!= [3/3]

template<class T >
template<typename LhsType , typename RhsType UE_REQUIRES_FRIEND>
bool operator!= ( const TWeakFieldPtr< LhsType > &  Lhs,
const TWeakFieldPtr< RhsType > &  Rhs 
)
friend

Compare weak pointers for inequality

Parameters
Lhsweak pointer to compare
Rhsweak pointer to compare

◆ operator== [1/3]

template<class T >
template<typename LhsType , typename RhsType UE_REQUIRES_FRIEND>
bool operator== ( const LhsType Lhs,
const TWeakFieldPtr< RhsType > &  Rhs 
)
friend

Compare weak pointers for equality

Parameters
Lhspointer to compare
Rhsweak pointer to compare

◆ operator== [2/3]

template<class T >
template<typename LhsType , typename RhsType UE_REQUIRES_FRIEND>
bool operator== ( const TWeakFieldPtr< LhsType > &  Lhs,
const RhsType Rhs 
)
friend

Compare weak pointers for equality

Parameters
Lhsweak pointer to compare
Rhspointer to compare

◆ operator== [3/3]

template<class T >
template<typename LhsType , typename RhsType UE_REQUIRES_FRIEND>
bool operator== ( const TWeakFieldPtr< LhsType > &  Lhs,
const TWeakFieldPtr< RhsType > &  Rhs 
)
friend

Compare weak pointers for equality

Parameters
Lhsweak pointer to compare
Rhsweak pointer to compare

◆ TWeakFieldPtr

template<class T >
template<typename >
friend struct TWeakFieldPtr
friend

The documentation for this struct was generated from the following file: