Module |
|
Header |
/Engine/Source/Runtime/Core/Public/Containers/Array.h |
Include |
#include "Containers/Array.h" |
template<typename InElementType, typename InAllocatorType>
class TArray
Templated dynamic array
A dynamically sized array of typed elements. Makes the assumption that your elements are relocate-able; i.e. that they can be transparently moved to new memory without a copy constructor. The main implication is that pointers to elements in the TArray may be invalidated by adding or removing other elements to the array. Removal of elements is O(N) and invalidates the indices of subsequent elements.
Caution: as noted below some methods are not safe for element types that require constructors.
Name | Description | ||
---|---|---|---|
|
AllocatorInstance |
||
|
ArrayMax |
||
|
ArrayNum |
Name | Description | |
---|---|---|
|
TArray() |
Constructor, initializes element number counters. |
|
TArray |
Move constructor. |
|
TArray ( |
|
|
TArray ( |
Initializer list constructor |
|
TArray ( |
Copy constructor with changed allocator. Use the common routine to perform the copy. |
|
TArray ( |
Copy constructor. Use the common routine to perform the copy. |
|
TArray ( |
Move constructor. |
|
TArray ( |
Move constructor. |
|
TArray ( |
Constructor from a raw array of elements. |
|
TArray |
Copy constructor. Use the common routine to perform the copy. |
Name | Description | |
---|---|---|
|
~TArray() |
Destructor. |
Name | Description | ||
---|---|---|---|
|
Add ( |
Adds a new item to the end of the array, possibly reallocating the whole array to fit. |
|
|
Add ( |
Adds a new item to the end of the array, possibly reallocating the whole array to fit. |
|
|
ElementType ... |
Add_GetRef ( |
Adds a new item to the end of the array, possibly reallocating the whole array to fit. |
|
ElementType ... |
Add_GetRef ( |
Adds a new item to the end of the array, possibly reallocating the whole array to fit. |
|
AddDefaulted() |
Adds new items to the end of the array, possibly reallocating the whole array to fit. |
|
|
AddDefaulted ( |
||
|
ElementType ... |
AddDefaulted_GetRef() |
Add a new item to the end of the array, possibly reallocating the whole array to fit. |
|
AddUninitialized ( |
||
|
AddUninitialized() |
Adds a given number of uninitialized elements into the array. |
|
|
AddUnique ( |
Adds unique element to array if it doesn't exist. Move semantics version. |
|
|
AddUnique ( |
Adds unique element to array if it doesn't exist. |
|
|
AddZeroed() |
Adds new items to the end of the array, possibly reallocating the whole array to fit. |
|
|
AddZeroed ( |
||
|
ElementType ... |
AddZeroed_GetRef() |
Adds a new item to the end of the array, possibly reallocating the whole array to fit. |
|
void |
Append ( |
Appends the specified array to this array. AllocatorType changing version. |
|
void |
Append ( |
Appends the specified array to this array. |
|
void |
Append ( |
Appends the elements from a contiguous range to this array. |
|
void |
Append ( |
Adds an initializer list of elements to the end of the TArray. |
|
void |
Append ( |
Adds a raw array of elements to the end of the TArray. |
|
void |
Append ( |
Adds a raw array of elements to the end of the TArray. |
|
void |
AppendHash ( |
|
|
RangedForCon... |
begin() |
|
|
RangedForIte... |
begin() |
DO NOT USE DIRECTLY STL-like iterators to enable range-based for loop support. |
|
void |
BulkSerialize ( |
Bulk serialize array as a single memory blob when loading. |
|
void |
CheckAddress ( |
Checks that the specified address is not part of an element within the container. |
|
void |
CheckInvariants() |
Checks array invariants: if array size is greater than or equal to zero and less than or equal to the maximum. |
|
bool |
Contains ( |
Checks if this array contains the element. |
|
bool |
ContainsByPredicate ( |
Checks if this array contains an element for which the predicate is true. |
|
void |
CopyUnfrozen ( |
|
|
void |
CountBytes ( |
Count bytes needed to serialize this array. |
|
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 end of the array, possibly reallocating the whole array to fit. |
|
|
ElementType ... |
Emplace_GetRef ( |
Constructs a new item at the end of the array, possibly reallocating the whole array to fit. |
|
void |
EmplaceAt ( |
Constructs a new item at a specified index, possibly reallocating the whole array to fit. |
|
ElementType ... |
EmplaceAt_GetRef ( |
Constructs a new item at a specified index, possibly reallocating the whole array to fit. |
|
void |
Empty ( |
Empties the array. It calls the destructors on held items if needed. |
|
RangedForIte... |
end() |
|
|
RangedForCon... |
end() |
|
|
FilterByPredicate ( |
Filters the elements in the array based on a predicate functor. |
|
|
bool |
Find ( |
Finds element within the array. |
|
Find ( |
Finds element within the array. |
|
|
ElementType ... |
FindByKey ( |
Finds an item by key (assuming the ElementType overloads operator== for the comparison). |
|
const Elemen... |
FindByKey ( |
Finds an item by key (assuming the ElementType overloads operator== for the comparison). |
|
const Elemen... |
FindByPredicate ( |
Finds an element which matches a predicate functor. |
|
ElementType ... |
FindByPredicate ( |
Finds an element which matches a predicate functor. |
|
bool |
FindItemByClass |
Searches for the first entry of the specified type, will only work with TArray |
|
FindLast ( |
Finds element within the array starting from the end. |
|
|
bool |
FindLast ( |
Finds element within the array starting from the end. |
|
FindLastByPredicate ( |
Searches the array for the last occurrence of an element which matches the specified predicate. |
|
|
FindLastByPredicate ( |
Searches an initial subrange of the array for the last occurrence of an element which matches the specified predicate. |
|
|
SIZE_T |
GetAllocatedSize() |
Helper function to return the amount of memory allocated by this container. |
|
ElementAlloc... |
GetAllocatorInstance() |
|
|
const Elemen... |
GetAllocatorInstance() |
|
|
ElementType ... |
GetData() |
Helper function for returning a typed pointer to the first array entry. |
|
const Elemen... |
GetData() |
Helper function for returning a typed pointer to the first array entry. |
|
GetSlack() |
Returns the amount of slack in this array in elements. |
|
|
constexpr ui... |
GetTypeSize() |
Helper function returning the size of the inner type. |
|
void |
Heapify ( |
Implicit heaps Builds an implicit heap from the array. |
|
void |
Heapify() |
Builds an implicit heap from the array. |
|
void |
HeapPop ( |
Removes the top element from the heap. |
|
void |
HeapPop ( |
Removes the top element from the heap. |
|
void |
HeapPopDiscard ( |
Removes the top element from the heap. |
|
void |
HeapPopDiscard ( |
Removes the top element from the heap. |
|
HeapPush ( |
Adds a new element to the heap. |
|
|
HeapPush ( |
Adds a new element to the heap. |
|
|
HeapPush ( |
Adds a new element to the heap. |
|
|
HeapPush ( |
Adds a new element to the heap. |
|
|
void |
HeapRemoveAt ( |
Removes an element from the heap. |
|
void |
HeapRemoveAt ( |
Removes an element from the heap. |
|
void |
HeapSort ( |
Performs heap sort on the array. |
|
void |
HeapSort() |
Performs heap sort on the array. |
|
ElementType ... |
HeapTop() |
Returns the top element from the heap (does not remove the element). |
|
const Elemen... |
HeapTop() |
Returns the top element from the heap (does not remove the element). Const version. |
|
IndexOfByKey ( |
Finds an item by key (assuming the ElementType overloads operator== for the comparison). |
|
|
IndexOfByPredicate ( |
Finds an item by predicate. |
|
|
void |
Init ( |
Sets the size of the array, filling it with the given element. |
|
Insert ( |
Inserts given elements into the array at given location. |
|
|
Insert ( |
Inserts given elements into the array at given location. |
|
|
Insert ( |
Inserts a raw array of elements at a particular index in the TArray. |
|
|
Insert ( |
Inserts given elements into the array at given location. Compatible element type version. |
|
|
Insert ( |
Inserts given elements into the array at given location. Compatible element type version. |
|
|
Insert ( |
Inserts a given element into the array at given location. Move semantics version. |
|
|
Insert ( |
Inserts given elements into the array at given location. |
|
|
Insert ( |
Inserts a given element into the array at given location. |
|
|
ElementType ... |
Insert_GetRef ( |
Inserts a given element into the array at given location. Move semantics version. |
|
ElementType ... |
Insert_GetRef ( |
Inserts a given element into the array at given location. |
|
void |
InsertDefaulted ( |
Inserts a given number of default-constructed elements into the array at a given location. |
|
void |
InsertDefaulted |
|
|
ElementType ... |
InsertDefaulted_GetRef ( |
Inserts a default-constructed element into the array at a given location. |
|
void |
InsertUninitialized ( |
Inserts a given number of uninitialized elements into the array at given location. |
|
void |
InsertUninitialized |
|
|
void |
InsertZeroed |
|
|
void |
InsertZeroed ( |
Inserts a given number of zeroed elements into the array at given location. |
|
ElementType ... |
InsertZeroed_GetRef ( |
Inserts a zeroed element into the array at given location. |
|
bool |
IsEmpty() |
Returns true if the array is empty and contains no elements. |
|
bool |
IsValidIndex ( |
Tests if index is valid, i.e. greater than or equal to zero, and less than the number of elements in the array. |
|
const Elemen... |
Last ( |
Returns n-th last element from the array. Const version of the above. |
|
ElementType ... |
Last ( |
Returns n-th last element from the array. |
|
Max() |
Returns maximum number of elements in array. |
|
|
Num() |
Returns number of elements in array. |
|
|
TEnableIf<&#... |
Pop ( |
Pops element from the array. |
|
void |
Push ( |
Pushes element into the array. Const ref version of the above. |
|
void |
Push ( |
Pushes element into the array. |
|
void |
RangeCheck ( |
Checks if index is in array range. |
|
Remove ( |
Removes as many instances of Item as there are in the array, maintaining order but not indices. |
|
|
RemoveAll ( |
Remove all instances that match the predicate, maintaining order but not indices Optimized to work with runs of matches/non-matches |
|
|
RemoveAllSwap ( |
Remove all instances that match the predicate |
|
|
void |
RemoveAt ( |
Removes an element (or elements) at given location, then shrinks the array. |
|
void |
RemoveAt ( |
Removes an element (or elements) at given location, optionally shrinking the array. |
|
void |
RemoveAtSwap ( |
Removes an element (or elements) at given location, optionally shrinking the array. |
|
void |
RemoveAtSwap ( |
Removes an element (or elements) at given location, then shrinks the array. |
|
RemoveSingle ( |
Removes the first occurrence of the specified item in the array, maintaining order but not indices. |
|
|
RemoveSingleSwap ( |
Removes the first occurrence of the specified item in the array. |
|
|
RemoveSwap ( |
Removes item from the array. |
|
|
void |
Reserve ( |
Reserves memory such that the array can contain at least Number elements. |
|
void |
Reset ( |
Same as empty, but doesn't change memory allocations, unless the new size is larger than the current array. |
|
void |
SetNum ( |
Resizes array to given number of elements. |
|
void |
SetNumUninitialized ( |
Resizes array to given number of elements. New elements will be uninitialized. |
|
void |
SetNumUnsafeInternal ( |
Does nothing except setting the new number of elements in the array. |
|
void |
SetNumZeroed ( |
Resizes array to given number of elements, optionally shrinking it. New elements will be zeroed. |
|
void |
Shrink() |
Shrinks the array's used memory to smallest possible to store elements currently in it. |
|
void |
Sort() |
Sorts the array assuming < operator is defined for the item type. |
|
void |
Sort ( |
Sorts the array using user define predicate class. |
|
void |
StableSort ( |
Stable sorts the array using user defined predicate class. |
|
void |
StableSort() |
Stable sorts the array assuming < operator is defined for the item type. |
|
void |
Swap |
Element-wise array element swap. This version is doing more sanity checks than SwapMemory. |
|
void |
SwapMemory |
Element-wise array memory swap. |
|
const Elemen... |
Top() |
Returns the top element, i.e. the last one. Const version of the above. |
|
ElementType ... |
Top() |
Returns the top element, i.e. the last one. |
|
void |
ToString ( |
|
|
void |
VerifyHeap ( |
Verifies the heap. |
|
void |
WriteMemoryImage ( |
Name | Description | ||
---|---|---|---|
|
operator const TArray< typename TContainerElementTypeCompatibility< AliasElementType >::ReinterpretType, AllocatorType > &() |
Implicit conversion operator to constant container of compatible element type. |
|
|
operator TArray< typename TContainerElementTypeCompatibility< AliasElementType >::ReinterpretType, AllocatorType > &() |
Implicit conversion operator to container of compatible element type. |
|
|
bool |
operator!= ( |
Inequality operator. |
|
ElementType ... |
operator[] ( |
Array bracket operator. Returns reference to element at given index. |
|
const Elemen... |
operator[] ( |
Array bracket operator. Returns reference to element at given index. Const version of the above. |
|
TArray & |
operator+= ( |
Appends the specified array to this array. Cannot append to self. Move semantics version. |
|
TArray & |
operator+= ( |
Appends the specified array to this array. Cannot append to self. |
|
TArray & |
operator+= ( |
Appends the specified initializer list to this array. |
|
TArray & |
operator= ( |
Initializer list assignment operator. |
|
TArray & |
operator= ( |
Assignment operator. |
|
TArray & |
operator= ( |
|
|
TArray & |
operator= ( |
Assignment operator. |
|
TArray & |
operator= ( |
Move assignment operator. |
|
TArray & |
operator= ( |
Move assignment operator. Compatible element type version. |
|
TArray & |
operator= ( |
Assignment operator. |
|
TArray< InEl... |
operator= ( |
|
|
bool |
operator== ( |
Equality operator. |
Name |
Description |
---|---|
Allocator |
|
AllocatorType |
|
ElementAllocatorType |
|
ElementType |
|
RangedForConstIteratorType |
|
RangedForIteratorType |
|
SizeType |
|
TConstIterator |
|
TIterator |
Iterators. |
USizeType |