UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
TChunkedArray< InElementType, TargetBytesPerChunk, AllocatorType > Class Template Reference

#include <ChunkedArray.h>

+ Inheritance diagram for TChunkedArray< InElementType, TargetBytesPerChunk, AllocatorType >:

Classes

struct  FChunk
 

Public Types

using IntrusiveUnsetOptionalStateType = TChunkedArray
 

Public Member Functions

 TChunkedArray (int32 InNumElements=0)
 
 TChunkedArray (TChunkedArray &&Other)
 
TChunkedArrayoperator= (TChunkedArray &&Other)
 
 ~TChunkedArray ()
 
 TChunkedArray (const TChunkedArray &)=default
 
TChunkedArrayoperator= (const TChunkedArray &)=default
 
 TChunkedArray (FIntrusiveUnsetOptionalState)
 
bool operator== (FIntrusiveUnsetOptionalState) const
 
ElementType & operator() (int32 ElementIndex)
 
const ElementType & operator() (int32 ElementIndex) const
 
ElementType & operator[] (int32 ElementIndex)
 
const ElementType & operator[] (int32 ElementIndex) const
 
bool IsEmpty () const
 
int32 Num () const
 
SIZE_T GetAllocatedSize (void) const
 
UE_FORCEINLINE_HINT bool IsValidIndex (int32 Index) const
 
int32 AddElement (const ElementType &Item)
 
template<typename... ArgsType>
int32 Emplace (ArgsType &&... Args)
 
TChunkedArrayoperator+= (const TArray< ElementType > &Other)
 
TChunkedArrayoperator+= (const TChunkedArray &Other)
 
int32 Add (int32 Count=1)
 
template<typename OtherAllocator >
void CopyToLinearArray (TArray< ElementType, OtherAllocator > &DestinationArray)
 
template<typename OtherAllocator >
void MoveToLinearArray (TArray< ElementType, OtherAllocator > &DestinationArray)
 
void Empty (int32 Slack=0)
 
void Reserve (int32 Number)
 
void Shrink ()
 
FIterType begin ()
 
FConstIterType begin () const
 
FIterType end ()
 
FConstIterType end () const
 

Static Public Attributes

static constexpr bool bHasIntrusiveUnsetOptionalState = true
 

Protected Types

enum  { NumElementsPerChunk = TargetBytesPerChunk / sizeof(ElementType) }
 
typedef TIndirectArray< FChunk, AllocatorType > ChunksType
 

Protected Attributes

ChunksType Chunks
 
int32 NumElements
 

Detailed Description

template<typename InElementType, uint32 TargetBytesPerChunk = 16384, typename AllocatorType = FDefaultAllocator>
class TChunkedArray< InElementType, TargetBytesPerChunk, AllocatorType >

An array that uses multiple allocations to avoid allocation failure due to fragmentation.

Member Typedef Documentation

◆ ChunksType

template<typename InElementType , uint32 TargetBytesPerChunk = 16384, typename AllocatorType = FDefaultAllocator>
typedef TIndirectArray<FChunk, AllocatorType> TChunkedArray< InElementType, TargetBytesPerChunk, AllocatorType >::ChunksType
protected

The chunks of the array's elements.

◆ IntrusiveUnsetOptionalStateType

template<typename InElementType , uint32 TargetBytesPerChunk = 16384, typename AllocatorType = FDefaultAllocator>
using TChunkedArray< InElementType, TargetBytesPerChunk, AllocatorType >::IntrusiveUnsetOptionalStateType = TChunkedArray

Member Enumeration Documentation

◆ anonymous enum

template<typename InElementType , uint32 TargetBytesPerChunk = 16384, typename AllocatorType = FDefaultAllocator>
anonymous enum
protected
Enumerator
NumElementsPerChunk 

Constructor & Destructor Documentation

◆ TChunkedArray() [1/4]

template<typename InElementType , uint32 TargetBytesPerChunk = 16384, typename AllocatorType = FDefaultAllocator>
TChunkedArray< InElementType, TargetBytesPerChunk, AllocatorType >::TChunkedArray ( int32  InNumElements = 0)
inline

Initialization constructor.

◆ TChunkedArray() [2/4]

template<typename InElementType , uint32 TargetBytesPerChunk = 16384, typename AllocatorType = FDefaultAllocator>
TChunkedArray< InElementType, TargetBytesPerChunk, AllocatorType >::TChunkedArray ( TChunkedArray< InElementType, TargetBytesPerChunk, AllocatorType > &&  Other)
inline

◆ ~TChunkedArray()

template<typename InElementType , uint32 TargetBytesPerChunk = 16384, typename AllocatorType = FDefaultAllocator>
TChunkedArray< InElementType, TargetBytesPerChunk, AllocatorType >::~TChunkedArray ( )
inline

◆ TChunkedArray() [3/4]

template<typename InElementType , uint32 TargetBytesPerChunk = 16384, typename AllocatorType = FDefaultAllocator>
TChunkedArray< InElementType, TargetBytesPerChunk, AllocatorType >::TChunkedArray ( const TChunkedArray< InElementType, TargetBytesPerChunk, AllocatorType > &  )
default

◆ TChunkedArray() [4/4]

template<typename InElementType , uint32 TargetBytesPerChunk = 16384, typename AllocatorType = FDefaultAllocator>
TChunkedArray< InElementType, TargetBytesPerChunk, AllocatorType >::TChunkedArray ( FIntrusiveUnsetOptionalState  )
inlineexplicit

Member Function Documentation

◆ Add()

template<typename InElementType , uint32 TargetBytesPerChunk = 16384, typename AllocatorType = FDefaultAllocator>
int32 TChunkedArray< InElementType, TargetBytesPerChunk, AllocatorType >::Add ( int32  Count = 1)
inline

◆ AddElement()

template<typename InElementType , uint32 TargetBytesPerChunk = 16384, typename AllocatorType = FDefaultAllocator>
int32 TChunkedArray< InElementType, TargetBytesPerChunk, AllocatorType >::AddElement ( const ElementType &  Item)
inline

Adds a new item to the end of the chunked array.

Parameters
ItemThe item to add
Returns
Index to the new item

◆ begin() [1/2]

template<typename InElementType , uint32 TargetBytesPerChunk = 16384, typename AllocatorType = FDefaultAllocator>
FIterType TChunkedArray< InElementType, TargetBytesPerChunk, AllocatorType >::begin ( )
inline

◆ begin() [2/2]

template<typename InElementType , uint32 TargetBytesPerChunk = 16384, typename AllocatorType = FDefaultAllocator>
FConstIterType TChunkedArray< InElementType, TargetBytesPerChunk, AllocatorType >::begin ( ) const
inline

◆ CopyToLinearArray()

template<typename InElementType , uint32 TargetBytesPerChunk = 16384, typename AllocatorType = FDefaultAllocator>
void TChunkedArray< InElementType, TargetBytesPerChunk, AllocatorType >::CopyToLinearArray ( TArray< ElementType, OtherAllocator > &  DestinationArray)
inline

◆ Emplace()

template<typename InElementType , uint32 TargetBytesPerChunk = 16384, typename AllocatorType = FDefaultAllocator>
template<typename... ArgsType>
int32 TChunkedArray< InElementType, TargetBytesPerChunk, AllocatorType >::Emplace ( ArgsType &&...  Args)
inline

Constructs a new item to the end of the chunked array.

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

◆ Empty()

template<typename InElementType , uint32 TargetBytesPerChunk = 16384, typename AllocatorType = FDefaultAllocator>
void TChunkedArray< InElementType, TargetBytesPerChunk, AllocatorType >::Empty ( int32  Slack = 0)
inline

◆ end() [1/2]

template<typename InElementType , uint32 TargetBytesPerChunk = 16384, typename AllocatorType = FDefaultAllocator>
FIterType TChunkedArray< InElementType, TargetBytesPerChunk, AllocatorType >::end ( )
inline

◆ end() [2/2]

template<typename InElementType , uint32 TargetBytesPerChunk = 16384, typename AllocatorType = FDefaultAllocator>
FConstIterType TChunkedArray< InElementType, TargetBytesPerChunk, AllocatorType >::end ( ) const
inline

◆ GetAllocatedSize()

template<typename InElementType , uint32 TargetBytesPerChunk = 16384, typename AllocatorType = FDefaultAllocator>
SIZE_T TChunkedArray< InElementType, TargetBytesPerChunk, AllocatorType >::GetAllocatedSize ( void  ) const
inline

◆ IsEmpty()

template<typename InElementType , uint32 TargetBytesPerChunk = 16384, typename AllocatorType = FDefaultAllocator>
bool TChunkedArray< InElementType, TargetBytesPerChunk, AllocatorType >::IsEmpty ( ) const
inline

Returns true if the chunked array is empty and contains no elements.

Returns
True if the chunked array is empty.
See also
Num

◆ IsValidIndex()

template<typename InElementType , uint32 TargetBytesPerChunk = 16384, typename AllocatorType = FDefaultAllocator>
UE_FORCEINLINE_HINT bool TChunkedArray< InElementType, TargetBytesPerChunk, AllocatorType >::IsValidIndex ( int32  Index) const
inline

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

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

◆ MoveToLinearArray()

template<typename InElementType , uint32 TargetBytesPerChunk = 16384, typename AllocatorType = FDefaultAllocator>
void TChunkedArray< InElementType, TargetBytesPerChunk, AllocatorType >::MoveToLinearArray ( TArray< ElementType, OtherAllocator > &  DestinationArray)
inline

◆ Num()

template<typename InElementType , uint32 TargetBytesPerChunk = 16384, typename AllocatorType = FDefaultAllocator>
int32 TChunkedArray< InElementType, TargetBytesPerChunk, AllocatorType >::Num ( ) const
inline

◆ operator()() [1/2]

template<typename InElementType , uint32 TargetBytesPerChunk = 16384, typename AllocatorType = FDefaultAllocator>
ElementType & TChunkedArray< InElementType, TargetBytesPerChunk, AllocatorType >::operator() ( int32  ElementIndex)
inline

◆ operator()() [2/2]

template<typename InElementType , uint32 TargetBytesPerChunk = 16384, typename AllocatorType = FDefaultAllocator>
const ElementType & TChunkedArray< InElementType, TargetBytesPerChunk, AllocatorType >::operator() ( int32  ElementIndex) const
inline

◆ operator+=() [1/2]

template<typename InElementType , uint32 TargetBytesPerChunk = 16384, typename AllocatorType = FDefaultAllocator>
TChunkedArray & TChunkedArray< InElementType, TargetBytesPerChunk, AllocatorType >::operator+= ( const TArray< ElementType > &  Other)
inline

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

Parameters
OtherThe array to append.

◆ operator+=() [2/2]

template<typename InElementType , uint32 TargetBytesPerChunk = 16384, typename AllocatorType = FDefaultAllocator>
TChunkedArray & TChunkedArray< InElementType, TargetBytesPerChunk, AllocatorType >::operator+= ( const TChunkedArray< InElementType, TargetBytesPerChunk, AllocatorType > &  Other)
inline

◆ operator=() [1/2]

template<typename InElementType , uint32 TargetBytesPerChunk = 16384, typename AllocatorType = FDefaultAllocator>
TChunkedArray & TChunkedArray< InElementType, TargetBytesPerChunk, AllocatorType >::operator= ( const TChunkedArray< InElementType, TargetBytesPerChunk, AllocatorType > &  )
default

◆ operator=() [2/2]

template<typename InElementType , uint32 TargetBytesPerChunk = 16384, typename AllocatorType = FDefaultAllocator>
TChunkedArray & TChunkedArray< InElementType, TargetBytesPerChunk, AllocatorType >::operator= ( TChunkedArray< InElementType, TargetBytesPerChunk, AllocatorType > &&  Other)
inline

◆ operator==()

template<typename InElementType , uint32 TargetBytesPerChunk = 16384, typename AllocatorType = FDefaultAllocator>
bool TChunkedArray< InElementType, TargetBytesPerChunk, AllocatorType >::operator== ( FIntrusiveUnsetOptionalState  ) const
inline

◆ operator[]() [1/2]

template<typename InElementType , uint32 TargetBytesPerChunk = 16384, typename AllocatorType = FDefaultAllocator>
ElementType & TChunkedArray< InElementType, TargetBytesPerChunk, AllocatorType >::operator[] ( int32  ElementIndex)
inline

◆ operator[]() [2/2]

template<typename InElementType , uint32 TargetBytesPerChunk = 16384, typename AllocatorType = FDefaultAllocator>
const ElementType & TChunkedArray< InElementType, TargetBytesPerChunk, AllocatorType >::operator[] ( int32  ElementIndex) const
inline

◆ Reserve()

template<typename InElementType , uint32 TargetBytesPerChunk = 16384, typename AllocatorType = FDefaultAllocator>
void TChunkedArray< InElementType, TargetBytesPerChunk, AllocatorType >::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.

◆ Shrink()

template<typename InElementType , uint32 TargetBytesPerChunk = 16384, typename AllocatorType = FDefaultAllocator>
void TChunkedArray< InElementType, TargetBytesPerChunk, AllocatorType >::Shrink ( )
inline

Member Data Documentation

◆ bHasIntrusiveUnsetOptionalState

template<typename InElementType , uint32 TargetBytesPerChunk = 16384, typename AllocatorType = FDefaultAllocator>
constexpr bool TChunkedArray< InElementType, TargetBytesPerChunk, AllocatorType >::bHasIntrusiveUnsetOptionalState = true
staticconstexpr

◆ Chunks

template<typename InElementType , uint32 TargetBytesPerChunk = 16384, typename AllocatorType = FDefaultAllocator>
ChunksType TChunkedArray< InElementType, TargetBytesPerChunk, AllocatorType >::Chunks
protected

◆ NumElements

template<typename InElementType , uint32 TargetBytesPerChunk = 16384, typename AllocatorType = FDefaultAllocator>
int32 TChunkedArray< InElementType, TargetBytesPerChunk, AllocatorType >::NumElements
protected

The number of elements in the array.


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