Navigation
Unreal Engine C++ API Reference > Runtime > Core > Templates
References
Module | Core |
Header | /Engine/Source/Runtime/Core/Public/Templates/SharedPointer.h |
Include | #include "Templates/SharedPointer.h" |
Syntax
template<class ObjectType, ESPMode InMode>
class TWeakPtr
Remarks
TWeakPtr is a non-intrusive reference-counted weak object pointer. This weak pointer will be conditionally thread-safe when the optional Mode template argument is set to ThreadSafe.
Constructors
Type | Name | Description | |
---|---|---|---|
![]() |
NOTE: FNullTag parameter is an Unreal extension to standard shared_ptr behavior. | ||
![]() |
TWeakPtr
(
TSharedRef< OtherType, Mode > const& InSharedRef |
NOTE: The following is an Unreal extension to standard shared_ptr behavior. | |
![]() |
TWeakPtr
(
TSharedPtr< OtherType, Mode > const& InSharedPtr |
Constructs a weak pointer from a shared pointer | |
![]() |
Constructs a weak pointer from a weak pointer of another type. | ||
![]() |
|||
![]() |
|||
![]() |
|||
![]() |
TWeakPtr
(
TWeakPtr< OtherType, Mode > const& InWeakPtr, |
Special constructor used internally to statically cast one weak pointer type to another. | |
![]() |
TWeakPtr
(
TWeakPtr< OtherType, Mode > const& InWeakPtr, |
Special constructor used internally to cast a 'const' weak pointer a 'mutable' pointer. |
Functions
Type | Name | Description | |
---|---|---|---|
![]() ![]() |
uint32 | ||
![]() ![]() |
bool | HasSameObject
(
const void* InOtherPtr |
Returns true if the object this weak pointer points to is the same as the specified object pointer. |
![]() ![]() |
bool | IsValid () |
Checks to see if this weak pointer actually has a valid reference to an object |
![]() ![]() |
TSharedPtr< ObjectType, Mode > | Pin () |
Converts this weak pointer to a shared pointer that you can use to access the object (if it hasn't expired yet.) Remember, if there are no more shared references to the object, the returned shared pointer will not be valid. |
![]() |
TSharedPtr< ObjectType, Mode > | Pin () |
Converts this weak pointer to a shared pointer that you can use to access the object (if it hasn't expired yet.) Remember, if there are no more shared references to the object, the returned shared pointer will not be valid. |
![]() |
void | Reset () |
Resets this weak pointer, removing a weak reference to the object. |
Operators
Type | Name | Description | |
---|---|---|---|
![]() |
TWeakPtr & | operator=
(
TSharedRef< OtherType, Mode > const& InSharedRef |
NOTE: The following is an Unreal extension to standard shared_ptr behavior. |
![]() |
TWeakPtr & | ||
![]() |
TWeakPtr & | Assignment operator adds a weak reference to the object referenced by the specified weak pointer. | |
![]() |
TWeakPtr & | operator=
(
TSharedPtr< OtherType, Mode > const& InSharedPtr |
Assignment operator sets this weak pointer from a shared pointer |
![]() |
TWeakPtr & | Assignment operator adds a weak reference to the object referenced by the specified weak pointer | |
![]() |
TWeakPtr & | NOTE: The following is an Unreal extension to standard shared_ptr behavior. | |
![]() |
TWeakPtr & |
Typedefs
Name | Description |
---|---|
ElementType |
Constants
Name | Description |
---|---|
Mode |