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 TSharedRef
Remarks
TSharedRef is a non-nullable, non-intrusive reference-counted authoritative object reference.
This shared reference will be conditionally thread-safe when the optional Mode template argument is set to ThreadSafe.
Forward declarations. By default, thread safety features are turned on. (Mode = ESPMode::ThreadSafe). If you need more concerned with performance of ref-counting, you should use ESPMode::NotThreadSafe.
Constructors
Type | Name | Description | |
---|---|---|---|
![]() |
TSharedRef () |
Constructs default shared reference that owns the default object for specified type. | |
![]() |
TSharedRef
(
OtherType* InObject, |
Constructs a shared reference that owns the specified object. Must not be nullptr. | |
![]() |
TSharedRef
(
TSharedRef< OtherType, Mode > const& InSharedRef, |
Special constructor used internally to statically cast one shared reference type to another. | |
![]() |
TSharedRef
(
TSharedRef< OtherType, Mode > const& InSharedRef, |
Special constructor used internally to cast a 'const' shared reference a 'mutable' reference. | |
![]() |
TSharedRef
(
TSharedRef< OtherType, Mode > const& OtherSharedRef, |
Aliasing constructor used to create a shared reference which shares its reference count with another shared object, but pointing to a different object, typically a subobject. | |
![]() |
TSharedRef
(
OtherType* InObject |
NOTE: TSharedRef has no default constructor as it does not support empty references. | |
![]() |
TSharedRef
(
SharedPointerInternals::TRawPtrProxy< OtherType > const& InRawPtrProxy |
NOTE: The following is an Unreal extension to standard shared_ptr behavior. | |
![]() |
TSharedRef
(
SharedPointerInternals::TRawPtrProxyWithDeleter< OtherType, DeleterType > const& InRawPtrProxy |
NOTE: The following is an Unreal extension to standard shared_ptr behavior. | |
![]() |
TSharedRef
(
SharedPointerInternals::TRawPtrProxyWithDeleter< OtherType, DeleterType >&& InRawPtrProxy |
NOTE: The following is an Unreal extension to standard shared_ptr behavior. | |
![]() |
TSharedRef
(
TSharedRef< OtherType, Mode > const& InSharedRef |
Constructs a shared reference as a reference to an existing shared reference's object. | |
![]() |
TSharedRef
(
TSharedRef const& InSharedRef |
||
![]() |
TSharedRef
(
TSharedRef&& InSharedRef |
||
![]() |
Functions
Type | Name | Description | |
---|---|---|---|
![]() ![]() |
ObjectType & | Get () |
Returns a C++ reference to the object this shared reference is referencing |
![]() ![]() |
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. |
![]() ![]() |
TSharedPtr< ObjectType, Mode > | ToSharedPtr () |
Converts a shared reference to a shared pointer. |
![]() ![]() |
TWeakPtr< ObjectType, Mode > | ToWeakPtr () |
Converts a shared reference to a weak ptr. |
Operators
Type | Name | Description | |
---|---|---|---|
![]() ![]() |
ObjectType & | operator* () |
Dereference operator returns a reference to the object this shared pointer points to |
![]() |
TSharedRef & | operator=
(
SharedPointerInternals::TRawPtrProxyWithDeleter< OtherType, DeleterType > const& InRawPtrProxy |
NOTE: The following is an Unreal extension to standard shared_ptr behavior. |
![]() |
TSharedRef & | operator=
(
SharedPointerInternals::TRawPtrProxy< OtherType > const& InRawPtrProxy |
NOTE: The following is an Unreal extension to standard shared_ptr behavior. |
![]() |
TSharedRef & | operator=
(
TSharedRef&& InSharedRef |
|
![]() |
TSharedRef & | operator=
(
TSharedRef const& InSharedRef |
Assignment operator replaces this shared reference with the specified shared reference. |
![]() |
TSharedRef & | operator=
(
SharedPointerInternals::TRawPtrProxyWithDeleter< OtherType, DeleterType >&& InRawPtrProxy |
NOTE: The following is an Unreal extension to standard shared_ptr behavior. |
![]() ![]() |
bool | ||
![]() ![]() |
ObjectType * | operator-> () |
Arrow operator returns a pointer to this shared reference's object |
Typedefs
Name | Description |
---|---|
ElementType | |
IntrusiveUnsetOptionalStateType |
Constants
Name | Description |
---|---|
bHasIntrusiveUnsetOptionalState | Start - intrusive TOptional |
Mode |