Ark Server API 3.54
Serverside plugin support for Ark Survival Evolved.
Loading...
Searching...
No Matches
TArray< InElementType, InAllocator > Class Template Reference

#include <TArray.h>

Public Types

typedef InElementType ElementType
 
typedef InAllocator Allocator
 
typedef TIndexedContainerIterator< TArray, ElementType, int32TIterator
 
typedef TIndexedContainerIterator< const TArray, const ElementType, int32TConstIterator
 
typedef TCheckedPointerIterator< ElementTypeRangedForIteratorType
 
typedef TCheckedPointerIterator< const ElementTypeRangedForConstIteratorType
 

Public Member Functions

FORCEINLINE TArray ()
 
FORCEINLINE TArray (const ElementType *Ptr, int32 Count)
 
 TArray (std::initializer_list< InElementType > InitList)
 
template<typename OtherElementType , typename OtherAllocator >
FORCEINLINE TArray (const TArray< OtherElementType, OtherAllocator > &Other)
 
FORCEINLINE TArray (const TArray &Other)
 
FORCEINLINE TArray (const TArray &Other, int32 ExtraSlack)
 
TArrayoperator= (std::initializer_list< InElementType > InitList)
 
template<typename OtherAllocator >
TArrayoperator= (const TArray< ElementType, OtherAllocator > &Other)
 
TArrayoperator= (const TArray &Other)
 
FORCEINLINE TArray (TArray &&Other)
 
template<typename OtherElementType , typename OtherAllocator >
FORCEINLINE TArray (TArray< OtherElementType, OtherAllocator > &&Other)
 
template<typename OtherElementType >
 TArray (TArray< OtherElementType, Allocator > &&Other, int32 ExtraSlack)
 
TArrayoperator= (TArray &&Other)
 
 ~TArray ()
 
FORCEINLINE ElementTypeGetData () const
 
FORCEINLINE uint32 GetTypeSize () const
 
FORCEINLINE uint32 GetAllocatedSize (void) const
 
FORCEINLINE int32 GetSlack () const
 
FORCEINLINE void CheckInvariants () const
 
FORCEINLINE void RangeCheck (int32 Index) const
 
FORCEINLINE bool IsValidIndex (int32 Index) const
 
FORCEINLINE int32 Num () const
 
FORCEINLINE int32 Max () const
 
FORCEINLINE ElementTypeoperator[] (int32 Index)
 
FORCEINLINE const ElementTypeoperator[] (int32 Index) const
 
FORCEINLINE ElementType Pop (bool bAllowShrinking=true)
 
FORCEINLINE void Push (ElementType &&Item)
 
FORCEINLINE void Push (const ElementType &Item)
 
FORCEINLINE ElementTypeTop ()
 
FORCEINLINE const ElementTypeTop () const
 
FORCEINLINE ElementTypeLast (int32 IndexFromTheEnd=0)
 
FORCEINLINE const ElementTypeLast (int32 IndexFromTheEnd=0) const
 
FORCEINLINE void Shrink ()
 
FORCEINLINE bool Find (const ElementType &Item, int32 &Index) const
 
int32 Find (const ElementType &Item) const
 
FORCEINLINE bool FindLast (const ElementType &Item, int32 &Index) const
 
int32 FindLast (const ElementType &Item) const
 
template<typename Predicate >
int32 FindLastByPredicate (Predicate Pred, int32 Count) const
 
template<typename Predicate >
FORCEINLINE int32 FindLastByPredicate (Predicate Pred) const
 
template<typename KeyType >
int32 IndexOfByKey (const KeyType &Key) const
 
template<typename Predicate >
int32 IndexOfByPredicate (Predicate Pred) const
 
template<typename KeyType >
FORCEINLINE const ElementTypeFindByKey (const KeyType &Key) const
 
template<typename KeyType >
ElementTypeFindByKey (const KeyType &Key)
 
template<typename Predicate >
FORCEINLINE const ElementTypeFindByPredicate (Predicate Pred) const
 
template<typename Predicate >
ElementTypeFindByPredicate (Predicate Pred)
 
template<typename Predicate >
TArray< ElementTypeFilterByPredicate (Predicate Pred) const
 
template<typename ComparisonType >
bool Contains (const ComparisonType &Item) const
 
template<typename Predicate >
FORCEINLINE bool ContainsByPredicate (Predicate Pred) const
 
bool operator== (const TArray &OtherArray) const
 
FORCEINLINE bool operator!= (const TArray &OtherArray) const
 
FORCEINLINE int32 AddUninitialized (int32 Count=1)
 
void InsertUninitialized (int32 Index, int32 Count=1)
 
void InsertZeroed (int32 Index, int32 Count=1)
 
void InsertDefaulted (int32 Index, int32 Count=1)
 
int32 Insert (std::initializer_list< ElementType > InitList, const int32 InIndex)
 
int32 Insert (const TArray< ElementType > &Items, const int32 InIndex)
 
int32 Insert (const ElementType *Ptr, int32 Count, int32 Index)
 
FORCEINLINE void CheckAddress (const ElementType *Addr) const
 
int32 Insert (ElementType &&Item, int32 Index)
 
int32 Insert (const ElementType &Item, int32 Index)
 
FORCEINLINE void RemoveAt (int32 Index)
 
template<typename CountType >
FORCEINLINE void RemoveAt (int32 Index, CountType Count, bool bAllowShrinking=true)
 
void Reset (int32 NewSize=0)
 
void Empty (int32 Slack=0)
 
void SetNum (int32 NewNum, bool bAllowShrinking=true)
 
void SetNumZeroed (int32 NewNum, bool bAllowShrinking=true)
 
void SetNumUninitialized (int32 NewNum, bool bAllowShrinking=true)
 
void SetNumUnsafeInternal (int32 NewNum)
 
template<typename OtherElementType , typename OtherAllocator >
void Append (const TArray< OtherElementType, OtherAllocator > &Source)
 
template<typename OtherElementType , typename OtherAllocator >
void Append (TArray< OtherElementType, OtherAllocator > &&Source)
 
void Append (const ElementType *Ptr, int32 Count)
 
FORCEINLINE void Append (std::initializer_list< ElementType > InitList)
 
TArrayoperator+= (TArray &&Other)
 
TArrayoperator+= (const TArray &Other)
 
TArrayoperator+= (std::initializer_list< ElementType > InitList)
 
template<typename... ArgsType>
FORCEINLINE int32 Emplace (ArgsType &&... Args)
 
template<typename... ArgsType>
FORCEINLINE void EmplaceAt (int32 Index, ArgsType &&... Args)
 
FORCEINLINE int32 Add (ElementType &&Item)
 
FORCEINLINE int32 Add (const ElementType &Item)
 
int32 AddZeroed (int32 Count=1)
 
int32 AddDefaulted (int32 Count=1)
 
FORCEINLINE int32 AddUnique (ElementType &&Item)
 
FORCEINLINE int32 AddUnique (const ElementType &Item)
 
FORCEINLINE void Reserve (int32 Number)
 
void Init (const ElementType &Element, int32 Number)
 
int32 RemoveSingle (const ElementType &Item)
 
int32 Remove (const ElementType &Item)
 
template<class PREDICATE_CLASS >
int32 RemoveAll (const PREDICATE_CLASS &Predicate)
 
template<class PREDICATE_CLASS >
void RemoveAllSwap (const PREDICATE_CLASS &Predicate, bool bAllowShrinking=true)
 
int32 RemoveSingleSwap (const ElementType &Item, bool bAllowShrinking=true)
 
int32 RemoveSwap (const ElementType &Item)
 
FORCEINLINE void RemoveAtSwap (int32 Index)
 
template<typename CountType >
FORCEINLINE void RemoveAtSwap (int32 Index, CountType Count, bool bAllowShrinking=true)
 
TIterator CreateIterator ()
 
TConstIterator CreateConstIterator () const
 
void Sort ()
 
template<class PREDICATE_CLASS >
void Sort (const PREDICATE_CLASS &Predicate)
 
void StableSort ()
 
template<class PREDICATE_CLASS >
void StableSort (const PREDICATE_CLASS &Predicate)
 

Protected Types

typedef TChooseClass< Allocator::NeedsElementType, typenameAllocator::templateForElementType< ElementType >, typenameAllocator::ForAnyElementType >::Result ElementAllocatorType
 

Protected Attributes

ElementAllocatorType AllocatorInstance
 
int32 ArrayNum
 
int32 ArrayMax
 

Private Member Functions

void RemoveAtImpl (int32 Index, int32 Count, bool bAllowShrinking)
 
template<typename ArgsType >
int32 AddUniqueImpl (ArgsType &&Args)
 
void RemoveAtSwapImpl (int32 Index, int32 Count=1, bool bAllowShrinking=true)
 
FORCENOINLINE void ResizeGrow (int32 OldNum)
 
FORCENOINLINE void ResizeShrink ()
 
FORCENOINLINE void ResizeTo (int32 NewMax)
 
FORCENOINLINE void ResizeForCopy (int32 NewMax, int32 PrevMax)
 
template<typename OtherElementType >
void CopyToEmpty (const OtherElementType *OtherData, int32 OtherNum, int32 PrevMax, int32 ExtraSlack)
 

Static Private Member Functions

template<typename FromArrayType , typename ToArrayType >
static FORCEINLINE TEnableIf< UE4Array_Private::TCanMoveTArrayPointersBetweenArrayTypes< FromArrayType, ToArrayType >::Value >::Type MoveOrCopy (ToArrayType &ToArray, FromArrayType &FromArray, int32 PrevMax)
 
template<typename FromArrayType , typename ToArrayType >
static FORCEINLINE TEnableIf<!UE4Array_Private::TCanMoveTArrayPointersBetweenArrayTypes< FromArrayType, ToArrayType >::Value >::Type MoveOrCopy (ToArrayType &ToArray, FromArrayType &FromArray, int32 PrevMax)
 
template<typename FromArrayType , typename ToArrayType >
static FORCEINLINE TEnableIf< UE4Array_Private::TCanMoveTArrayPointersBetweenArrayTypes< FromArrayType, ToArrayType >::Value >::Type MoveOrCopyWithSlack (ToArrayType &ToArray, FromArrayType &FromArray, int32 PrevMax, int32 ExtraSlack)
 
template<typename FromArrayType , typename ToArrayType >
static FORCEINLINE TEnableIf<!UE4Array_Private::TCanMoveTArrayPointersBetweenArrayTypes< FromArrayType, ToArrayType >::Value >::Type MoveOrCopyWithSlack (ToArrayType &ToArray, FromArrayType &FromArray, int32 PrevMax, int32 ExtraSlack)
 

Friends

template<typename OtherInElementType , typename OtherAllocator >
class TArray
 
FORCEINLINE friend RangedForIteratorType begin (TArray &Array)
 
FORCEINLINE friend RangedForConstIteratorType begin (const TArray &Array)
 
FORCEINLINE friend RangedForIteratorType end (TArray &Array)
 
FORCEINLINE friend RangedForConstIteratorType end (const TArray &Array)
 

Detailed Description

template<typename InElementType, typename InAllocator>
class TArray< InElementType, InAllocator >

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.

Definition at line 267 of file TArray.h.

Member Typedef Documentation

◆ Allocator

template<typename InElementType , typename InAllocator >
typedef InAllocator TArray< InElementType, InAllocator >::Allocator

Definition at line 275 of file TArray.h.

◆ ElementAllocatorType

template<typename InElementType , typename InAllocator >
typedef TChooseClass<Allocator::NeedsElementType,typenameAllocator::templateForElementType<ElementType>,typenameAllocator::ForAnyElementType>::Result TArray< InElementType, InAllocator >::ElementAllocatorType
protected

Definition at line 2105 of file TArray.h.

◆ ElementType

template<typename InElementType , typename InAllocator >
typedef InElementType TArray< InElementType, InAllocator >::ElementType

Definition at line 274 of file TArray.h.

◆ RangedForConstIteratorType

template<typename InElementType , typename InAllocator >
typedef TCheckedPointerIterator<const ElementType> TArray< InElementType, InAllocator >::RangedForConstIteratorType

Definition at line 1930 of file TArray.h.

◆ RangedForIteratorType

template<typename InElementType , typename InAllocator >
typedef TCheckedPointerIterator< ElementType> TArray< InElementType, InAllocator >::RangedForIteratorType

Definition at line 1929 of file TArray.h.

◆ TConstIterator

template<typename InElementType , typename InAllocator >
typedef TIndexedContainerIterator<const TArray, const ElementType, int32> TArray< InElementType, InAllocator >::TConstIterator

Definition at line 1906 of file TArray.h.

◆ TIterator

template<typename InElementType , typename InAllocator >
typedef TIndexedContainerIterator< TArray, ElementType, int32> TArray< InElementType, InAllocator >::TIterator

Definition at line 1905 of file TArray.h.

Constructor & Destructor Documentation

◆ TArray() [1/9]

template<typename InElementType , typename InAllocator >
FORCEINLINE TArray< InElementType, InAllocator >::TArray ( )
inline

Constructor, initializes element number counters.

Definition at line 280 of file TArray.h.

◆ TArray() [2/9]

template<typename InElementType , typename InAllocator >
FORCEINLINE TArray< InElementType, InAllocator >::TArray ( const ElementType Ptr,
int32  Count 
)
inline

Constructor from a raw array of elements.

Parameters
PtrA pointer to an array of elements to copy.
CountThe number of elements to copy from Ptr.
See also
Append

Definition at line 292 of file TArray.h.

References check, and TArray< InElementType, InAllocator >::CopyToEmpty().

◆ TArray() [3/9]

template<typename InElementType , typename InAllocator >
TArray< InElementType, InAllocator >::TArray ( std::initializer_list< InElementType >  InitList)
inline

Initializer list constructor

Definition at line 302 of file TArray.h.

References TArray< InElementType, InAllocator >::CopyToEmpty().

◆ TArray() [4/9]

template<typename InElementType , typename InAllocator >
template<typename OtherElementType , typename OtherAllocator >
FORCEINLINE TArray< InElementType, InAllocator >::TArray ( const TArray< OtherElementType, OtherAllocator > &  Other)
inlineexplicit

Copy constructor with changed allocator. Use the common routine to perform the copy.

Parameters
OtherThe source array to copy.

Definition at line 316 of file TArray.h.

References TArray< InElementType, InAllocator >::CopyToEmpty().

◆ TArray() [5/9]

template<typename InElementType , typename InAllocator >
FORCEINLINE TArray< InElementType, InAllocator >::TArray ( const TArray< InElementType, InAllocator > &  Other)
inline

Copy constructor. Use the common routine to perform the copy.

Parameters
OtherThe source array to copy.

Definition at line 326 of file TArray.h.

References TArray< InElementType, InAllocator >::CopyToEmpty().

◆ TArray() [6/9]

template<typename InElementType , typename InAllocator >
FORCEINLINE TArray< InElementType, InAllocator >::TArray ( const TArray< InElementType, InAllocator > &  Other,
int32  ExtraSlack 
)
inline

Copy constructor. Use the common routine to perform the copy.

Parameters
OtherThe source array to copy.
ExtraSlackTells how much extra memory should be preallocated at the end of the array in the number of elements.

Definition at line 338 of file TArray.h.

References TArray< InElementType, InAllocator >::CopyToEmpty().

◆ TArray() [7/9]

template<typename InElementType , typename InAllocator >
FORCEINLINE TArray< InElementType, InAllocator >::TArray ( TArray< InElementType, InAllocator > &&  Other)
inline

Move constructor.

Parameters
OtherArray to move from.

Definition at line 468 of file TArray.h.

References TArray< InElementType, InAllocator >::MoveOrCopy().

◆ TArray() [8/9]

template<typename InElementType , typename InAllocator >
template<typename OtherElementType , typename OtherAllocator >
FORCEINLINE TArray< InElementType, InAllocator >::TArray ( TArray< OtherElementType, OtherAllocator > &&  Other)
inlineexplicit

Move constructor.

Parameters
OtherArray to move from.

Definition at line 479 of file TArray.h.

References TArray< InElementType, InAllocator >::MoveOrCopy().

◆ TArray() [9/9]

template<typename InElementType , typename InAllocator >
template<typename OtherElementType >
TArray< InElementType, InAllocator >::TArray ( TArray< OtherElementType, Allocator > &&  Other,
int32  ExtraSlack 
)
inline

Move constructor.

Parameters
OtherArray to move from.
ExtraSlackTells how much extra memory should be preallocated at the end of the array in the number of elements.

Definition at line 492 of file TArray.h.

References TArray< InElementType, InAllocator >::MoveOrCopyWithSlack().

◆ ~TArray()

template<typename InElementType , typename InAllocator >
TArray< InElementType, InAllocator >::~TArray ( )
inline

Member Function Documentation

◆ Add() [1/2]

template<typename InElementType , typename InAllocator >
FORCEINLINE int32 TArray< InElementType, InAllocator >::Add ( const ElementType Item)
inline

Adds a new item to the end of the array, possibly reallocating the whole array to fit.

Parameters
ItemThe item to add
Returns
Index to the new item
See also
AddDefaulted, AddUnique, AddZeroed, Append, Insert

Definition at line 1564 of file TArray.h.

References TArray< InElementType, InAllocator >::CheckAddress(), and TArray< InElementType, InAllocator >::Emplace().

◆ Add() [2/2]

◆ AddDefaulted()

template<typename InElementType , typename InAllocator >
int32 TArray< InElementType, InAllocator >::AddDefaulted ( int32  Count = 1)
inline

Adds new items to the end of the array, possibly reallocating the whole array to fit. The new items will be default-constructed.

Parameters
CountThe number of new items to add.
Returns
Index to the first of the new items.
See also
Add, AddZeroed, AddUnique, Append, Insert

Definition at line 1593 of file TArray.h.

References TArray< InElementType, InAllocator >::AddUninitialized(), and TArray< InElementType, InAllocator >::AllocatorInstance.

◆ AddUninitialized()

◆ AddUnique() [1/2]

template<typename InElementType , typename InAllocator >
FORCEINLINE int32 TArray< InElementType, InAllocator >::AddUnique ( const ElementType Item)
inline

Adds unique element to array if it doesn't exist.

Parameters
ArgsItem to add.
Returns
Index of the element in the array.
See also
Add, AddDefaulted, AddZeroed, Append, Insert

Definition at line 1640 of file TArray.h.

References TArray< InElementType, InAllocator >::AddUniqueImpl().

◆ AddUnique() [2/2]

template<typename InElementType , typename InAllocator >
FORCEINLINE int32 TArray< InElementType, InAllocator >::AddUnique ( ElementType &&  Item)
inline

Adds unique element to array if it doesn't exist.

Move semantics version.

Parameters
ArgsItem to add.
Returns
Index of the element in the array.
See also
Add, AddDefaulted, AddZeroed, Append, Insert

Definition at line 1631 of file TArray.h.

References TArray< InElementType, InAllocator >::AddUniqueImpl(), and MoveTempIfPossible().

◆ AddUniqueImpl()

template<typename InElementType , typename InAllocator >
template<typename ArgsType >
int32 TArray< InElementType, InAllocator >::AddUniqueImpl ( ArgsType &&  Args)
inlineprivate

Adds unique element to array if it doesn't exist.

Parameters
ArgsItem to add.
Returns
Index of the element in the array.

Definition at line 1609 of file TArray.h.

References TArray< InElementType, InAllocator >::Add(), and TArray< InElementType, InAllocator >::Find().

Referenced by TArray< InElementType, InAllocator >::AddUnique().

◆ AddZeroed()

template<typename InElementType , typename InAllocator >
int32 TArray< InElementType, InAllocator >::AddZeroed ( int32  Count = 1)
inline

Adds new items to the end of the array, possibly reallocating the whole array to fit. The new items will be zeroed.

Caution, AddZeroed() will create elements without calling the constructor and this is not appropriate for element types that require a constructor to function properly.

Parameters
CountThe number of new items to add.
Returns
Index to the first of the new items.
See also
Add, AddDefaulted, AddUnique, Append, Insert

Definition at line 1578 of file TArray.h.

References TArray< InElementType, InAllocator >::AddUninitialized(), TArray< InElementType, InAllocator >::AllocatorInstance, and FMemory::Memzero().

Referenced by TArray< InElementType, InAllocator >::SetNumZeroed().

◆ Append() [1/4]

template<typename InElementType , typename InAllocator >
void TArray< InElementType, InAllocator >::Append ( const ElementType Ptr,
int32  Count 
)
inline

Adds a raw array of elements to the end of the TArray.

Parameters
PtrA pointer to an array of elements to add.
CountThe number of elements to insert from Ptr.
See also
Add, Insert

Definition at line 1460 of file TArray.h.

References TArray< InElementType, InAllocator >::AddUninitialized(), check, and TArray< InElementType, InAllocator >::GetData().

◆ Append() [2/4]

template<typename InElementType , typename InAllocator >
template<typename OtherElementType , typename OtherAllocator >
void TArray< InElementType, InAllocator >::Append ( const TArray< OtherElementType, OtherAllocator > &  Source)
inline

Appends the specified array to this array.

Allocator changing version.

Parameters
SourceThe array to append.
See also
Add, Insert

Definition at line 1407 of file TArray.h.

References TArray< InElementType, InAllocator >::ArrayNum, check, TArray< InElementType, InAllocator >::GetData(), TArray< InElementType, InAllocator >::Num(), and TArray< InElementType, InAllocator >::Reserve().

Referenced by TArray< InElementType, InAllocator >::operator+=(), and FString::PathAppend().

◆ Append() [3/4]

template<typename InElementType , typename InAllocator >
FORCEINLINE void TArray< InElementType, InAllocator >::Append ( std::initializer_list< ElementType InitList)
inline

Adds an initializer list of elements to the end of the TArray.

Parameters
InitListThe initializer list of elements to add.
See also
Add, Insert

Definition at line 1474 of file TArray.h.

References TArray< InElementType, InAllocator >::AddUninitialized(), and TArray< InElementType, InAllocator >::GetData().

◆ Append() [4/4]

template<typename InElementType , typename InAllocator >
template<typename OtherElementType , typename OtherAllocator >
void TArray< InElementType, InAllocator >::Append ( TArray< OtherElementType, OtherAllocator > &&  Source)
inline

Appends the specified array to this array.

Parameters
SourceThe array to append.
See also
Add, Insert

Definition at line 1433 of file TArray.h.

References TArray< InElementType, InAllocator >::ArrayNum, check, TArray< InElementType, InAllocator >::GetData(), and TArray< InElementType, InAllocator >::Reserve().

◆ CheckAddress()

template<typename InElementType , typename InAllocator >
FORCEINLINE void TArray< InElementType, InAllocator >::CheckAddress ( const ElementType Addr) const
inline

Checks that the specified address is not part of an element within the container. Used for implementations to check that reference arguments aren't going to be invalidated by possible reallocation.

Parameters
AddrThe address to check.
See also
Add, Remove

Definition at line 1193 of file TArray.h.

References TArray< InElementType, InAllocator >::ArrayMax, TArray< InElementType, InAllocator >::ArrayNum, checkf, and TArray< InElementType, InAllocator >::GetData().

Referenced by TArray< InElementType, InAllocator >::Add(), TSparseArray< InElementType, Allocator >::CheckAddress(), TArray< InElementType, InAllocator >::Insert(), TArray< InElementType, InAllocator >::Remove(), and TArray< InElementType, InAllocator >::RemoveSwap().

◆ CheckInvariants()

template<typename InElementType , typename InAllocator >
FORCEINLINE void TArray< InElementType, InAllocator >::CheckInvariants ( ) const
inline

◆ Contains()

template<typename InElementType , typename InAllocator >
template<typename ComparisonType >
bool TArray< InElementType, InAllocator >::Contains ( const ComparisonType &  Item) const
inline

Checks if this array contains the element.

Returns
True if found. False otherwise.
See also
ContainsByPredicate, FilterByPredicate, FindByPredicate

Definition at line 992 of file TArray.h.

References TArray< InElementType, InAllocator >::ArrayNum, TArray< InElementType, InAllocator >::GetData(), and RESTRICT.

Referenced by FString::ReplaceCharWithEscapedChar(), and FString::ReplaceEscapedCharWithChar().

◆ ContainsByPredicate()

template<typename InElementType , typename InAllocator >
template<typename Predicate >
FORCEINLINE bool TArray< InElementType, InAllocator >::ContainsByPredicate ( Predicate  Pred) const
inline

Checks if this array contains element for which the predicate is true.

Parameters
Predicateto use
Returns
True if found. False otherwise.
See also
Contains, Find

Definition at line 1012 of file TArray.h.

References TArray< InElementType, InAllocator >::FindByPredicate().

◆ CopyToEmpty()

template<typename InElementType , typename InAllocator >
template<typename OtherElementType >
void TArray< InElementType, InAllocator >::CopyToEmpty ( const OtherElementType *  OtherData,
int32  OtherNum,
int32  PrevMax,
int32  ExtraSlack 
)
inlineprivate

Copies data from one array into this array. Uses the fast path if the data in question does not need a constructor.

Parameters
SourceThe source array to copy
PrevMaxThe previous allocated size
ExtraSlackAdditional amount of memory to allocate at the end of the buffer. Counted in elements. Zero by default.

Definition at line 2084 of file TArray.h.

References TArray< InElementType, InAllocator >::ArrayMax, TArray< InElementType, InAllocator >::ArrayNum, checkSlow, TArray< InElementType, InAllocator >::GetData(), and TArray< InElementType, InAllocator >::ResizeForCopy().

Referenced by TArray< InElementType, InAllocator >::operator=(), and TArray< InElementType, InAllocator >::TArray().

◆ CreateConstIterator()

template<typename InElementType , typename InAllocator >
TConstIterator TArray< InElementType, InAllocator >::CreateConstIterator ( ) const
inline

Creates a const iterator for the contents of this array

Returns
The const iterator.

Definition at line 1923 of file TArray.h.

Referenced by FString::CreateConstIterator().

◆ CreateIterator()

template<typename InElementType , typename InAllocator >
TIterator TArray< InElementType, InAllocator >::CreateIterator ( )
inline

Creates an iterator for the contents of this array

Returns
The iterator.

Definition at line 1913 of file TArray.h.

Referenced by FString::CreateIterator().

◆ Emplace()

template<typename InElementType , typename InAllocator >
template<typename... ArgsType>
FORCEINLINE int32 TArray< InElementType, InAllocator >::Emplace ( ArgsType &&...  Args)
inline

Constructs a new item at the end of the array, possibly reallocating the whole array to fit.

Parameters
ArgsThe arguments to forward to the constructor of the new item.
Returns
Index to the new item

Definition at line 1526 of file TArray.h.

References TArray< InElementType, InAllocator >::AddUninitialized(), and TArray< InElementType, InAllocator >::GetData().

Referenced by TArray< InElementType, InAllocator >::Add(), and FString::ParseIntoArray().

◆ EmplaceAt()

template<typename InElementType , typename InAllocator >
template<typename... ArgsType>
FORCEINLINE void TArray< InElementType, InAllocator >::EmplaceAt ( int32  Index,
ArgsType &&...  Args 
)
inline

Constructs a new item at a specified index, possibly reallocating the whole array to fit.

Parameters
IndexThe index to add the item at.
ArgsThe arguments to forward to the constructor of the new item.

Definition at line 1540 of file TArray.h.

References TArray< InElementType, InAllocator >::GetData(), and TArray< InElementType, InAllocator >::InsertUninitialized().

◆ Empty()

◆ FilterByPredicate()

template<typename InElementType , typename InAllocator >
template<typename Predicate >
TArray< ElementType > TArray< InElementType, InAllocator >::FilterByPredicate ( Predicate  Pred) const
inline

Filters the elements in the array based on a predicate functor.

Parameters
PredThe functor to apply to each element.
Returns
TArray with the same type as this object which contains the subset of elements for which the functor returns true.
See also
FindByPredicate, ContainsByPredicate

Definition at line 972 of file TArray.h.

References TArray< InElementType, InAllocator >::Add(), TArray< InElementType, InAllocator >::ArrayNum, TArray< InElementType, InAllocator >::GetData(), and RESTRICT.

◆ Find() [1/2]

template<typename InElementType , typename InAllocator >
int32 TArray< InElementType, InAllocator >::Find ( const ElementType Item) const
inline

Finds element within the array.

Parameters
ItemItem to look for.
Returns
Index of the found element. INDEX_NONE otherwise.
See also
FindLast, FindLastByPredicate

Definition at line 773 of file TArray.h.

References TArray< InElementType, InAllocator >::ArrayNum, TArray< InElementType, InAllocator >::GetData(), INDEX_NONE, and RESTRICT.

◆ Find() [2/2]

template<typename InElementType , typename InAllocator >
FORCEINLINE bool TArray< InElementType, InAllocator >::Find ( const ElementType Item,
int32 Index 
) const
inline

Finds element within the array.

Parameters
ItemItem to look for.
IndexWill contain the found index.
Returns
True if found. False otherwise.
See also
FindLast, FindLastByPredicate

Definition at line 760 of file TArray.h.

References TArray< InElementType, InAllocator >::Find(), and INDEX_NONE.

Referenced by TArray< InElementType, InAllocator >::AddUniqueImpl(), TArray< InElementType, InAllocator >::Find(), FString::FindChar(), TArray< InElementType, InAllocator >::RemoveSingle(), and TArray< InElementType, InAllocator >::RemoveSingleSwap().

◆ FindByKey() [1/2]

template<typename InElementType , typename InAllocator >
template<typename KeyType >
ElementType * TArray< InElementType, InAllocator >::FindByKey ( const KeyType &  Key)
inline

Finds an item by key (assuming the ElementType overloads operator== for the comparison). Time Complexity: O(n), starts iteration from the beginning so better performance if Key is in the front

Parameters
KeyThe key to search by.
Returns
Pointer to the first matching element, or nullptr if none is found.
See also
Find

Definition at line 917 of file TArray.h.

References TArray< InElementType, InAllocator >::ArrayNum, TArray< InElementType, InAllocator >::GetData(), and RESTRICT.

◆ FindByKey() [2/2]

template<typename InElementType , typename InAllocator >
template<typename KeyType >
FORCEINLINE const ElementType * TArray< InElementType, InAllocator >::FindByKey ( const KeyType &  Key) const
inline

Finds an item by key (assuming the ElementType overloads operator== for the comparison).

Parameters
KeyThe key to search by.
Returns
Pointer to the first matching element, or nullptr if none is found.
See also
Find

Definition at line 903 of file TArray.h.

References TArray< InElementType, InAllocator >::FindByKey().

Referenced by TArray< InElementType, InAllocator >::FindByKey().

◆ FindByPredicate() [1/2]

template<typename InElementType , typename InAllocator >
template<typename Predicate >
ElementType * TArray< InElementType, InAllocator >::FindByPredicate ( Predicate  Pred)
inline

Finds an element which matches a predicate functor.

Parameters
PredThe functor to apply to each element. true, or nullptr if none is found.
See also
FilterByPredicate, ContainsByPredicate

Definition at line 950 of file TArray.h.

References TArray< InElementType, InAllocator >::ArrayNum, TArray< InElementType, InAllocator >::GetData(), and RESTRICT.

◆ FindByPredicate() [2/2]

template<typename InElementType , typename InAllocator >
template<typename Predicate >
FORCEINLINE const ElementType * TArray< InElementType, InAllocator >::FindByPredicate ( Predicate  Pred) const
inline

Finds an element which matches a predicate functor.

Parameters
PredThe functor to apply to each element.
Returns
Pointer to the first element for which the predicate returns true, or nullptr if none is found.
See also
FilterByPredicate, ContainsByPredicate

Definition at line 938 of file TArray.h.

References TArray< InElementType, InAllocator >::FindByPredicate().

Referenced by TArray< InElementType, InAllocator >::ContainsByPredicate(), and TArray< InElementType, InAllocator >::FindByPredicate().

◆ FindLast() [1/2]

template<typename InElementType , typename InAllocator >
int32 TArray< InElementType, InAllocator >::FindLast ( const ElementType Item) const
inline

Finds element within the array starting from the end.

Parameters
ItemItem to look for.
Returns
Index of the found element. INDEX_NONE otherwise.

Definition at line 806 of file TArray.h.

References TArray< InElementType, InAllocator >::ArrayNum, TArray< InElementType, InAllocator >::GetData(), INDEX_NONE, and RESTRICT.

◆ FindLast() [2/2]

template<typename InElementType , typename InAllocator >
FORCEINLINE bool TArray< InElementType, InAllocator >::FindLast ( const ElementType Item,
int32 Index 
) const
inline

Finds element within the array starting from the end.

Parameters
ItemItem to look for.
IndexOutput parameter. Found index.
Returns
True if found. False otherwise.
See also
Find, FindLastByPredicate

Definition at line 794 of file TArray.h.

References TArray< InElementType, InAllocator >::FindLast(), and INDEX_NONE.

Referenced by TArray< InElementType, InAllocator >::FindLast(), and FString::FindLastChar().

◆ FindLastByPredicate() [1/2]

template<typename InElementType , typename InAllocator >
template<typename Predicate >
FORCEINLINE int32 TArray< InElementType, InAllocator >::FindLastByPredicate ( Predicate  Pred) const
inline

Searches the array for the last occurrence of an element which matches the specified predicate.

Parameters
PredPredicate taking array element and returns true if element matches search criteria, false otherwise.
Returns
Index of the found element. INDEX_NONE otherwise.

Definition at line 848 of file TArray.h.

References TArray< InElementType, InAllocator >::ArrayNum, and TArray< InElementType, InAllocator >::FindLastByPredicate().

◆ FindLastByPredicate() [2/2]

template<typename InElementType , typename InAllocator >
template<typename Predicate >
int32 TArray< InElementType, InAllocator >::FindLastByPredicate ( Predicate  Pred,
int32  Count 
) const
inline

Searches an initial subrange of the array for the last occurrence of an element which matches the specified predicate.

Parameters
PredPredicate taking array element and returns true if element matches search criteria, false otherwise.
CountThe number of elements from the front of the array through which to search.
Returns
Index of the found element. INDEX_NONE otherwise.

Definition at line 827 of file TArray.h.

References check, TArray< InElementType, InAllocator >::GetData(), INDEX_NONE, TArray< InElementType, InAllocator >::Num(), and RESTRICT.

Referenced by TArray< InElementType, InAllocator >::FindLastByPredicate(), and FString::FindLastCharByPredicate().

◆ GetAllocatedSize()

template<typename InElementType , typename InAllocator >
FORCEINLINE uint32 TArray< InElementType, InAllocator >::GetAllocatedSize ( void  ) const
inline

Helper function to return the amount of memory allocated by this container.

Returns
Number of bytes allocated by this container.

Definition at line 554 of file TArray.h.

References TArray< InElementType, InAllocator >::AllocatorInstance, and TArray< InElementType, InAllocator >::ArrayMax.

Referenced by FString::GetAllocatedSize().

◆ GetData()

template<typename InElementType , typename InAllocator >
FORCEINLINE ElementType * TArray< InElementType, InAllocator >::GetData ( ) const
inline

Helper function for returning a typed pointer to the first array entry.

Returns
Pointer to first array entry or nullptr if ArrayMax == 0.

Definition at line 533 of file TArray.h.

References TArray< InElementType, InAllocator >::AllocatorInstance.

Referenced by TArray< InElementType, InAllocator >::Append(), FString::AppendChars(), TArray< InElementType, InAllocator >::CheckAddress(), TSparseArray< InElementType, Allocator >::Compact(), FString::ConcatTCHARsToFString(), TArray< InElementType, InAllocator >::Contains(), TArray< InElementType, InAllocator >::CopyToEmpty(), TArray< InElementType, InAllocator >::Emplace(), TArray< InElementType, InAllocator >::EmplaceAt(), TArray< InElementType, InAllocator >::Empty(), FString::EndsWith(), TArray< InElementType, InAllocator >::FilterByPredicate(), TArray< InElementType, InAllocator >::Find(), TArray< InElementType, InAllocator >::FindByKey(), TArray< InElementType, InAllocator >::FindByPredicate(), TArray< InElementType, InAllocator >::FindLast(), TArray< InElementType, InAllocator >::FindLastByPredicate(), FString::FString(), TIndirectArray< T, Allocator >::GetData(), TSparseArray< InElementType, Allocator >::GetData(), TArray< InElementType, InAllocator >::IndexOfByKey(), TArray< InElementType, InAllocator >::IndexOfByPredicate(), TArray< InElementType, InAllocator >::Insert(), FString::InsertAt(), TArray< InElementType, InAllocator >::InsertUninitialized(), FString::IsNumeric(), TArray< InElementType, InAllocator >::Last(), FString::operator*(), FString::operator+=(), FString::operator/=(), FString::operator=(), TSparseArray< InElementType, Allocator >::operator=(), TArray< InElementType, InAllocator >::operator=(), TArray< InElementType, InAllocator >::operator==(), FString::operator[](), TArray< InElementType, InAllocator >::operator[](), FString::ParseIntoArray(), TArray< InElementType, InAllocator >::Pop(), TArray< InElementType, InAllocator >::RemoveAll(), TArray< InElementType, InAllocator >::RemoveAtImpl(), TArray< InElementType, InAllocator >::RemoveAtSwapImpl(), TArray< InElementType, InAllocator >::RemoveSingle(), FString::Replace(), TArray< InElementType, InAllocator >::Reset(), TArray< InElementType, InAllocator >::Sort(), TArray< InElementType, InAllocator >::StableSort(), FString::ToLowerInline(), FString::ToString(), FString::ToUpperInline(), FString::TrimToNullTerminator(), and TArray< InElementType, InAllocator >::~TArray().

◆ GetSlack()

template<typename InElementType , typename InAllocator >
FORCEINLINE int32 TArray< InElementType, InAllocator >::GetSlack ( ) const
inline

Returns the amount of slack in this array in elements.

See also
Num, Shrink

Definition at line 564 of file TArray.h.

References TArray< InElementType, InAllocator >::ArrayMax, and TArray< InElementType, InAllocator >::ArrayNum.

Referenced by TSparseArray< InElementType, Allocator >::GetAllocatedSize().

◆ GetTypeSize()

template<typename InElementType , typename InAllocator >
FORCEINLINE uint32 TArray< InElementType, InAllocator >::GetTypeSize ( ) const
inline

Helper function returning the size of the inner type.

Returns
Size in bytes of array type.

Definition at line 543 of file TArray.h.

◆ IndexOfByKey()

template<typename InElementType , typename InAllocator >
template<typename KeyType >
int32 TArray< InElementType, InAllocator >::IndexOfByKey ( const KeyType &  Key) const
inline

Finds an item by key (assuming the ElementType overloads operator== for the comparison).

Parameters
KeyThe key to search by.
Returns
Index to the first matching element, or INDEX_NONE if none is found.

Definition at line 861 of file TArray.h.

References TArray< InElementType, InAllocator >::ArrayNum, TArray< InElementType, InAllocator >::GetData(), INDEX_NONE, and RESTRICT.

◆ IndexOfByPredicate()

template<typename InElementType , typename InAllocator >
template<typename Predicate >
int32 TArray< InElementType, InAllocator >::IndexOfByPredicate ( Predicate  Pred) const
inline

Finds an item by predicate.

Parameters
PredThe predicate to match.
Returns
Index to the first matching element, or INDEX_NONE if none is found.

Definition at line 881 of file TArray.h.

References TArray< InElementType, InAllocator >::ArrayNum, TArray< InElementType, InAllocator >::GetData(), INDEX_NONE, and RESTRICT.

◆ Init()

template<typename InElementType , typename InAllocator >
void TArray< InElementType, InAllocator >::Init ( const ElementType Element,
int32  Number 
)
inline

Sets the size of the array, filling it with the given element.

Parameters
ElementThe element to fill array with.
NumberThe number of elements that the array should be able to contain after allocation.

Definition at line 1662 of file TArray.h.

References TArray< InElementType, InAllocator >::Empty().

◆ Insert() [1/5]

template<typename InElementType , typename InAllocator >
int32 TArray< InElementType, InAllocator >::Insert ( const ElementType Item,
int32  Index 
)
inline

Inserts a given element into the array at given location.

Parameters
ItemThe element to insert.
IndexTells where to insert the new elements.
Returns
Location at which the insert was done.
See also
Add, Remove

Definition at line 1226 of file TArray.h.

References TArray< InElementType, InAllocator >::CheckAddress(), TArray< InElementType, InAllocator >::GetData(), and TArray< InElementType, InAllocator >::InsertUninitialized().

◆ Insert() [2/5]

template<typename InElementType , typename InAllocator >
int32 TArray< InElementType, InAllocator >::Insert ( const ElementType Ptr,
int32  Count,
int32  Index 
)
inline

Inserts a raw array of elements at a particular index in the TArray.

Parameters
PtrA pointer to an array of elements to add.
CountThe number of elements to insert from Ptr.
IndexThe index to insert the elements at.
Returns
The index of the first element inserted.
See also
Add, Remove

Definition at line 1175 of file TArray.h.

References check, TArray< InElementType, InAllocator >::GetData(), and TArray< InElementType, InAllocator >::InsertUninitialized().

◆ Insert() [3/5]

template<typename InElementType , typename InAllocator >
int32 TArray< InElementType, InAllocator >::Insert ( const TArray< ElementType > &  Items,
const int32  InIndex 
)
inline

Inserts given elements into the array at given location.

Parameters
ItemsArray of elements to insert.
InIndexTells where to insert the new elements.
Returns
Location at which the item was inserted.

Definition at line 1150 of file TArray.h.

References TArray< InElementType, InAllocator >::AllocatorInstance, check, and TArray< InElementType, InAllocator >::InsertUninitialized().

◆ Insert() [4/5]

template<typename InElementType , typename InAllocator >
int32 TArray< InElementType, InAllocator >::Insert ( ElementType &&  Item,
int32  Index 
)
inline

Inserts a given element into the array at given location. Move semantics version.

Parameters
ItemThe element to insert.
IndexTells where to insert the new elements.
Returns
Location at which the insert was done.
See also
Add, Remove

Definition at line 1207 of file TArray.h.

References TArray< InElementType, InAllocator >::CheckAddress(), TArray< InElementType, InAllocator >::GetData(), TArray< InElementType, InAllocator >::InsertUninitialized(), and MoveTempIfPossible().

◆ Insert() [5/5]

template<typename InElementType , typename InAllocator >
int32 TArray< InElementType, InAllocator >::Insert ( std::initializer_list< ElementType InitList,
const int32  InIndex 
)
inline

Inserts given elements into the array at given location.

Parameters
ItemsArray of elements to insert.
InIndexTells where to insert the new elements.
Returns
Location at which the item was inserted.

Definition at line 1129 of file TArray.h.

References TArray< InElementType, InAllocator >::AllocatorInstance, and TArray< InElementType, InAllocator >::InsertUninitialized().

Referenced by TIndirectArray< T, Allocator >::Insert(), and FString::InsertAt().

◆ InsertDefaulted()

template<typename InElementType , typename InAllocator >
void TArray< InElementType, InAllocator >::InsertDefaulted ( int32  Index,
int32  Count = 1 
)
inline

Inserts a given number of default-constructed elements into the array at a given location.

Parameters
IndexTells where to insert the new elements.
CountNumber of elements to add.
See also
Insert, InsertUninitialized, InsertZeroed

Definition at line 1116 of file TArray.h.

References TArray< InElementType, InAllocator >::AllocatorInstance, and TArray< InElementType, InAllocator >::InsertUninitialized().

◆ InsertUninitialized()

template<typename InElementType , typename InAllocator >
void TArray< InElementType, InAllocator >::InsertUninitialized ( int32  Index,
int32  Count = 1 
)
inline

Inserts a given number of uninitialized elements into the array at given location.

Caution, InsertUninitialized() will create elements without calling the constructor and this is not appropriate for element types that require a constructor to function properly.

Parameters
IndexTells where to insert the new elements.
CountNumber of elements to add.
See also
Insert, InsertZeroed, InsertDefaulted

Definition at line 1076 of file TArray.h.

References TArray< InElementType, InAllocator >::ArrayMax, TArray< InElementType, InAllocator >::ArrayNum, TArray< InElementType, InAllocator >::CheckInvariants(), checkSlow, TArray< InElementType, InAllocator >::GetData(), and TArray< InElementType, InAllocator >::ResizeGrow().

Referenced by TArray< InElementType, InAllocator >::EmplaceAt(), TArray< InElementType, InAllocator >::Insert(), TArray< InElementType, InAllocator >::InsertDefaulted(), and TArray< InElementType, InAllocator >::InsertZeroed().

◆ InsertZeroed()

template<typename InElementType , typename InAllocator >
void TArray< InElementType, InAllocator >::InsertZeroed ( int32  Index,
int32  Count = 1 
)
inline

Inserts a given number of zeroed elements into the array at given location.

Caution, InsertZeroed() will create elements without calling the constructor and this is not appropriate for element types that require a constructor to function properly.

Parameters
IndexTells where to insert the new elements.
CountNumber of elements to add.
See also
Insert, InsertUninitialized, InsertDefaulted

Definition at line 1102 of file TArray.h.

References TArray< InElementType, InAllocator >::AllocatorInstance, TArray< InElementType, InAllocator >::InsertUninitialized(), and FMemory::Memzero().

◆ IsValidIndex()

template<typename InElementType , typename InAllocator >
FORCEINLINE bool TArray< InElementType, InAllocator >::IsValidIndex ( int32  Index) const
inline

Tests if index is valid, i.e. greater than or equal to zero, and less than the number of elements in the array.

Parameters
IndexIndex to test.
Returns
True if index is valid. False otherwise.

Definition at line 600 of file TArray.h.

References TArray< InElementType, InAllocator >::ArrayNum.

Referenced by ArkApi::Commands::CheckCommands(), TIndirectArray< T, Allocator >::IsValidIndex(), API::ArkBaseApi::LoadPlugin(), API::AtlasBaseApi::LoadPlugin(), API::ArkBaseApi::UnloadPlugin(), and API::AtlasBaseApi::UnloadPlugin().

◆ Last() [1/2]

template<typename InElementType , typename InAllocator >
FORCEINLINE ElementType & TArray< InElementType, InAllocator >::Last ( int32  IndexFromTheEnd = 0)
inline

Returns n-th last element from the array.

Parameters
IndexFromTheEnd(Optional) Index from the end of array (default = 0).
Returns
Reference to n-th last element from the array.

Definition at line 718 of file TArray.h.

References TArray< InElementType, InAllocator >::ArrayNum, TArray< InElementType, InAllocator >::GetData(), and TArray< InElementType, InAllocator >::RangeCheck().

Referenced by TIndirectArray< T, Allocator >::Last(), and TArray< InElementType, InAllocator >::Top().

◆ Last() [2/2]

template<typename InElementType , typename InAllocator >
FORCEINLINE const ElementType & TArray< InElementType, InAllocator >::Last ( int32  IndexFromTheEnd = 0) const
inline

Returns n-th last element from the array.

Const version of the above.

Parameters
IndexFromTheEnd(Optional) Index from the end of array (default = 0).
Returns
Reference to n-th last element from the array.

Definition at line 732 of file TArray.h.

References TArray< InElementType, InAllocator >::ArrayNum, TArray< InElementType, InAllocator >::GetData(), and TArray< InElementType, InAllocator >::RangeCheck().

◆ Max()

template<typename InElementType , typename InAllocator >
FORCEINLINE int32 TArray< InElementType, InAllocator >::Max ( ) const
inline

Returns maximum number of elements in array.

Returns
Maximum number of elements in array.
See also
GetSlack

Definition at line 622 of file TArray.h.

References TArray< InElementType, InAllocator >::ArrayMax.

Referenced by TIndirectArray< T, Allocator >::GetAllocatedSize().

◆ MoveOrCopy() [1/2]

template<typename InElementType , typename InAllocator >
template<typename FromArrayType , typename ToArrayType >
static FORCEINLINE TEnableIf< UE4Array_Private::TCanMoveTArrayPointersBetweenArrayTypes< FromArrayType, ToArrayType >::Value >::Type TArray< InElementType, InAllocator >::MoveOrCopy ( ToArrayType &  ToArray,
FromArrayType &  FromArray,
int32  PrevMax 
)
inlinestaticprivate

Moves or copies array. Depends on the array type traits.

This override moves.

Parameters
ToArrayArray to move into.
FromArrayArray to move from.

Definition at line 402 of file TArray.h.

Referenced by TArray< InElementType, InAllocator >::MoveOrCopyWithSlack(), TArray< InElementType, InAllocator >::operator=(), and TArray< InElementType, InAllocator >::TArray().

◆ MoveOrCopy() [2/2]

template<typename InElementType , typename InAllocator >
template<typename FromArrayType , typename ToArrayType >
static FORCEINLINE TEnableIf<!UE4Array_Private::TCanMoveTArrayPointersBetweenArrayTypes< FromArrayType, ToArrayType >::Value >::Type TArray< InElementType, InAllocator >::MoveOrCopy ( ToArrayType &  ToArray,
FromArrayType &  FromArray,
int32  PrevMax 
)
inlinestaticprivate

Moves or copies array. Depends on the array type traits.

This override copies.

Parameters
ToArrayArray to move into.
FromArrayArray to move from.
ExtraSlackTells how much extra memory should be preallocated at the end of the array in the number of elements.

Definition at line 423 of file TArray.h.

◆ MoveOrCopyWithSlack() [1/2]

template<typename InElementType , typename InAllocator >
template<typename FromArrayType , typename ToArrayType >
static FORCEINLINE TEnableIf< UE4Array_Private::TCanMoveTArrayPointersBetweenArrayTypes< FromArrayType, ToArrayType >::Value >::Type TArray< InElementType, InAllocator >::MoveOrCopyWithSlack ( ToArrayType &  ToArray,
FromArrayType &  FromArray,
int32  PrevMax,
int32  ExtraSlack 
)
inlinestaticprivate

Moves or copies array. Depends on the array type traits.

This override moves.

Parameters
ToArrayArray to move into.
FromArrayArray to move from.
ExtraSlackTells how much extra memory should be preallocated at the end of the array in the number of elements.

Definition at line 439 of file TArray.h.

References TArray< InElementType, InAllocator >::MoveOrCopy().

Referenced by TArray< InElementType, InAllocator >::TArray().

◆ MoveOrCopyWithSlack() [2/2]

template<typename InElementType , typename InAllocator >
template<typename FromArrayType , typename ToArrayType >
static FORCEINLINE TEnableIf<!UE4Array_Private::TCanMoveTArrayPointersBetweenArrayTypes< FromArrayType, ToArrayType >::Value >::Type TArray< InElementType, InAllocator >::MoveOrCopyWithSlack ( ToArrayType &  ToArray,
FromArrayType &  FromArray,
int32  PrevMax,
int32  ExtraSlack 
)
inlinestaticprivate

Moves or copies array. Depends on the array type traits.

This override copies.

Parameters
ToArrayArray to move into.
FromArrayArray to move from.
ExtraSlackTells how much extra memory should be preallocated at the end of the array in the number of elements.

Definition at line 457 of file TArray.h.

◆ Num()

template<typename InElementType , typename InAllocator >
FORCEINLINE int32 TArray< InElementType, InAllocator >::Num ( ) const
inline

Returns number of elements in array.

Returns
Number of elements in array.
See also
GetSlack

Definition at line 611 of file TArray.h.

References TArray< InElementType, InAllocator >::ArrayNum.

Referenced by TSet< InElementType, KeyFuncs, Allocator >::Append(), TArray< InElementType, InAllocator >::Append(), FString::Append(), FString::AppendChars(), TSparseArray< InElementType, Allocator >::Compact(), FString::CullArray(), TIndirectArray< T, Allocator >::DestructAndFreeItems(), TArray< InElementType, InAllocator >::FindLastByPredicate(), FString::FString(), TIndirectArray< T, Allocator >::GetAllocatedSize(), TSparseArray< InElementType, Allocator >::GetAllocatedSize(), TMapBase< KeyType, ValueType, SetAllocator, KeyFuncs >::GetKeys(), TSparseArray< InElementType, Allocator >::GetMaxIndex(), FString::InsertAt(), TSparseArray< InElementType, Allocator >::InsertUninitialized(), FString::IsEmpty(), FString::Len(), FGenericPlatformMath::Max(), FGenericPlatformMath::Min(), TSparseArray< InElementType, Allocator >::Num(), TIndirectArray< T, Allocator >::Num(), FString::operator*(), FString::operator+=(), TSparseArray< InElementType, Allocator >::operator+=(), TArray< InElementType, InAllocator >::operator==(), TSparseArray< InElementType, Allocator >::operator[](), FString::ParseIntoArray(), FString::PathAppend(), TArray< InElementType, InAllocator >::RemoveAllSwap(), TIndirectArray< T, Allocator >::RemoveAt(), TIndirectArray< T, Allocator >::RemoveAtSwap(), FString::ReplaceCharWithEscapedChar(), FString::ReplaceEscapedCharWithChar(), TSparseArray< InElementType, Allocator >::Reserve(), TArray< InElementType, InAllocator >::SetNum(), TArray< InElementType, InAllocator >::SetNumUninitialized(), TArray< InElementType, InAllocator >::SetNumUnsafeInternal(), TArray< InElementType, InAllocator >::SetNumZeroed(), TSparseArray< InElementType, Allocator >::Shrink(), TArray< InElementType, InAllocator >::Sort(), TArray< InElementType, InAllocator >::StableSort(), and FString::TrimToNullTerminator().

◆ operator!=()

template<typename InElementType , typename InAllocator >
FORCEINLINE bool TArray< InElementType, InAllocator >::operator!= ( const TArray< InElementType, InAllocator > &  OtherArray) const
inline

Inequality operator.

Parameters
OtherArrayArray to compare.
Returns
True if this array is NOT the same as OtherArray. False otherwise.

Definition at line 1036 of file TArray.h.

◆ operator+=() [1/3]

template<typename InElementType , typename InAllocator >
TArray & TArray< InElementType, InAllocator >::operator+= ( const TArray< InElementType, InAllocator > &  Other)
inline

Appends the specified array to this array. Cannot append to self.

Parameters
OtherThe array to append.

Definition at line 1502 of file TArray.h.

References TArray< InElementType, InAllocator >::Append().

◆ operator+=() [2/3]

template<typename InElementType , typename InAllocator >
TArray & TArray< InElementType, InAllocator >::operator+= ( std::initializer_list< ElementType InitList)
inline

Appends the specified initializer list to this array.

Parameters
InitListThe initializer list to append.

Definition at line 1513 of file TArray.h.

References TArray< InElementType, InAllocator >::Append().

◆ operator+=() [3/3]

template<typename InElementType , typename InAllocator >
TArray & TArray< InElementType, InAllocator >::operator+= ( TArray< InElementType, InAllocator > &&  Other)
inline

Appends the specified array to this array. Cannot append to self.

Move semantics version.

Parameters
OtherThe array to append.

Definition at line 1490 of file TArray.h.

References TArray< InElementType, InAllocator >::Append(), and MoveTemp().

◆ operator=() [1/4]

template<typename InElementType , typename InAllocator >
TArray & TArray< InElementType, InAllocator >::operator= ( const TArray< InElementType, InAllocator > &  Other)
inline

Assignment operator. First deletes all currently contained elements and then copies from other array.

Parameters
OtherThe source array to assign from.

Definition at line 381 of file TArray.h.

References TArray< InElementType, InAllocator >::ArrayMax, TArray< InElementType, InAllocator >::ArrayNum, TArray< InElementType, InAllocator >::CopyToEmpty(), DestructItems(), and TArray< InElementType, InAllocator >::GetData().

◆ operator=() [2/4]

template<typename InElementType , typename InAllocator >
template<typename OtherAllocator >
TArray & TArray< InElementType, InAllocator >::operator= ( const TArray< ElementType, OtherAllocator > &  Other)
inline

Assignment operator. First deletes all currently contained elements and then copies from other array.

Allocator changing version.

Parameters
OtherThe source array to assign from.

Definition at line 368 of file TArray.h.

References TArray< InElementType, InAllocator >::ArrayMax, TArray< InElementType, InAllocator >::ArrayNum, TArray< InElementType, InAllocator >::CopyToEmpty(), DestructItems(), and TArray< InElementType, InAllocator >::GetData().

◆ operator=() [3/4]

template<typename InElementType , typename InAllocator >
TArray & TArray< InElementType, InAllocator >::operator= ( std::initializer_list< InElementType >  InitList)
inline

Initializer list assignment operator. First deletes all currently contained elements and then copies from initializer list.

Parameters
InitListThe initializer_list to copy from.

Definition at line 349 of file TArray.h.

References TArray< InElementType, InAllocator >::ArrayMax, TArray< InElementType, InAllocator >::ArrayNum, TArray< InElementType, InAllocator >::CopyToEmpty(), DestructItems(), and TArray< InElementType, InAllocator >::GetData().

◆ operator=() [4/4]

template<typename InElementType , typename InAllocator >
TArray & TArray< InElementType, InAllocator >::operator= ( TArray< InElementType, InAllocator > &&  Other)
inline

◆ operator==()

template<typename InElementType , typename InAllocator >
bool TArray< InElementType, InAllocator >::operator== ( const TArray< InElementType, InAllocator > &  OtherArray) const
inline

Equality operator.

Parameters
OtherArrayArray to compare.
Returns
True if this array is the same as OtherArray. False otherwise.

Definition at line 1023 of file TArray.h.

References CompareItems(), TArray< InElementType, InAllocator >::GetData(), and TArray< InElementType, InAllocator >::Num().

◆ operator[]() [1/2]

template<typename InElementType , typename InAllocator >
FORCEINLINE ElementType & TArray< InElementType, InAllocator >::operator[] ( int32  Index)
inline

Array bracket operator. Returns reference to element at give index.

Returns
Reference to indexed element.

Definition at line 632 of file TArray.h.

References TArray< InElementType, InAllocator >::GetData(), and TArray< InElementType, InAllocator >::RangeCheck().

◆ operator[]() [2/2]

template<typename InElementType , typename InAllocator >
FORCEINLINE const ElementType & TArray< InElementType, InAllocator >::operator[] ( int32  Index) const
inline

Array bracket operator. Returns reference to element at give index.

Const version of the above.

Returns
Reference to indexed element.

Definition at line 645 of file TArray.h.

References TArray< InElementType, InAllocator >::GetData(), and TArray< InElementType, InAllocator >::RangeCheck().

◆ Pop()

template<typename InElementType , typename InAllocator >
FORCEINLINE ElementType TArray< InElementType, InAllocator >::Pop ( bool  bAllowShrinking = true)
inline

Pops element from the array.

Parameters
bAllowShrinkingIf this call allows shrinking of the array during element remove.
Returns
Popped element.

Definition at line 657 of file TArray.h.

References TArray< InElementType, InAllocator >::ArrayNum, TArray< InElementType, InAllocator >::GetData(), MoveTempIfPossible(), TArray< InElementType, InAllocator >::RangeCheck(), and TArray< InElementType, InAllocator >::RemoveAt().

Referenced by FString::PathAppend().

◆ Push() [1/2]

template<typename InElementType , typename InAllocator >
FORCEINLINE void TArray< InElementType, InAllocator >::Push ( const ElementType Item)
inline

Pushes element into the array.

Const ref version of the above.

Parameters
ItemItem to push.
See also
Pop, Top

Definition at line 683 of file TArray.h.

References TArray< InElementType, InAllocator >::Add().

◆ Push() [2/2]

template<typename InElementType , typename InAllocator >
FORCEINLINE void TArray< InElementType, InAllocator >::Push ( ElementType &&  Item)
inline

Pushes element into the array.

Parameters
ItemItem to push.

Definition at line 670 of file TArray.h.

References TArray< InElementType, InAllocator >::Add(), and MoveTempIfPossible().

◆ RangeCheck()

template<typename InElementType , typename InAllocator >
FORCEINLINE void TArray< InElementType, InAllocator >::RangeCheck ( int32  Index) const
inline

◆ Remove()

template<typename InElementType , typename InAllocator >
int32 TArray< InElementType, InAllocator >::Remove ( const ElementType Item)
inline

Removes as many instances of Item as there are in the array, maintaining order but not indices.

Parameters
ItemItem to remove from array.
Returns
Number of removed elements.
See also
Add, Insert, RemoveAll, RemoveAllSwap, RemoveSingle, RemoveSwap

Definition at line 1709 of file TArray.h.

References TArray< InElementType, InAllocator >::CheckAddress(), and TArray< InElementType, InAllocator >::RemoveAll().

Referenced by FString::CullArray(), and ArkApi::IApiUtils::GetAllActorsInRange().

◆ RemoveAll()

template<typename InElementType , typename InAllocator >
template<class PREDICATE_CLASS >
int32 TArray< InElementType, InAllocator >::RemoveAll ( const PREDICATE_CLASS &  Predicate)
inline

Remove all instances that match the predicate, maintaining order but not indices Optimized to work with runs of matches/non-matches

Parameters
PredicatePredicate class instance
Returns
Number of removed elements.
See also
Add, Insert, RemoveAllSwap, RemoveSingle, RemoveSwap

Definition at line 1726 of file TArray.h.

References TArray< InElementType, InAllocator >::ArrayNum, checkSlow, DestructItems(), TArray< InElementType, InAllocator >::GetData(), and FMemory::Memmove().

Referenced by TArray< InElementType, InAllocator >::Remove().

◆ RemoveAllSwap()

template<typename InElementType , typename InAllocator >
template<class PREDICATE_CLASS >
void TArray< InElementType, InAllocator >::RemoveAllSwap ( const PREDICATE_CLASS &  Predicate,
bool  bAllowShrinking = true 
)
inline

Remove all instances that match the predicate

Parameters
PredicatePredicate class instance
See also
Remove, RemoveSingle, RemoveSingleSwap, RemoveSwap

Definition at line 1774 of file TArray.h.

References TArray< InElementType, InAllocator >::Num(), and TArray< InElementType, InAllocator >::RemoveAtSwap().

◆ RemoveAt() [1/2]

template<typename InElementType , typename InAllocator >
FORCEINLINE void TArray< InElementType, InAllocator >::RemoveAt ( int32  Index)
inline

Removes an element (or elements) at given location optionally shrinking the array.

Parameters
IndexLocation in array of the element to remove.
Count(Optional) Number of elements to remove. Default is 1.
bAllowShrinking(Optional) Tells if this call can shrink array if suitable after remove. Default is true.

Definition at line 1276 of file TArray.h.

References TArray< InElementType, InAllocator >::RemoveAtImpl().

Referenced by TSparseArray< InElementType, Allocator >::Compact(), TArray< InElementType, InAllocator >::Pop(), FString::RemoveAt(), TIndirectArray< T, Allocator >::RemoveAt(), TArray< InElementType, InAllocator >::SetNum(), TArray< InElementType, InAllocator >::SetNumUninitialized(), TArray< InElementType, InAllocator >::SetNumZeroed(), TSparseArray< InElementType, Allocator >::Shrink(), and FString::TrimToNullTerminator().

◆ RemoveAt() [2/2]

template<typename InElementType , typename InAllocator >
template<typename CountType >
FORCEINLINE void TArray< InElementType, InAllocator >::RemoveAt ( int32  Index,
CountType  Count,
bool  bAllowShrinking = true 
)
inline

Removes an element (or elements) at given location optionally shrinking the array.

Parameters
IndexLocation in array of the element to remove.
Count(Optional) Number of elements to remove. Default is 1.
bAllowShrinking(Optional) Tells if this call can shrink array if suitable after remove. Default is true.

Definition at line 1290 of file TArray.h.

References TArray< InElementType, InAllocator >::RemoveAtImpl().

◆ RemoveAtImpl()

◆ RemoveAtSwap() [1/2]

template<typename InElementType , typename InAllocator >
FORCEINLINE void TArray< InElementType, InAllocator >::RemoveAtSwap ( int32  Index)
inline

Removes an element (or elements) at given location optionally shrinking the array.

This version is much more efficient than RemoveAt (O(Count) instead of O(ArrayNum)), but does not preserve the order.

Parameters
IndexLocation in array of the element to remove.
Count(Optional) Number of elements to remove. Default is 1.
bAllowShrinking(Optional) Tells if this call can shrink array if suitable after remove. Default is true.

Definition at line 1849 of file TArray.h.

References TArray< InElementType, InAllocator >::RemoveAtSwapImpl().

Referenced by TArray< InElementType, InAllocator >::RemoveAllSwap(), TIndirectArray< T, Allocator >::RemoveAtSwap(), TArray< InElementType, InAllocator >::RemoveSingleSwap(), and TArray< InElementType, InAllocator >::RemoveSwap().

◆ RemoveAtSwap() [2/2]

template<typename InElementType , typename InAllocator >
template<typename CountType >
FORCEINLINE void TArray< InElementType, InAllocator >::RemoveAtSwap ( int32  Index,
CountType  Count,
bool  bAllowShrinking = true 
)
inline

Removes an element (or elements) at given location optionally shrinking the array.

This version is much more efficient than RemoveAt (O(Count) instead of O(ArrayNum)), but does not preserve the order.

Parameters
IndexLocation in array of the element to remove.
Count(Optional) Number of elements to remove. Default is 1.
bAllowShrinking(Optional) Tells if this call can shrink array if suitable after remove. Default is true.

Definition at line 1867 of file TArray.h.

References TArray< InElementType, InAllocator >::RemoveAtSwapImpl().

◆ RemoveAtSwapImpl()

◆ RemoveSingle()

template<typename InElementType , typename InAllocator >
int32 TArray< InElementType, InAllocator >::RemoveSingle ( const ElementType Item)
inline

Removes the first occurrence of the specified item in the array, maintaining order but not indices.

Parameters
ItemThe item to remove.
Returns
The number of items removed. For RemoveSingleItem, this is always either 0 or 1.
See also
Add, Insert, Remove, RemoveAll, RemoveAllSwap

Definition at line 1679 of file TArray.h.

References TArray< InElementType, InAllocator >::ArrayNum, DestructItems(), TArray< InElementType, InAllocator >::Find(), TArray< InElementType, InAllocator >::GetData(), and INDEX_NONE.

◆ RemoveSingleSwap()

template<typename InElementType , typename InAllocator >
int32 TArray< InElementType, InAllocator >::RemoveSingleSwap ( const ElementType Item,
bool  bAllowShrinking = true 
)
inline

Removes the first occurrence of the specified item in the array. This version is much more efficient O(Count) instead of O(ArrayNum), but does not preserve the order

Parameters
ItemThe item to remove
Returns
The number of items removed. For RemoveSingleItem, this is always either 0 or 1.
See also
Add, Insert, Remove, RemoveAll, RemoveAllSwap, RemoveSwap

Definition at line 1798 of file TArray.h.

References TArray< InElementType, InAllocator >::Find(), INDEX_NONE, and TArray< InElementType, InAllocator >::RemoveAtSwap().

◆ RemoveSwap()

template<typename InElementType , typename InAllocator >
int32 TArray< InElementType, InAllocator >::RemoveSwap ( const ElementType Item)
inline

Removes item from the array.

This version is much more efficient, because it uses RemoveAtSwap internally which is O(Count) instead of RemoveAt which is O(ArrayNum), but does not preserve the order.

Returns
Number of elements removed.
See also
Add, Insert, Remove, RemoveAll, RemoveAllSwap

Definition at line 1822 of file TArray.h.

References TArray< InElementType, InAllocator >::ArrayNum, TArray< InElementType, InAllocator >::CheckAddress(), and TArray< InElementType, InAllocator >::RemoveAtSwap().

◆ Reserve()

template<typename InElementType , typename InAllocator >
FORCEINLINE void TArray< InElementType, InAllocator >::Reserve ( int32  Number)
inline

Reserves memory such that the array can contain at least Number elements.

Parameters
NumberThe number of elements that the array should be able to contain after allocation.
See also
Shrink

Definition at line 1648 of file TArray.h.

References TArray< InElementType, InAllocator >::ArrayMax, and TArray< InElementType, InAllocator >::ResizeTo().

Referenced by TArray< InElementType, InAllocator >::Append(), TSet< InElementType, KeyFuncs, Allocator >::Array(), FString::PathAppend(), FString::Reserve(), and TIndirectArray< T, Allocator >::Reserve().

◆ Reset()

template<typename InElementType , typename InAllocator >
void TArray< InElementType, InAllocator >::Reset ( int32  NewSize = 0)
inline

Same as empty, but doesn't change memory allocations, unless the new size is larger than the current array. It calls the destructors on held items if needed and then zeros the ArrayNum.

Parameters
NewSizeThe expected usage size after calling this function.

Definition at line 1302 of file TArray.h.

References TArray< InElementType, InAllocator >::ArrayMax, TArray< InElementType, InAllocator >::ArrayNum, DestructItems(), TArray< InElementType, InAllocator >::Empty(), and TArray< InElementType, InAllocator >::GetData().

Referenced by FString::ParseIntoArray(), TSparseArray< InElementType, Allocator >::Reset(), FString::Reset(), and TIndirectArray< T, Allocator >::Reset().

◆ ResizeForCopy()

template<typename InElementType , typename InAllocator >
FORCENOINLINE void TArray< InElementType, InAllocator >::ResizeForCopy ( int32  NewMax,
int32  PrevMax 
)
inlineprivate

◆ ResizeGrow()

template<typename InElementType , typename InAllocator >
FORCENOINLINE void TArray< InElementType, InAllocator >::ResizeGrow ( int32  OldNum)
inlineprivate

◆ ResizeShrink()

template<typename InElementType , typename InAllocator >
FORCENOINLINE void TArray< InElementType, InAllocator >::ResizeShrink ( )
inlineprivate

◆ ResizeTo()

◆ SetNum()

template<typename InElementType , typename InAllocator >
void TArray< InElementType, InAllocator >::SetNum ( int32  NewNum,
bool  bAllowShrinking = true 
)
inline

Resizes array to given number of elements.

Parameters
NewNumNew size of the array.
bAllowShrinkingTell if this function can shrink the memory in-use if suitable.

Definition at line 1340 of file TArray.h.

References TArray< InElementType, InAllocator >::AddUninitialized(), TArray< InElementType, InAllocator >::AllocatorInstance, TArray< InElementType, InAllocator >::ArrayNum, TArray< InElementType, InAllocator >::Num(), and TArray< InElementType, InAllocator >::RemoveAt().

◆ SetNumUninitialized()

template<typename InElementType , typename InAllocator >
void TArray< InElementType, InAllocator >::SetNumUninitialized ( int32  NewNum,
bool  bAllowShrinking = true 
)
inline

Resizes array to given number of elements. New elements will be uninitialized.

Parameters
NewNumNew size of the array.

Definition at line 1376 of file TArray.h.

References TArray< InElementType, InAllocator >::AddUninitialized(), TArray< InElementType, InAllocator >::Num(), and TArray< InElementType, InAllocator >::RemoveAt().

◆ SetNumUnsafeInternal()

template<typename InElementType , typename InAllocator >
void TArray< InElementType, InAllocator >::SetNumUnsafeInternal ( int32  NewNum)
inline

Does nothing except setting the new number of elements in the array. Does not destruct items, does not de-allocate memory.

Parameters
NewNumNew number of elements in the array, must be <= the current number of elements in the array.

Definition at line 1392 of file TArray.h.

References TArray< InElementType, InAllocator >::ArrayNum, checkSlow, and TArray< InElementType, InAllocator >::Num().

◆ SetNumZeroed()

template<typename InElementType , typename InAllocator >
void TArray< InElementType, InAllocator >::SetNumZeroed ( int32  NewNum,
bool  bAllowShrinking = true 
)
inline

Resizes array to given number of elements. New elements will be zeroed.

Parameters
NewNumNew size of the array.

Definition at line 1359 of file TArray.h.

References TArray< InElementType, InAllocator >::AddZeroed(), TArray< InElementType, InAllocator >::Num(), and TArray< InElementType, InAllocator >::RemoveAt().

◆ Shrink()

template<typename InElementType , typename InAllocator >
FORCEINLINE void TArray< InElementType, InAllocator >::Shrink ( )
inline

◆ Sort() [1/2]

template<typename InElementType , typename InAllocator >
void TArray< InElementType, InAllocator >::Sort ( )
inline

Sorts the array assuming < operator is defined for the item type.

Note
: If your array contains raw pointers, they will be automatically dereferenced during sorting. Therefore, your array will be sorted by the values being pointed to, rather than the pointers' values. If this is not desirable, please use Algo::Sort(MyArray) instead. The auto-dereferencing behavior does not occur with smart pointers.

Definition at line 1964 of file TArray.h.

References TArray< InElementType, InAllocator >::GetData(), TArray< InElementType, InAllocator >::Num(), and TArray< InElementType, InAllocator >::Sort().

Referenced by TArray< InElementType, InAllocator >::Sort().

◆ Sort() [2/2]

template<typename InElementType , typename InAllocator >
template<class PREDICATE_CLASS >
void TArray< InElementType, InAllocator >::Sort ( const PREDICATE_CLASS &  Predicate)
inline

Sorts the array using user define predicate class.

Parameters
PredicatePredicate class instance.
Note
: If your array contains raw pointers, they will be automatically dereferenced during sorting. Therefore, your predicate will be passed references rather than pointers. If this is not desirable, please use Algo::Sort(MyArray, Predicate) instead. The auto-dereferencing behavior does not occur with smart pointers.

Definition at line 1980 of file TArray.h.

References TArray< InElementType, InAllocator >::GetData(), TArray< InElementType, InAllocator >::Num(), and TArray< InElementType, InAllocator >::Sort().

◆ StableSort() [1/2]

template<typename InElementType , typename InAllocator >
void TArray< InElementType, InAllocator >::StableSort ( )
inline

Stable sorts the array assuming < operator is defined for the item type.

Stable sort is slower than non-stable algorithm.

Note
: If your array contains raw pointers, they will be automatically dereferenced during sorting. Therefore, your array will be sorted by the values being pointed to, rather than the pointers' values. The auto-dereferencing behavior does not occur with smart pointers.

Definition at line 1994 of file TArray.h.

References TArray< InElementType, InAllocator >::GetData(), TArray< InElementType, InAllocator >::Num(), and TArray< InElementType, InAllocator >::StableSort().

Referenced by TArray< InElementType, InAllocator >::StableSort().

◆ StableSort() [2/2]

template<typename InElementType , typename InAllocator >
template<class PREDICATE_CLASS >
void TArray< InElementType, InAllocator >::StableSort ( const PREDICATE_CLASS &  Predicate)
inline

Stable sorts the array using user defined predicate class.

Stable sort is slower than non-stable algorithm.

Parameters
PredicatePredicate class instance
Note
: If your array contains raw pointers, they will be automatically dereferenced during sorting. Therefore, your predicate will be passed references rather than pointers. The auto-dereferencing behavior does not occur with smart pointers.

Definition at line 2011 of file TArray.h.

References TArray< InElementType, InAllocator >::GetData(), TArray< InElementType, InAllocator >::Num(), and TArray< InElementType, InAllocator >::StableSort().

◆ Top() [1/2]

template<typename InElementType , typename InAllocator >
FORCEINLINE ElementType & TArray< InElementType, InAllocator >::Top ( )
inline

Returns the top element, i.e. the last one.

Returns
Reference to the top element.
See also
Pop, Push

Definition at line 694 of file TArray.h.

References TArray< InElementType, InAllocator >::Last().

◆ Top() [2/2]

template<typename InElementType , typename InAllocator >
FORCEINLINE const ElementType & TArray< InElementType, InAllocator >::Top ( ) const
inline

Returns the top element, i.e. the last one.

Const version of the above.

Returns
Reference to the top element.
See also
Pop, Push

Definition at line 707 of file TArray.h.

References TArray< InElementType, InAllocator >::Last().

Friends And Related Function Documentation

◆ begin [1/2]

template<typename InElementType , typename InAllocator >
FORCEINLINE friend RangedForConstIteratorType begin ( const TArray< InElementType, InAllocator > &  Array)
friend

Definition at line 1944 of file TArray.h.

◆ begin [2/2]

template<typename InElementType , typename InAllocator >
FORCEINLINE friend RangedForIteratorType begin ( TArray< InElementType, InAllocator > &  Array)
friend

DO NOT USE DIRECTLY STL-like iterators to enable range-based for loop support.

Definition at line 1943 of file TArray.h.

◆ end [1/2]

template<typename InElementType , typename InAllocator >
FORCEINLINE friend RangedForConstIteratorType end ( const TArray< InElementType, InAllocator > &  Array)
friend

Definition at line 1946 of file TArray.h.

◆ end [2/2]

template<typename InElementType , typename InAllocator >
FORCEINLINE friend RangedForIteratorType end ( TArray< InElementType, InAllocator > &  Array)
friend

Definition at line 1945 of file TArray.h.

◆ TArray

template<typename InElementType , typename InAllocator >
template<typename OtherInElementType , typename OtherAllocator >
friend class TArray
friend

Definition at line 270 of file TArray.h.

Member Data Documentation

◆ AllocatorInstance

◆ ArrayMax

◆ ArrayNum

template<typename InElementType , typename InAllocator >
int32 TArray< InElementType, InAllocator >::ArrayNum
protected

Definition at line 2108 of file TArray.h.

Referenced by TArray< InElementType, InAllocator >::AddUninitialized(), TArray< InElementType, InAllocator >::Append(), TArray< InElementType, InAllocator >::CheckAddress(), TArray< InElementType, InAllocator >::CheckInvariants(), TArray< InElementType, InAllocator >::Contains(), TArray< InElementType, InAllocator >::CopyToEmpty(), TArray< InElementType, InAllocator >::Empty(), TArray< InElementType, InAllocator >::FilterByPredicate(), TArray< InElementType, InAllocator >::Find(), TArray< InElementType, InAllocator >::FindByKey(), TArray< InElementType, InAllocator >::FindByPredicate(), TArray< InElementType, InAllocator >::FindLast(), TArray< InElementType, InAllocator >::FindLastByPredicate(), TArray< InElementType, InAllocator >::GetSlack(), TArray< InElementType, InAllocator >::IndexOfByKey(), TArray< InElementType, InAllocator >::IndexOfByPredicate(), TArray< InElementType, InAllocator >::InsertUninitialized(), TArray< InElementType, InAllocator >::IsValidIndex(), TArray< InElementType, InAllocator >::Last(), TArray< InElementType, InAllocator >::Num(), TArray< InElementType, InAllocator >::operator=(), TArray< InElementType, InAllocator >::Pop(), TArray< InElementType, InAllocator >::RangeCheck(), TArray< InElementType, InAllocator >::RemoveAll(), TArray< InElementType, InAllocator >::RemoveAtImpl(), TArray< InElementType, InAllocator >::RemoveAtSwapImpl(), TArray< InElementType, InAllocator >::RemoveSingle(), TArray< InElementType, InAllocator >::RemoveSwap(), TArray< InElementType, InAllocator >::Reset(), TArray< InElementType, InAllocator >::ResizeGrow(), TArray< InElementType, InAllocator >::ResizeShrink(), TArray< InElementType, InAllocator >::ResizeTo(), TArray< InElementType, InAllocator >::SetNum(), TArray< InElementType, InAllocator >::SetNumUnsafeInternal(), TArray< InElementType, InAllocator >::Shrink(), and TArray< InElementType, InAllocator >::~TArray().


The documentation for this class was generated from the following file: