Navigation
API > API/Runtime > API/Runtime/CoreUObject
FSharedStruct works similarly as a TSharedPtr
This struct type is also convertible to a FStructView / FConstStructView, and like FInstancedStruct, it is the preferable way of passing it as a parameter. If the calling code would like to keep a shared pointer to the struct, you may pass the FSharedStruct as a parameter, but it is recommended to pass it as a "const FSharedStruct&" to limit the unnecessary recounting.
A 'const FSharedStruct' cannot be made to point at another instance of a struct, whilst a vanilla FSharedStruct can. In either case, the shared struct memory /data is mutable.
| Name | FSharedStruct |
| Type | struct |
| Header File | /Engine/Source/Runtime/CoreUObject/Public/StructUtils/SharedStruct.h |
| Include Path | #include "StructUtils/SharedStruct.h" |
Syntax
USTRUCT ()
struct FSharedStruct
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FSharedStruct
(
FSharedStruct&& InOther |
StructUtils/SharedStruct.h | ||
FSharedStruct
(
const FSharedStruct& InOther |
Copy constructors | StructUtils/SharedStruct.h | |
| StructUtils/SharedStruct.h |
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
~FSharedStruct() |
StructUtils/SharedStruct.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void AddStructReferencedObjects
(
FReferenceCollector& Collector |
StructUtils/SharedStruct.h | ||
bool CompareStructValues
(
const OtherType& Other, |
Determines whether Other contains the same values as `this_ | StructUtils/SharedStruct.h | |
T & Get() |
Returns reference to the struct, this getter assumes that all data is valid. | StructUtils/SharedStruct.h | |
uint8 * GetMemory() |
Returns a mutable pointer to struct memory. | StructUtils/SharedStruct.h | |
T * GetPtr() |
Returns pointer to the struct, or nullptr if cast is not valid. | StructUtils/SharedStruct.h | |
const UScriptStruct * GetScriptStruct() |
Returns struct type. | StructUtils/SharedStruct.h | |
TObjectPtr< const UScriptStruct > * GetScriptStructPtr() |
StructUtils/SharedStruct.h | ||
bool Identical
(
const FSharedStruct* Other, |
For StructOpsTypeTraits | StructUtils/SharedStruct.h | |
void InitializeAs
(
const UScriptStruct* InScriptStruct, |
Initializes from a struct type and optional data. | StructUtils/SharedStruct.h | |
void InitializeAs
(
TArgs&&... InArgs |
Initializes from struct type and emplace args. | StructUtils/SharedStruct.h | |
void InitializeAs
(
const T& Struct |
Initializes from other related struct types. | StructUtils/SharedStruct.h | |
void InitializeAs
(
const T& Struct |
Initializes from templated struct instance. | StructUtils/SharedStruct.h | |
void InitializeAs () |
Initializes from a templated struct type. | StructUtils/SharedStruct.h | |
bool IsValid() |
Returns True if the struct is valid. | StructUtils/SharedStruct.h | |
void Reset() |
Reset to empty. | StructUtils/SharedStruct.h |
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
static FSharedStruct Make () |
Creates a new FSharedStruct from a templated struct type. | StructUtils/SharedStruct.h | |
static FSharedStruct Make
(
const T& Struct |
Creates a new FSharedStruct from templated struct instance. | StructUtils/SharedStruct.h | |
static FSharedStruct Make
(
TArgs&&... InArgs |
Creates a new FSharedStruct from the templated type and forward all arguments to constructor. | StructUtils/SharedStruct.h | |
static FSharedStruct Make
(
const UScriptStruct* InScriptStruct, |
Creates a new FSharedStruct from struct type and optional instance memory. | StructUtils/SharedStruct.h |
Operators
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
bool operator!=
(
const OtherType& Other |
StructUtils/SharedStruct.h | ||
FSharedStruct & operator=
(
const FSharedStruct& InOther |
Assignment operators | StructUtils/SharedStruct.h | |
FSharedStruct & operator=
(
FSharedStruct&& InOther |
StructUtils/SharedStruct.h | ||
bool operator==
(
const OtherType& Other |
Comparison operators. Note: it does not compare the internal structure itself | StructUtils/SharedStruct.h |