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 TSharedPtr
Remarks
TSharedPtr is a non-intrusive reference-counted authoritative object pointer. This shared 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. | ||
![]() |
TSharedPtr
(
OtherType* InObject, |
Constructs a shared pointer that owns the specified object. | |
![]() |
TSharedPtr
(
TSharedPtr< OtherType, Mode > const& InSharedPtr, |
Special constructor used internally to statically cast one shared pointer type to another. | |
![]() |
TSharedPtr
(
TSharedPtr< OtherType, Mode > const& InSharedPtr, |
Special constructor used internally to cast a 'const' shared pointer a 'mutable' pointer. | |
![]() |
TSharedPtr
(
TSharedPtr< OtherType, Mode > const& OtherSharedPtr, |
Aliasing constructor used to create a shared pointer which shares its reference count with another shared object, but pointing to a different object, typically a subobject. | |
![]() |
TSharedPtr
(
TSharedPtr< OtherType, Mode >&& OtherSharedPtr, |
Aliasing constructor used to create a shared pointer which shares its reference count with another shared object, but pointing to a different object, typically a subobject. | |
![]() |
TSharedPtr
(
TSharedRef< OtherType, Mode > const& OtherSharedRef, |
Aliasing constructor used to create a shared pointer which shares its reference count with another shared object, but pointing to a different object, typically a subobject. | |
![]() |
TSharedPtr
(
OtherType* InObject |
Constructs a shared pointer that owns the specified object. | |
![]() |
TSharedPtr
(
SharedPointerInternals::TRawPtrProxy< OtherType > const& InRawPtrProxy |
NOTE: The following is an Unreal extension to standard shared_ptr behavior. | |
![]() |
TSharedPtr
(
SharedPointerInternals::TRawPtrProxyWithDeleter< OtherType, DeleterType > const& InRawPtrProxy |
NOTE: The following is an Unreal extension to standard shared_ptr behavior. | |
![]() |
TSharedPtr
(
SharedPointerInternals::TRawPtrProxyWithDeleter< OtherType, DeleterType >&& InRawPtrProxy |
NOTE: The following is an Unreal extension to standard shared_ptr behavior. | |
![]() |
TSharedPtr
(
TSharedPtr< OtherType, Mode > const& InSharedPtr |
Constructs a shared pointer as a shared reference to an existing shared pointer's object. | |
![]() |
TSharedPtr
(
TSharedPtr const& InSharedPtr |
||
![]() |
TSharedPtr
(
TSharedPtr&& InSharedPtr |
||
![]() |
TSharedPtr
(
TSharedRef< OtherType, Mode > const& InSharedRef |
NOTE: The following is an Unreal extension to standard shared_ptr behavior. |
Functions
Type | Name | Description | |
---|---|---|---|
![]() ![]() |
ObjectType * | Get () |
Returns the object referenced by this pointer, or nullptr if no object is reference |
![]() ![]() |
int32 | Returns the number of shared references to this object (including this reference.) IMPORTANT: Not necessarily fast! Should only be used for debugging purposes! | |
![]() ![]() |
bool | IsUnique () |
Returns true if this is the only shared reference to this object. |
![]() ![]() |
const bool | IsValid () |
Checks to see if this shared pointer is actually pointing to an object |
![]() |
void | Reset () |
Resets this shared pointer, removing a reference to the object. |
![]() |
TSharedRef< ObjectType, Mode > | ToSharedRef () |
NOTE: The following is an Unreal extension to standard shared_ptr behavior. |
![]() ![]() |
TSharedRef< ObjectType, Mode > | ToSharedRef () |
NOTE: The following is an Unreal extension to standard shared_ptr behavior. |
![]() ![]() |
TWeakPtr< ObjectType, Mode > | ToWeakPtr () |
Converts a shared pointer to a weak ptr. |
Operators
Type | Name | Description | |
---|---|---|---|
![]() ![]() |
Checks to see if this shared pointer is actually pointing to an object | ||
![]() ![]() |
FMakeReferenceTo< ObjectType >::Type | operator* () |
Dereference operator returns a reference to the object this shared pointer points to |
![]() |
TSharedPtr & | NOTE: The following is an Unreal extension to standard shared_ptr behavior. | |
![]() |
TSharedPtr & | operator=
(
TSharedPtr const& InSharedPtr |
Assignment operator replaces this shared pointer with the specified shared pointer. |
![]() |
TSharedPtr & | operator=
(
TSharedPtr&& InSharedPtr |
|
![]() |
TSharedPtr & | operator=
(
SharedPointerInternals::TRawPtrProxy< OtherType > const& InRawPtrProxy |
NOTE: The following is an Unreal extension to standard shared_ptr behavior. |
![]() |
TSharedPtr & | operator=
(
SharedPointerInternals::TRawPtrProxyWithDeleter< OtherType, DeleterType > const& InRawPtrProxy |
NOTE: The following is an Unreal extension to standard shared_ptr behavior. |
![]() |
TSharedPtr & | operator=
(
SharedPointerInternals::TRawPtrProxyWithDeleter< OtherType, DeleterType >&& InRawPtrProxy |
NOTE: The following is an Unreal extension to standard shared_ptr behavior. |
![]() ![]() |
ObjectType * | operator-> () |
Arrow operator returns a pointer to the object this shared pointer references |
Typedefs
Name | Description |
---|---|
ElementType |
Constants
Name | Description |
---|---|
Mode |