Navigation
API > API/Runtime > API/Runtime/Core
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.
| Name | TWeakPtr |
| Type | class |
| Header File | /Engine/Source/Runtime/Core/Public/Templates/SharedPointer.h |
| Include Path | #include "Templates/SharedPointer.h" |
Syntax
template<class ObjectType, ESPMode InMode>
class TWeakPtr
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
| NOTE: FNullTag parameter is an Unreal extension to standard shared_ptr behavior. | Templates/SharedPointer.h | ||
TWeakPtr
(
TSharedRef< OtherType, Mode > const& InSharedRef |
NOTE: The following is an Unreal extension to standard shared_ptr behavior. | Templates/SharedPointer.h | |
TWeakPtr
(
TSharedPtr< OtherType, Mode > const& InSharedPtr |
Constructs a weak pointer from a shared pointer | Templates/SharedPointer.h | |
| Constructs a weak pointer from a weak pointer of another type. | Templates/SharedPointer.h | ||
| Templates/SharedPointer.h | |||
| Templates/SharedPointer.h | |||
| Templates/SharedPointer.h | |||
| Templates/SharedPointer.h | |||
TWeakPtr
(
TWeakPtr< OtherType, Mode > const& InWeakPtr, |
Special constructor used internally to statically cast one weak pointer type to another. | Templates/SharedPointer.h | |
TWeakPtr
(
TWeakPtr< OtherType, Mode > const& InWeakPtr, |
Special constructor used internally to cast a 'const' weak pointer a 'mutable' pointer. | Templates/SharedPointer.h |
Typedefs
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| ElementType | ObjectType | Templates/SharedPointer.h | |
| IntrusiveUnsetOptionalStateType | TWeakPtr | Templates/SharedPointer.h |
Constants
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| bHasIntrusiveUnsetOptionalState | bool | Start - intrusive TOptional |
Templates/SharedPointer.h |
| Mode | ESPMode | Templates/SharedPointer.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| Object | ObjectType * | The object we have a weak reference to. | Templates/SharedPointer.h | |
| WeakReferenceCount | SharedPointerInternals::FWeakReferencer< Mode > | Interface to the reference counter for this object. | Templates/SharedPointer.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
uint32 GetWeakPtrTypeHash() |
Templates/SharedPointer.h | ||
bool HasSameObject
(
const void* InOtherPtr |
Returns true if the object this weak pointer points to is the same as the specified object pointer. | Templates/SharedPointer.h | |
bool IsValid() |
Checks to see if this weak pointer actually has a valid reference to an object | Templates/SharedPointer.h | |
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. | Templates/SharedPointer.h | |
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. | Templates/SharedPointer.h | |
void Reset () |
Resets this weak pointer, removing a weak reference to the object. | Templates/SharedPointer.h | |
bool UEOpEquals
(
const TWeakPtr< OtherType, Mode >& Rhs |
End - intrusive TOptional |
Templates/SharedPointer.h | |
bool UEOpEquals
(
FIntrusiveUnsetOptionalState |
Templates/SharedPointer.h | ||
bool UEOpEquals
(
TYPE_OF_NULLPTR |
Templates/SharedPointer.h | ||
bool UEOpLessThan
(
const TWeakPtr< OtherType, Mode >& Rhs |
Templates/SharedPointer.h |
Operators
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
TWeakPtr & operator=
(
TSharedPtr< OtherType, Mode > const& InSharedPtr |
Assignment operator sets this weak pointer from a shared pointer | Templates/SharedPointer.h | |
| NOTE: The following is an Unreal extension to standard shared_ptr behavior. | Templates/SharedPointer.h | ||
| Assignment operator adds a weak reference to the object referenced by the specified weak pointer | Templates/SharedPointer.h | ||
| Templates/SharedPointer.h | |||
| Assignment operator adds a weak reference to the object referenced by the specified weak pointer. | Templates/SharedPointer.h | ||
| Templates/SharedPointer.h | |||
TWeakPtr & operator=
(
TSharedRef< OtherType, Mode > const& InSharedRef |
NOTE: The following is an Unreal extension to standard shared_ptr behavior. | Templates/SharedPointer.h |