TWeakInterfacePtr

An alternative to [TWeakObjectPtr](API\Runtime\Core\UObject\TWeakObjectPtr) that makes it easier to work through an interface.

Windows
MacOS
Linux

References

Module

CoreUObject

Header

/Engine/Source/Runtime/CoreUObject/Public/UObject/WeakInterfacePtr.h

Include

#include "UObject/WeakInterfacePtr.h"

Syntax

template<class T>
struct TWeakInterfacePtr

Remarks

An alternative to TWeakObjectPtr that makes it easier to work through an interface.

Constructors

Name Description

Public function

TWeakInterfacePtr()

Construct a new default weak pointer, pointing to null object.

Public function

TWeakInterfacePtr

(
    U* Object
)

Construct from an object pointer

Public function

TWeakInterfacePtr

(
    T* Interface
)

Construct from an interface pointer

Public function

TWeakInterfacePtr

(
    T& Interface
)

Please use the constructor that takes a pointer

Functions

Name Description

Public function Const

T *

 

Get()

Dereference the weak pointer into an interface pointer.

Public function Const

UObject *...

 

GetObject()

Dereference the weak pointer into a UObject pointer.

Public function Const

bool

 

IsStale

(
    bool bEvenIfPendingKill,
    bool bThreadsafeTest
)

Test if this pointer is stale.

Public function Const

bool

 

IsValid()

Test if this points to a live object.

Public function Const

bool

 

IsValid

(
    bool bEvenIfPendingKill,
    bool bThreadsafeTest
)

Test if this points to a live object.

Public function

void

 

Reset()

Reset the weak pointer back to the null state.

Public function Const

TScriptInter...

 

ToScriptInterface()

Operators

Name Description

Public function Const

bool

 

operator!=

(
    const TWeakInterfacePtr< T >& Othe...
)

Public function Const

T &

 

operator*()

Dereference the weak pointer.

Public function

TWeakInterfa...

 

operator=

(
    T* Other
)

Assign from an interface pointer.

Public function

TWeakInterfa...

 

operator=

(
    const TWeakInterfacePtr< T >& Othe...
)

Assign from another weak pointer.

Public function

TWeakInterfa...

 

operator=

(
    const TScriptInterface< T >& Other
)

Assign from a script interface.

Public function Const

bool

 

operator==

(
    const TWeakInterfacePtr< T >& Othe...
)

Public function Const

T *

 

operator->()

Dereference the weak pointer.

Deprecated Functions

Name Description

Public function Const

bool

 

operator==

(
    const UObject* Other
)

Implicit equality with a UObject pointer has been deprecated - use GetObject() and test equality on its return value

Public function

 

TWeakInterfacePtr

(
    T& Interface
)

Please use the constructor that takes a 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