Navigation
Unreal Engine C++ API Reference > Runtime > CoreUObject > StructUtils
Inheritance Hierarchy
- FConstStructView
- TConstStructView
References
Module | CoreUObject |
Header | /Engine/Source/Runtime/CoreUObject/Public/StructUtils/StructView.h |
Include | #include "StructUtils/StructView.h" |
Syntax
struct FConstStructView
Remarks
FConstStructView is "typed" struct pointer, it contains const pointer to struct plus UScriptStruct pointer. FConstStructView does not own the memory and will not free it when of scope. It should be only used to pass struct pointer in a limited scope, or when the user controls the lifetime of the struct being stored. E.g. instead of passing ref or pointer to a FInstancedStruct, you should use FConstStructView or FStructView to pass around a view to the contents. FConstStructView is passed by value. FConstStructView is similar to FStructOnScope, but FConstStructView is a view only (FStructOnScope can either own the memory or be a view) FConstStructView prevents mutation of the actual struct data however the struct being pointed at can be changed to point at a different instance of a struct. To also prevent this use const FConstStructView. e.g. FStructView A; FConstStructView B = A; // compiles e.g. FStructView A; FConstStructView B; B = A; // compiles as B can be made to point at any other StructView e.g. FConstStructView A; FStructView B = A; // doesn't compile as the struct data for A is immutable (but mutable for B) e.g. FStructView A; A.Foo = NewVal; // compiles as the struct data for A is mutable. e.g. FConstStructView A; A.Foo = NewVal; // doesn't compile as the struct data for A is immutable. e.g. FStructView A; const FStructView B; A = B; // compiles as the struct B is pointing to can't be made to point at something else but A isn't const. e.g. const FStructView A; FStructView B; A = B; // doesn't compile as attempting to make const view point at something else
Variables
Type | Name | Description | |
---|---|---|---|
![]() |
const UScriptStruct * | ScriptStruct | |
![]() |
const uint8 * | StructMemory |
Constructors
Type | Name | Description | |
---|---|---|---|
![]() |
|||
![]() |
FConstStructView
(
const FInstancedStruct& InstancedStruct |
||
![]() |
FConstStructView
(
const FSharedStruct& SharedStruct |
||
![]() |
FConstStructView
(
const FConstSharedStruct& SharedStruct |
||
![]() |
FConstStructView
(
const FStructView StructView |
||
![]() |
FConstStructView
(
const UScriptStruct* InScriptStruct, |
Functions
Type | Name | Description | |
---|---|---|---|
![]() ![]() |
TEnableIfTIsConst< T >::Value, constT & >::Type | Get () |
Returns const reference to the struct, this getter assumes that all data is valid. |
![]() ![]() |
TEnableIf< TIsConst< T >::Value, T & >::Type | Get () |
Returns const reference to the struct, this getter assumes that all data is valid. |
![]() ![]() |
const uint8 * | GetMemory () |
Returns const pointer to struct memory. |
![]() ![]() |
TEnableIf< TIsConst< T >::Value, T * >::Type | GetPtr () |
Returns const pointer to the struct, or nullptr if cast is not valid. |
![]() ![]() |
TEnableIfTIsConst< T >::Value, constT * >::Type | GetPtr () |
Returns const pointer to the struct, or nullptr if cast is not valid. |
![]() ![]() |
const UScriptStruct * | Returns struct type. | |
![]() ![]() |
bool | IsValid () |
Returns True if the struct is valid. |
![]() ![]() |
FConstStructView | Make
(
const T& Struct |
Creates a new FConstStructView from the templated struct |
![]() |
void | Reset () |
Reset to empty. |
![]() |
void | SetStructData
(
const UScriptStruct* InScriptStruct, |
Operators
Type | Name | Description | |
---|---|---|---|
![]() ![]() |
bool | operator!=
(
const OtherType& Other |
|
![]() ![]() |
bool | operator==
(
const OtherType& Other |
Comparison operators. Note: it does not compare the internal structure itself |