Choose your operating system:
Windows
macOS
Linux
Module |
|
Header |
/Engine/Source/Runtime/Core/Public/Containers/SparseArray.h |
Include |
#include "Containers/SparseArray.h" |
template<typename InElementType, typename Allocator>
class TSparseArray
A dynamically sized array where element indices aren't necessarily contiguous. Memory is allocated for all elements in the array's index range, so it doesn't save memory; but it does allow O(1) element removal that doesn't invalidate the indices of subsequent elements. It uses TArray to store the elements, and a TBitArray to store whether each element index is allocated (for fast iteration over allocated elements).
Name | Description | |
---|---|---|
|
TSparseArray() |
Default constructor. |
|
TSparseArray ( |
Move constructor. |
|
TSparseArray ( |
Copy constructor. |
Name | Description | |
---|---|---|
|
~TSparseArray() |
Destructor. |
Name | Description | ||
---|---|---|---|
|
Add ( |
Adds an element to the array. |
|
|
Add ( |
Adds an element to the array. |
|
|
FSparseArray... |
AddUninitialized() |
Allocates space for an element in the array. |
|
FSparseArray... |
AddUninitializedAtLowestFreeIndex ( |
|
|
FSparseArray... |
AllocateIndex ( |
Marks an index as allocated, and returns information about the allocation. |
|
AppendHash ( |
||
|
TRangedForIt... |
begin() |
DO NOT USE DIRECTLY STL-like iterators to enable range-based for loop support. |
|
TRangedForCo... |
begin() |
|
|
CheckAddress ( |
Checks that the specified address is not part of an element within the container. |
|
|
Compact() |
Compacts the allocated elements into a contiguous index range. |
|
|
CompactStable() |
Compacts the allocated elements into a contiguous index range. |
|
|
CopyUnfrozen ( |
||
|
CountBytes ( |
Tracks the container's memory use through an archive. |
|
|
TConstIterat... |
CreateConstIterator() |
Creates a const iterator for the contents of this array |
|
CreateIterator() |
Creates an iterator for the contents of this array |
|
|
Emplace ( |
Constructs a new item at the last freed index of the array. |
|
|
EmplaceAt ( |
Constructs a new item at a given index of the array. |
|
|
EmplaceAtLowestFreeIndex ( |
Constructs a new item at the lowest free index of the array. |
|
|
Empty ( |
Removes all elements from the array, potentially leaving space allocated for an expected number of elements about to be added. |
|
|
TRangedForCo... |
end() |
|
|
TRangedForIt... |
end() |
|
|
GetAllocatedSize() |
Helper function to return the amount of memory allocated by this container Only returns the size of allocations made directly by the container, not the elements themselves. |
|
|
GetMaxIndex() |
||
|
Insert ( |
Inserts an element to the array. |
|
|
FSparseArray... |
InsertUninitialized ( |
Allocates space for an element in the array at a given index. |
|
IsAllocated ( |
||
|
IsCompact() |
||
|
IsEmpty() |
||
|
IsValidIndex ( |
||
|
Num() |
||
|
PointerToIndex ( |
||
|
RemoveAt |
Removes Count elements from the array, starting from Index. |
|
|
RemoveAtUninitialized |
Removes Count elements from the array, starting from Index, without destructing them. |
|
|
Reserve ( |
Preallocates enough memory to contain the specified number of elements. |
|
|
Reset() |
Empties the array, but keep its allocated memory as slack. |
|
|
Shrink() |
Shrinks the array's storage to avoid slack. |
|
|
Sort() |
Sorts the elements assuming < operator is defined for ElementType. |
|
|
Sort ( |
Sorts the elements using the provided comparison class. |
|
|
StableSort() |
Stable sorts the elements assuming < operator is defined for ElementType. |
|
|
StableSort ( |
Stable sorts the elements using the provided comparison class. |
|
|
WriteMemoryImage ( |
Name | Description | ||
---|---|---|---|
|
const Elemen... |
operator[] ( |
|
|
ElementType ... |
operator[] ( |
Accessors. |
|
TSparseArray... |
operator+= ( |
|
|
TSparseArray... |
operator+= ( |
Concatenation operators |
|
TSparseArray... |
operator= ( |
Move assignment operator. |
|
TSparseArray... |
operator= ( |
Copy assignment operator. |
Name |
Description |
|
---|---|---|
|
TConstIterator |
Iterates over all allocated elements in a const sparse array. |
|
TConstSubsetIterator |
An iterator which only iterates over the elements of the array which correspond to set bits in a separate bit array. |
|
TIterator |
Iterates over all allocated elements in a sparse array. |
|
TRangedForConstIterator |
|
|
TRangedForIterator |
Name |
Description |
---|---|
AllocationBitArrayType |
|
DataType |
|
ElementType |
|
FElementOrFreeListLink |
The element type stored is only indirectly related to the element type requested, to avoid instantiating TArray redundantly for compatible types. |
Name |
Description |
---|---|
SupportsFreezeMemoryImage |
Name | Description | ||
---|---|---|---|
|
AddAtLowestFreeIndex ( |
AddAtLowestFreeIndex API is deprecated; please use EmplaceAtLowestFreeIndex instead. |