UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FSharedStruct Struct Reference

#include <SharedStruct.h>

Public Member Functions

 GENERATED_BODY ()
 
 FSharedStruct ()=default
 
 ~FSharedStruct ()
 
 FSharedStruct (const FSharedStruct &InOther)=default
 
 FSharedStruct (FSharedStruct &&InOther)=default
 
FSharedStructoperator= (const FSharedStruct &InOther)=default
 
FSharedStructoperator= (FSharedStruct &&InOther)=default
 
UE_API bool Identical (const FSharedStruct *Other, uint32 PortFlags) const
 
UE_API void AddStructReferencedObjects (class FReferenceCollector &Collector) const
 
const UScriptStructGetScriptStruct () const
 
TObjectPtr< const UScriptStruct > * GetScriptStructPtr () const
 
uint8GetMemory () const
 
void Reset ()
 
template<typename T >
void InitializeAs ()
 
template<typename T >
void InitializeAs (const T &Struct)
 
void InitializeAs (const UScriptStruct *InScriptStruct, const uint8 *InStructMemory=nullptr)
 
template<typename T , typename... TArgs>
void InitializeAs (TArgs &&... InArgs)
 
template<typename T >
T & Get () const
 
template<typename T >
T * GetPtr () const
 
bool IsValid () const
 
template<typename OtherType >
bool operator== (const OtherType &Other) const
 
template<typename OtherType >
bool operator!= (const OtherType &Other) const
 
template<typename OtherType >
bool CompareStructValues (const OtherType &Other, uint32 PortFlags=0) const
 

Static Public Member Functions

template<typename T >
static FSharedStruct Make ()
 
template<typename T >
static FSharedStruct Make (const T &Struct)
 
static FSharedStruct Make (const UScriptStruct *InScriptStruct, const uint8 *InStructMemory=nullptr)
 
template<typename T , typename... TArgs>
static FSharedStruct Make (TArgs &&... InArgs)
 

Protected Attributes

TSharedPtr< FStructSharedMemoryStructMemoryPtr
 

Friends

struct FConstSharedStruct
 

Detailed Description

FSharedStruct works similarly as a TSharedPtr<FInstancedStruct> but avoids the double pointer indirection. (One pointer for the FInstancedStruct and one pointer for the struct memory it is wrapping). Also note that because of its implementation, it is not possible for now to go from a struct reference or struct view back to a shared struct.

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.

Constructor & Destructor Documentation

◆ FSharedStruct() [1/3]

FSharedStruct::FSharedStruct ( )
default

◆ ~FSharedStruct()

FSharedStruct::~FSharedStruct ( )
inline

◆ FSharedStruct() [2/3]

FSharedStruct::FSharedStruct ( const FSharedStruct InOther)
default

Copy constructors

◆ FSharedStruct() [3/3]

FSharedStruct::FSharedStruct ( FSharedStruct &&  InOther)
default

Member Function Documentation

◆ AddStructReferencedObjects()

void FSharedStruct::AddStructReferencedObjects ( class FReferenceCollector Collector) const

◆ CompareStructValues()

template<typename OtherType >
bool FSharedStruct::CompareStructValues ( const OtherType Other,
uint32  PortFlags = 0 
) const
inline

Determines whether Other contains the same values as this

Returns
whether the values stored are equal

◆ GENERATED_BODY()

FSharedStruct::GENERATED_BODY ( )

◆ Get()

template<typename T >
T & FSharedStruct::Get ( ) const
inline

Returns reference to the struct, this getter assumes that all data is valid.

◆ GetMemory()

uint8 * FSharedStruct::GetMemory ( ) const
inline

Returns a mutable pointer to struct memory.

◆ GetPtr()

template<typename T >
T * FSharedStruct::GetPtr ( ) const
inline

Returns pointer to the struct, or nullptr if cast is not valid.

◆ GetScriptStruct()

const UScriptStruct * FSharedStruct::GetScriptStruct ( ) const
inline

Returns struct type.

◆ GetScriptStructPtr()

TObjectPtr< const UScriptStruct > * FSharedStruct::GetScriptStructPtr ( ) const
inline

◆ Identical()

bool FSharedStruct::Identical ( const FSharedStruct Other,
uint32  PortFlags 
) const

For StructOpsTypeTraits

◆ InitializeAs() [1/4]

template<typename T >
void FSharedStruct::InitializeAs ( )
inline

Initializes from a templated struct type. This will create a new instance of the shared struct memory.

◆ InitializeAs() [2/4]

template<typename T >
void FSharedStruct::InitializeAs ( const T &  Struct)
inline

Initializes from other related struct types. This will create a new instance of the shared struct memory.

◆ InitializeAs() [3/4]

void FSharedStruct::InitializeAs ( const UScriptStruct InScriptStruct,
const uint8 InStructMemory = nullptr 
)
inline

Initializes from a struct type and optional data. This will create a new instance of the shared struct memory.

◆ InitializeAs() [4/4]

template<typename T , typename... TArgs>
void FSharedStruct::InitializeAs ( TArgs &&...  InArgs)
inline

Initializes from struct type and emplace args. This will create a new instance of the shared struct memory.

◆ IsValid()

bool FSharedStruct::IsValid ( ) const
inline

Returns True if the struct is valid.

◆ Make() [1/4]

template<typename T >
static FSharedStruct FSharedStruct::Make ( )
inlinestatic

Creates a new FSharedStruct from a templated struct type. This will create a new instance of the shared struct memory.

◆ Make() [2/4]

template<typename T >
static FSharedStruct FSharedStruct::Make ( const T &  Struct)
inlinestatic

Creates a new FSharedStruct from templated struct instance. This will create a new instance of the shared struct memory.

◆ Make() [3/4]

static FSharedStruct FSharedStruct::Make ( const UScriptStruct InScriptStruct,
const uint8 InStructMemory = nullptr 
)
inlinestatic

Creates a new FSharedStruct from struct type and optional instance memory. This will create a new instance of the shared struct memory.

◆ Make() [4/4]

template<typename T , typename... TArgs>
static FSharedStruct FSharedStruct::Make ( TArgs &&...  InArgs)
inlinestatic

Creates a new FSharedStruct from the templated type and forward all arguments to constructor. This will create a new instance of the shared struct memory.

◆ operator!=()

template<typename OtherType >
bool FSharedStruct::operator!= ( const OtherType Other) const
inline

◆ operator=() [1/2]

FSharedStruct & FSharedStruct::operator= ( const FSharedStruct InOther)
default

Assignment operators

◆ operator=() [2/2]

FSharedStruct & FSharedStruct::operator= ( FSharedStruct &&  InOther)
default

◆ operator==()

template<typename OtherType >
bool FSharedStruct::operator== ( const OtherType Other) const
inline

Comparison operators. Note: it does not compare the internal structure itself

◆ Reset()

void FSharedStruct::Reset ( )
inline

Reset to empty.

Friends And Related Symbol Documentation

◆ FConstSharedStruct

Member Data Documentation

◆ StructMemoryPtr

TSharedPtr<FStructSharedMemory> FSharedStruct::StructMemoryPtr
protected

The documentation for this struct was generated from the following files: