FSharedStruct

[FSharedStruct](API\Plugins\StructUtils\FSharedStruct) works similarly as a TSharedPtr but removes the double pointer indirection that would create.

Choose your operating system:

Windows

macOS

Linux

Inheritance Hierarchy

FConstSharedStruct

FSharedStruct

References

Module

StructUtils

Header

/Engine/Plugins/Experimental/StructUtils/Source/StructUtils/Public/SharedStruct.h

Include

#include "SharedStruct.h"

Syntax

USTRUCT()
struct FSharedStruct : public FConstSharedStruct

Remarks

FSharedStruct works similarly as a TSharedPtr<FInstancedStruct> but removes the double pointer indirection that would create. (One pointer for the FInstancedStruct and one pointer for the struct memory it is wrapping). Also

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 and is the preferable way of passing it as a parameter just as the FInstancedStruct. 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.

Constructors

Name Description

Public function

FSharedStruct()

Public function

FSharedStruct

(
    const UScriptStruct* InScriptS...
)

Public function

FSharedStruct

(
    const FConstStructView InOther
)

Public function

FSharedStruct

(
    const FSharedStruct& InOther
)

Copy constructors

Public function

FSharedStruct

(
    FSharedStruct&& InOther
)

Destructors

Name Description

Public function

~FSharedStruct()

Functions

Name Description

Public function Const

T &

 

GetMutable()

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

Public function Const

uint8 *

 

GetMutableMemory()

Returns a mutable pointer to struct memory.

Public function Const

T *

 

GetMutablePtr()

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

Public function

void

 

InitializeAs

(
    TArgs&&... InArgs
)

Initializes from struct type and emplace construct.

Public function

void

 

InitializeAs

(
    const UScriptStruct* InScriptS...,
    const uint8* InStructMemory
)

Initializes from struct type and optional data.

Public function Static

FSharedStruc...

 

Make()

Creates a new FSharedStruct from templated struct type.

Public function Static

FSharedStruc...

 

Make

(
    const T& Struct
)

Creates a new FSharedStruct from templated struct.

Public function Static

FSharedStruc...

 

Make

(
    TArgs&&... InArgs
)

Creates a new FSharedStruct from the templated type and forward all arguments to constructor.

Operators

Name Description

Public function

FSharedStruc...

 

operator=

(
    FSharedStruct&& InOther
)

Public function

FSharedStruc...

 

operator=

(
    const FSharedStruct& InOther
)

Assignment operators

Public function

FSharedStruc...

 

operator=

(
    const FConstStructView InOther
)