Navigation
API > API/Runtime > API/Runtime/CoreUObject > API/Runtime/CoreUObject/StructUtils
References
| Module | CoreUObject |
| Header | /Engine/Source/Runtime/CoreUObject/Public/StructUtils/InstancedStructContainer.h |
| Include | #include "StructUtils/InstancedStructContainer.h" |
Syntax
USTRUCT ()
struct FInstancedStructContainer
Remarks
Array of heterogeneous structs. Can be used as a property, supports serialization, but does not have type customizations (no editing in the UI).
If you need UI editable array of heterogeneous structs, use TArray
The array item values and the index to an item are stored in one contiguous block of memory. The size required to specific layout of structs is larger than the sum of their sizes due to alignment, and because the index to the structs is stored along with the value memory. Each item takes extra 16 bytes for index. If your items are roughly same size, a TArray
Adding new items is more expensive than on regular TArray<>, layout of the structs needs to be updated, and initialization is done via UScriptStruct. Adding and removing items should be done in chunks if possible.
The allocation of new items does not allocate extra space as most array implementations do. Use Reserve() to reserve certain sized buffer in bytes if that is applicable to your use case.
Constructors
| Type | Name | Description | |
|---|---|---|---|
FInstancedStructContainer
(
const FInstancedStructContainer& InOther |
|||
FInstancedStructContainer
(
FInstancedStructContainer&& InOther |
Destructors
| Type | Name | Description | |
|---|---|---|---|
Functions
| Type | Name | Description | |
|---|---|---|---|
| void | AddStructReferencedObjects
(
FReferenceCollector& Collector |
Type traits | |
| void | Append
(
TConstArrayView< FConstStructView > NewItemValues |
||
| void | Append
(
const FInstancedStructContainer& Other |
Appends items to the array. | |
| void | Append
(
TConstArrayView< FInstancedStruct > NewItemValues |
||
| FIterator | begin () |
For ranged for, do not use directly. | |
| FConstIterator | begin () |
||
| FConstIterator | Creates const iterator to iterate over the array. | ||
| FIterator | Creates iterator to iterate over the array. | ||
| void | Empty () |
Empties the array, destroys entities. Frees memory. | |
| FConstIterator | end () |
||
| FIterator | end () |
||
| bool | ExportTextItem
(
FString& ValueStr, |
||
| int32 | Returns number of bytes allocated for the array | ||
| void | GetPreloadDependencies
(
TArray< UObject* >& OutDeps |
||
| bool | Identical
(
const FInstancedStructContainer* Other, |
||
| bool | ImportTextItem
(
const TCHAR*& Buffer, |
||
| void | InsertAt
(
const int32 InsertAtIndex, |
||
| void | InsertAt
(
const int32 InsertAtIndex, |
Insert new items at specified location. | |
| void | InsertAt
(
const int32 InsertAtIndex, |
||
| void | InsertAt
(
const int32 InsertAtIndex, |
||
| bool | IsValid () |
||
| bool | IsValidIndex
(
const int32 Index |
||
| int32 | Num () |
||
| void | Remove items at specific location. Does not change memory allocation. | ||
| void | ReserveBytes
(
const int32 NumBytes, |
Reserves at least 'NumBytes' for internal storage. | |
| void | Reset () |
Empties the array, destroys entities. Does not change memory allocation. | |
| bool | |||
| void | Sets the number of items in the array. |
Operators
| Type | Name | Description | |
|---|---|---|---|
| FConstStructView | operator[]
(
const int32 Index |
||
| FStructView | operator[]
(
const int32 Index |
||
| FInstancedStructContainer & | operator=
(
const FInstancedStructContainer& InOther |
||
| FInstancedStructContainer & | operator=
(
FInstancedStructContainer&& InOther |
||
| FInstancedStructContainer & | operator=
(
TConstArrayView< FInstancedStruct > InItems |
||
| FInstancedStructContainer & | operator=
(
TConstArrayView< FConstStructView > InItems |
||
| FInstancedStructContainer & | operator=
(
TConstArrayView< FStructView > InItems |
Classes
| Type | Name | Description | |
|---|---|---|---|
| TIterator | Iterators to enable range-based for loop support. |
Typedefs
| Name | Description |
|---|---|
| FConstIterator | |
| FIterator |
Constants
| Name | Description |
|---|---|
| DefaultMinAlignment | Default minimum alignment for any allocation. |
| ItemStride | Each FItem struct is allocated at the end of the buffer (which is aligned to FItem alignment), and they are stride apart. |
| OverheadPerItem | How much memory is used to store info about each item. |