Navigation
API > API/Runtime > API/Runtime/CoreUObject
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
| Name | FConstStructView |
| Type | struct |
| Header File | /Engine/Source/Runtime/CoreUObject/Public/StructUtils/StructView.h |
| Include Path | #include "StructUtils/StructView.h" |
Syntax
struct FConstStructView
Derived Classes
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
| StructUtils/StructView.h | |||
FConstStructView
(
const FInstancedStruct& InstancedStruct |
StructUtils/StructView.h | ||
FConstStructView
(
const FSharedStruct& SharedStruct |
StructUtils/StructView.h | ||
FConstStructView
(
const FConstSharedStruct& SharedStruct |
StructUtils/StructView.h | ||
FConstStructView
(
const FStructView StructView |
StructUtils/StructView.h | ||
FConstStructView
(
const UScriptStruct* InScriptStruct, |
StructUtils/StructView.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
T & Get() |
Returns const reference to the struct, this getter assumes that all data is valid. | StructUtils/StructView.h | |
const uint8 * GetMemory() |
Returns const pointer to struct memory. | StructUtils/StructView.h | |
T * GetPtr() |
Returns const pointer to the struct, or nullptr if cast is not valid. | StructUtils/StructView.h | |
const UScriptStruct * GetScriptStruct() |
Returns struct type. | StructUtils/StructView.h | |
bool IsValid() |
Returns True if the struct is valid. | StructUtils/StructView.h | |
void Reset() |
Reset to empty. | StructUtils/StructView.h | |
void SetStructData
(
const UScriptStruct* InScriptStruct, |
StructUtils/StructView.h |
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
static FConstStructView Make
(
const T& Struct |
Creates a new FConstStructView from the templated struct | StructUtils/StructView.h |
Operators
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
bool operator!=
(
const OtherType& Other |
StructUtils/StructView.h | ||
bool operator==
(
const OtherType& Other |
Comparison operators. Note: it does not compare the internal structure itself | StructUtils/StructView.h |