/Engine/Plugins/Experimental/StructUtils/Source/StructUtils/Public/StructView.h
FConstStructViewis "typed" struct pointer, it contains const pointer to struct plusUScriptStructpointer.FConstStructViewdoes 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 aFInstancedStruct, you should useFConstStructVieworFStructViewto pass around a view to the contents.FConstStructViewis passed by value.FConstStructViewis similar toFStructOnScope, butFConstStructViewis a view only (FStructOnScopecan either own the memory or be a view)FConstStructViewprevents 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 constFConstStructView. e.g.FStructViewA;FConstStructViewB = A; // compiles e.g.FStructViewA;FConstStructViewB; B = A; // compiles as B can be made to point at any other StructView e.g.FConstStructViewA;FStructViewB = A; // doesn't compile as the struct data for A is immutable (but mutable for B) e.g.FStructViewA; A.Foo = NewVal; // compiles as the struct data for A is mutable. e.g.FConstStructViewA; A.Foo = NewVal; // doesn't compile as the struct data for A is immutable. e.g.FStructViewA; constFStructViewB; 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. constFStructViewA;FStructViewB; A = B; // doesn't compile as attempting to make const view point at something else
struct FConstStructView
constUScriptSt...
ScriptStruct
const uint8 ...
StructMemory