Navigation
API > API/Runtime > API/Runtime/Core > API/Runtime/Core/Containers
References
| Module | Core |
| Header | /Engine/Source/Runtime/Core/Public/Containers/SharedString.h |
| Include | #include "Containers/SharedString.h" |
| Source | /Engine/Source/Runtime/Core/Public/Containers/StringFwd.h |
Syntax
template<typename CharType>
class TSharedString
Remarks
A reference to an immutable, shared, reference-counted string.
Prefer TStringView when there is a clear single point of ownership with a longer lifetime than the references to the string. This type is meant for cases where a shared string does not have an obvious owner or where the lifetime is not easy to manage.
The string is stored as a pointer to the start of the null-terminated string which is preceded by a 4-byte reference count and a 4-byte size.
Constructors
| Type | Name | Description | |
|---|---|---|---|
TSharedString
(
TSharedString&& String |
|||
TSharedString
(
const TSharedString& String |
|||
TSharedString
(
TStringView< CharType > String |
Allocates a copy of the string and constructs this as a reference to it. |
Destructors
| Type | Name | Description | |
|---|---|---|---|
Functions
| Type | Name | Description | |
|---|---|---|---|
| bool | IsEmpty () |
Returns true if the referenced string is empty. | |
| int32 | Len () |
Returns the length of the referenced string excluding the null terminator. | |
| void | Reset () |
Resets this to reference the empty string. |
Operators
| Type | Name | Description | |
|---|---|---|---|
| const CharType * | operator* () |
Returns a pointer to the start of the referenced null-terminated string. | |
| TSharedString & | operator=
(
TSharedString&& String |
||
| TSharedString & | operator=
(
const TSharedString& String |
||
| TSharedString & | operator=
(
TStringView< CharType > String |
Allocates a copy of the string and assigns this as a reference to it. |
Typedefs
| Name | Description |
|---|---|
| ElementType |
Constants
| Name | Description |
|---|---|
| Empty | An empty string provided mainly for returning a reference to an empty TSharedString. |
| NullChar |