Navigation
API > API/Runtime > API/Runtime/CoreUObject
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.
| Name | FInstancedStructContainer |
| Type | struct |
| Header File | /Engine/Source/Runtime/CoreUObject/Public/StructUtils/InstancedStructContainer.h |
| Include Path | #include "StructUtils/InstancedStructContainer.h" |
Syntax
USTRUCT ()
struct FInstancedStructContainer
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FInstancedStructContainer
(
FInstancedStructContainer&& InOther |
StructUtils/InstancedStructContainer.h | ||
FInstancedStructContainer
(
const FInstancedStructContainer& InOther |
StructUtils/InstancedStructContainer.h | ||
| StructUtils/InstancedStructContainer.h |
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
~FInstancedStructContainer() |
StructUtils/InstancedStructContainer.h |
Structs
| Name | Remarks |
|---|---|
| FItem | Struct describing an item in the array. |
| TIterator | Iterators to enable range-based for loop support. |
Typedefs
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| FConstIterator | TIterator< const FInstancedStructContainer > | StructUtils/InstancedStructContainer.h | |
| FIterator | TIterator< FInstancedStructContainer > | StructUtils/InstancedStructContainer.h |
Constants
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| DefaultMinAlignment | int32 | Default minimum alignment for any allocation. | StructUtils/InstancedStructContainer.h |
| ItemStride | int32 | Each FItem struct is allocated at the end of the buffer (which is aligned to FItem alignment), and they are stride apart. | StructUtils/InstancedStructContainer.h |
| OverheadPerItem | int32 | How much memory is used to store info about each item. | StructUtils/InstancedStructContainer.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| AllocatedSize | int32 | Number of bytes allocated for the array. | StructUtils/InstancedStructContainer.h | |
| FConstIterator | friend | StructUtils/InstancedStructContainer.h | ||
| FIterator | friend | StructUtils/InstancedStructContainer.h | ||
| Memory | uint8 * | Memory holding all structs values and items. Values are stored front, and items back. | StructUtils/InstancedStructContainer.h | |
| NumItems | int32 | Number of items in the array. | StructUtils/InstancedStructContainer.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void AddStructReferencedObjects
(
FReferenceCollector& Collector |
Type traits | StructUtils/InstancedStructContainer.h | |
void Append
(
TConstArrayView< FConstStructView > NewItemValues |
StructUtils/InstancedStructContainer.h | ||
void Append
(
TConstArrayView< FInstancedStruct > NewItemValues |
StructUtils/InstancedStructContainer.h | ||
void Append
(
const FInstancedStructContainer& Other |
Appends items to the array. | StructUtils/InstancedStructContainer.h | |
FConstIterator begin () |
StructUtils/InstancedStructContainer.h | ||
FIterator begin () |
For ranged for, do not use directly. | StructUtils/InstancedStructContainer.h | |
FConstIterator CreateConstIterator() |
Creates const iterator to iterate over the array. | StructUtils/InstancedStructContainer.h | |
FIterator CreateIterator() |
Creates iterator to iterate over the array. | StructUtils/InstancedStructContainer.h | |
void Empty() |
Empties the array, destroys entities. Frees memory. | StructUtils/InstancedStructContainer.h | |
FConstIterator end () |
StructUtils/InstancedStructContainer.h | ||
FIterator end () |
StructUtils/InstancedStructContainer.h | ||
bool ExportTextItem
(
FString& ValueStr, |
StructUtils/InstancedStructContainer.h | ||
int32 GetAllocatedMemory() |
Returns number of bytes allocated for the array | StructUtils/InstancedStructContainer.h | |
| StructUtils/InstancedStructContainer.h | |||
bool Identical
(
const FInstancedStructContainer* Other, |
StructUtils/InstancedStructContainer.h | ||
bool ImportTextItem
(
const TCHAR*& Buffer, |
StructUtils/InstancedStructContainer.h | ||
void InsertAt
(
const int32 InsertAtIndex, |
StructUtils/InstancedStructContainer.h | ||
void InsertAt
(
const int32 InsertAtIndex, |
StructUtils/InstancedStructContainer.h | ||
void InsertAt
(
const int32 InsertAtIndex, |
StructUtils/InstancedStructContainer.h | ||
void InsertAt
(
const int32 InsertAtIndex, |
Insert new items at specified location. | StructUtils/InstancedStructContainer.h | |
bool IsValid() |
StructUtils/InstancedStructContainer.h | ||
bool IsValidIndex
(
const int32 Index |
StructUtils/InstancedStructContainer.h | ||
int32 Num() |
StructUtils/InstancedStructContainer.h | ||
void RemoveAt
(
const int32 RemoveAtIndex, |
Remove items at specific location. Does not change memory allocation. | StructUtils/InstancedStructContainer.h | |
void ReserveBytes
(
const int32 NumBytes, |
Reserves at least 'NumBytes' for internal storage. | StructUtils/InstancedStructContainer.h | |
void Reset() |
Empties the array, destroys entities. Does not change memory allocation. | StructUtils/InstancedStructContainer.h | |
bool Serialize
(
FArchive& Ar |
StructUtils/InstancedStructContainer.h | ||
void SetNum
(
const int32 NewNum |
Sets the number of items in the array. | StructUtils/InstancedStructContainer.h |
Operators
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FConstStructView operator[]
(
const int32 Index |
StructUtils/InstancedStructContainer.h | ||
FStructView operator[]
(
const int32 Index |
StructUtils/InstancedStructContainer.h | ||
FInstancedStructContainer & operator=
(
const FInstancedStructContainer& InOther |
StructUtils/InstancedStructContainer.h | ||
FInstancedStructContainer & operator=
(
FInstancedStructContainer&& InOther |
StructUtils/InstancedStructContainer.h | ||
FInstancedStructContainer & operator=
(
TConstArrayView< FInstancedStruct > InItems |
StructUtils/InstancedStructContainer.h | ||
FInstancedStructContainer & operator=
(
TConstArrayView< FStructView > InItems |
StructUtils/InstancedStructContainer.h | ||
FInstancedStructContainer & operator=
(
TConstArrayView< FConstStructView > InItems |
StructUtils/InstancedStructContainer.h |