A dynamically sized array where element indices aren't necessarily contiguous.
更多...
|
|
int32 | Add (const ElementType &Element) |
| | Adds an element to the array.
|
| |
|
int32 | Add (ElementType &&Element) |
| | Adds an element to the array.
|
| |
| int32 | AddAtLowestFreeIndex (const ElementType &Element, int32 &LowestFreeIndexSearchStart) |
| | Add an element at the lowest free index, instead of the last freed index. 更多...
|
| |
| FSparseArrayAllocationInfo | AddUninitialized () |
| | Allocates space for an element in the array. 更多...
|
| |
|
FSparseArrayAllocationInfo | AllocateIndex (int32 Index) |
| | Marks an index as allocated, and returns information about the allocation.
|
| |
|
FORCEINLINE TRangedForIterator | begin () |
| | DO NOT USE DIRECTLY STL-like iterators to enable range-based for loop support.
|
| |
| FORCEINLINE void | CheckAddress (const ElementType *Addr) const |
| | Checks that the specified address is not part of an element within the container. 更多...
|
| |
| bool | Compact () |
| | Compacts the allocated elements into a contiguous index range. 更多...
|
| |
| bool | CompactStable () |
| | Compacts the allocated elements into a contiguous index range. 更多...
|
| |
|
void | CountBytes (FArchive &Ar) const |
| | Tracks the container's memory use through an archive.
|
| |
|
TConstIterator | CreateConstIterator () const |
| | Creates a const iterator for the contents of this array
|
| |
|
TIterator | CreateIterator () |
| | Creates an iterator for the contents of this array
|
| |
| template<typename... ArgsType> |
| FORCEINLINE int32 | Emplace (ArgsType &&... Args) |
| | Constructs a new item at the last freed index of the array. 更多...
|
| |
| template<typename... ArgsType> |
| FORCEINLINE int32 | EmplaceAtLowestFreeIndex (int32 &LowestFreeIndexSearchStart, ArgsType &&... Args) |
| | Constructs a new item at the lowest free index of the array. 更多...
|
| |
| void | Empty (int32 ExpectedNumElements=0) |
| | Removes all elements from the array, potentially leaving space allocated for an expected number of elements about to be added. 更多...
|
| |
| uint32 | GetAllocatedSize (void) const |
| | 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. 更多...
|
| |
|
void | Insert (int32 Index, typename TTypeTraits< ElementType >::ConstInitType Element) |
| | Inserts an element to the array.
|
| |
| FSparseArrayAllocationInfo | InsertUninitialized (int32 Index) |
| | Allocates space for an element in the array at a given index. 更多...
|
| |
|
TSparseArray & | operator+= (const TSparseArray &OtherArray) |
| | Concatenation operators
|
| |
|
TSparseArray & | operator= (const TSparseArray &InCopy) |
| | Copy assignment operator.
|
| |
|
TSparseArray & | operator= (TSparseArray &&InCopy) |
| | Move assignment operator.
|
| |
|
void | RemoveAt (int32 Index, int32 Count=1) |
| | Removes Count elements from the array, starting from Index.
|
| |
|
void | RemoveAtUninitialized (int32 Index, int32 Count=1) |
| | Removes Count elements from the array, starting from Index, without destructing them.
|
| |
| void | Reserve (int32 ExpectedNumElements) |
| | Preallocates enough memory to contain the specified number of elements. 更多...
|
| |
|
void | Reset () |
| | Empties the array, but keep its allocated memory as slack.
|
| |
|
void | Shrink () |
| | Shrinks the array's storage to avoid slack.
|
| |
|
void | Sort () |
| | Sorts the elements assuming < operator is defined for ElementType.
|
| |
|
template<typename PREDICATE_CLASS > |
| void | Sort (const PREDICATE_CLASS &Predicate) |
| | Sorts the elements using the provided comparison class.
|
| |
|
void | StableSort () |
| | Stable sorts the elements assuming < operator is defined for ElementType.
|
| |
|
template<typename PREDICATE_CLASS > |
| void | StableSort (const PREDICATE_CLASS &Predicate) |
| | Stable sorts the elements using the provided comparison class.
|
| |
|
| TSparseArray () |
| | Default constructor.
|
| |
|
| TSparseArray (const TSparseArray &InCopy) |
| | Copy constructor.
|
| |
|
| TSparseArray (TSparseArray &&InCopy) |
| | Move constructor.
|
| |
|
| ~TSparseArray () |
| | Destructor.
|
| |
template<typename InElementType, typename Allocator>
class TSparseArray< InElementType, Allocator >
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).