TWeakObjectPtr

[TWeakObjectPtr](API\Runtime\Core\UObject\TWeakObjectPtr) is the templated version of the generic [FWeakObjectPtr](API\Runtime\CoreUObject\UObject\FWeakObjectPtr)

Windows
MacOS
Linux

Inheritance Hierarchy

TWeakObjectPtrBase

TWeakObjectPtr

TAutoWeakObjectPtr

References

Module

Core

Header

/Engine/Source/Runtime/Core/Public/UObject/WeakObjectPtrTemplates.h

Include

#include "UObject/WeakObjectPtrTemplates.h"

Syntax

template<class T, class TWeakObjectPtrBase>
struct TWeakObjectPtr : private TWeakObjectPtrBase

Remarks

TWeakObjectPtr is the templated version of the generic FWeakObjectPtr

Constructors

Name Description

Public function

TWeakObjectPtr()

Although templated, these parameters are not intended to be anything other than the default, and are only templates for module organization reasons.

Public function

TWeakObjectPtr

(
    const TWeakObjectPtr&
)

Public function

TWeakObjectPtr

(
    TYPE_OF_NULLPTR
)

Construct from a null pointer

Public function

TWeakObjectPtr

(
    U* Object
)

Construct from an object pointer

Public function

TWeakObjectPtr

(
    const TWeakObjectPtr< OtherT, TWeak...
)

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

Destructors

Name Description

Public function

~TWeakObjectPtr()

Functions

Name Description

Public function Const

T *

 

Get()

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

Public function Const

T *

 

Get

(
    bool bEvenIfPendingKill
)

Dereference the weak pointer

Public function Const

T *

 

GetEvenIfUnreachable()

Deferences the weak pointer even if its marked RF_Unreachable.

Public function Const

bool

 

HasSameIndexAndSerialNumber

(
    const TWeakObjectPtr& Other
)

Returns true if two weak pointers were originally set to the same object, even if they are now stale

Public function Const

bool

 

IsExplicitlyNull()

Returns true if this pointer was explicitly assigned to null, was reset, or was never initialized.

Public function Const

bool

 

IsStale

(
    bool bIncludingIfPendingKill,
    bool bThreadsafeTest
)

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

Public function Const

bool

 

IsValid()

Test if this points to a live UObject.

Public function Const

bool

 

IsValid

(
    bool bEvenIfPendingKill,
    bool bThreadsafeTest
)

Test if this points to a live UObject

Public function

void

 

Reset()

Reset the weak pointer back to the null state

Operators

Name Description

Public function Const

T &

 

operator*()

Dereference the weak pointer

Public function

TWeakObjectP...

 

operator=

(
    const TWeakObjectPtr&
)

Public function

TEnableIf<&#...

 

operator=

(
    U* Object
)

Copy from an object pointer

Public function

TWeakObjectP...

 

operator=

(
    const TWeakObjectPtr< OtherT, TWeak...
)

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

Public function Const

T *

 

operator->()

Dereference the weak pointer

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss