UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
TPagedArray< InElementType, InPageSizeInBytes, InAllocatorType > Class Template Reference

#include <PagedArray.h>

Public Types

using AllocatorType = InAllocatorType
 
using SizeType = typename InAllocatorType::SizeType
 
using ElementType = InElementType
 
using ElementAllocatorType = std::conditional_t< AllocatorType::NeedsElementType, typename AllocatorType::template ForElementType< ElementType >, typename AllocatorType::ForAnyElementType >
 
using ConstIteratorType = UE::Core::PagedArray::Private::TIterator< const ElementType, const PageType, PageTraits >
 
using IteratorType = UE::Core::PagedArray::Private::TIterator< ElementType, PageType, PageTraits >
 

Public Member Functions

 TPagedArray ()=default
 
 TPagedArray (TPagedArray &&Other)
 
 TPagedArray (const TPagedArray &Other)=default
 
 TPagedArray (std::initializer_list< ElementType > InList)
 
 TPagedArray (const ElementType *InSource, SizeType InSize)
 
 ~TPagedArray ()
 
TPagedArrayoperator= (TPagedArray &&Other)
 
TPagedArrayoperator= (const TPagedArray &Other)=default
 
TPagedArrayoperator= (std::initializer_list< ElementType > InList)
 
const ElementTypeoperator[] (SizeType Index) const
 
ElementTypeoperator[] (SizeType Index)
 
SIZE_T GetAllocatedSize () const
 
void CountBytes (FArchive &Ar) const
 
UE_FORCEINLINE_HINT SizeType Max () const
 
UE_FORCEINLINE_HINT SizeType Num () const
 
UE_FORCEINLINE_HINT SizeType NumPages () const
 
UE_FORCEINLINE_HINT bool IsValidIndex (SizeType Index) const
 
UE_FORCEINLINE_HINT bool IsEmpty () const
 
const ElementTypeLast () const
 
ElementTypeLast ()
 
void SetNum (SizeType NewNum, EAllowShrinking AllowShrinking=UE::Core::Private::AllowShrinkingByDefault< AllocatorType >())
 
UE_FORCEINLINE_HINT void SetNum (SizeType NewNum, bool bAllowShrinking)
 
void SetMem (uint8 ByteValue)
 
UE_FORCEINLINE_HINT void SetZero ()
 
void Append (const ElementType *InSource, SizeType InSize)
 
void Append (std::initializer_list< ElementType > InList)
 
template<typename ContainerType >
UE_FORCEINLINE_HINT void Append (ContainerType &&Container)
 
template<int32 OtherPageSizeInBytes, typename OtherAllocator >
void Append (const TPagedArray< ElementType, OtherPageSizeInBytes, OtherAllocator > &Other)
 
void Assign (const ElementType *InSource, SizeType InSize)
 
void Assign (std::initializer_list< ElementType > InList)
 
template<typename ContainerType >
void Assign (ContainerType &&Container)
 
template<int32 OtherPageSizeInBytes, typename OtherAllocator >
void Assign (const TPagedArray< ElementType, OtherPageSizeInBytes, OtherAllocator > &Other)
 
template<typename... ArgsType>
SizeType Emplace (ArgsType &&... Args)
 
template<typename... ArgsType>
ElementTypeEmplace_GetRef (ArgsType &&... Args)
 
UE_FORCEINLINE_HINT SizeType Add (const ElementType &Element)
 
UE_FORCEINLINE_HINT SizeType Add (ElementType &&Element)
 
UE_FORCEINLINE_HINT ElementTypeAdd_GetRef (const ElementType &Element)
 
UE_FORCEINLINE_HINT ElementTypeAdd_GetRef (ElementType &&Element)
 
UE_FORCEINLINE_HINT void Push (const ElementType &Element)
 
UE_FORCEINLINE_HINT void Push (ElementType &&Element)
 
void Pop (EAllowShrinking AllowShrinking=UE::Core::Private::AllowShrinkingByDefault< AllocatorType >())
 
UE_FORCEINLINE_HINT void Pop (bool bAllowShrinking)
 
void RemoveAtSwap (SizeType Index, EAllowShrinking AllowShrinking=UE::Core::Private::AllowShrinkingByDefault< AllocatorType >())
 
UE_FORCEINLINE_HINT void RemoveAtSwap (SizeType Index, bool bAllowShrinking)
 
void Empty ()
 
void Empty (SizeType InCapacity)
 
void Reset ()
 
void Reset (SizeType InCapacity)
 
void Reserve (SizeType InCount)
 
template<typename AnyAllocator >
void ToArray (TArray< ElementType, AnyAllocator > &OutDestination) const &
 
template<typename AnyAllocator >
void ToArray (TArray< ElementType, AnyAllocator > &OutDestination) &&
 
UE_FORCEINLINE_HINT ConstIteratorType begin () const
 
UE_FORCEINLINE_HINT IteratorType begin ()
 
UE_FORCEINLINE_HINT ConstIteratorType end () const
 
UE_FORCEINLINE_HINT IteratorType end ()
 
bool operator== (const TPagedArray &Right) const
 
UE_FORCEINLINE_HINT bool operator!= (const TPagedArray &Right) const
 

Static Public Member Functions

static constexpr SizeType MaxPerPage ()
 

Friends

template<typename AnyElementType , int32 AnyPageSizeInBytes, typename AnyAllocatorType >
class TPagedArray
 

Detailed Description

template<typename InElementType, int32 InPageSizeInBytes, typename InAllocatorType>
class TPagedArray< InElementType, InPageSizeInBytes, InAllocatorType >

Fixed size block allocated container class.

This container mimics the behavior of an array without fulfilling the contiguous storage guarantee. Instead, it allocates memory in pages. Each page is a block of memory of the parameter page size in bytes. Elements within a page are guaranteed to be contiguous. Paged arrays have the following advantages v normal arrays:

  1. It's more suited for large sized arrays as they don't require a single contiguous memory block. This make them less vulnerable to memory fragmentation.
  2. The contained elements' addresses are persistent as long as the container isn't resized.

Member Typedef Documentation

◆ AllocatorType

◆ ConstIteratorType

◆ ElementAllocatorType

template<typename InElementType , int32 InPageSizeInBytes, typename InAllocatorType >
using TPagedArray< InElementType, InPageSizeInBytes, InAllocatorType >::ElementAllocatorType = std::conditional_t< AllocatorType::NeedsElementType, typename AllocatorType::template ForElementType<ElementType>, typename AllocatorType::ForAnyElementType>

◆ ElementType

◆ IteratorType

◆ SizeType

template<typename InElementType , int32 InPageSizeInBytes, typename InAllocatorType >
using TPagedArray< InElementType, InPageSizeInBytes, InAllocatorType >::SizeType = typename InAllocatorType::SizeType

Constructor & Destructor Documentation

◆ TPagedArray() [1/5]

◆ TPagedArray() [2/5]

◆ TPagedArray() [3/5]

◆ TPagedArray() [4/5]

template<typename InElementType , int32 InPageSizeInBytes, typename InAllocatorType >
TPagedArray< InElementType, InPageSizeInBytes, InAllocatorType >::TPagedArray ( std::initializer_list< ElementType InList)
inline

◆ TPagedArray() [5/5]

◆ ~TPagedArray()

Member Function Documentation

◆ Add() [1/2]

◆ Add() [2/2]

◆ Add_GetRef() [1/2]

◆ Add_GetRef() [2/2]

◆ Append() [1/4]

template<typename InElementType , int32 InPageSizeInBytes, typename InAllocatorType >
void TPagedArray< InElementType, InPageSizeInBytes, InAllocatorType >::Append ( const ElementType InSource,
SizeType  InSize 
)
inline

◆ Append() [2/4]

◆ Append() [3/4]

template<typename InElementType , int32 InPageSizeInBytes, typename InAllocatorType >
template<typename ContainerType >
UE_FORCEINLINE_HINT void TPagedArray< InElementType, InPageSizeInBytes, InAllocatorType >::Append ( ContainerType &&  Container)
inline

◆ Append() [4/4]

template<typename InElementType , int32 InPageSizeInBytes, typename InAllocatorType >
void TPagedArray< InElementType, InPageSizeInBytes, InAllocatorType >::Append ( std::initializer_list< ElementType InList)
inline

◆ Assign() [1/4]

template<typename InElementType , int32 InPageSizeInBytes, typename InAllocatorType >
void TPagedArray< InElementType, InPageSizeInBytes, InAllocatorType >::Assign ( const ElementType InSource,
SizeType  InSize 
)
inline

Assigns the parameter contiguous range to this container. Any pre-existing content is removed.

◆ Assign() [2/4]

Assigns a compatible paged array to this container. Any pre-existing content is removed. Note TPagedArray doesn't meet TIsContiguousContainer traits so it won't use the contiguous container overload.

◆ Assign() [3/4]

template<typename InElementType , int32 InPageSizeInBytes, typename InAllocatorType >
template<typename ContainerType >
void TPagedArray< InElementType, InPageSizeInBytes, InAllocatorType >::Assign ( ContainerType &&  Container)
inline

◆ Assign() [4/4]

template<typename InElementType , int32 InPageSizeInBytes, typename InAllocatorType >
void TPagedArray< InElementType, InPageSizeInBytes, InAllocatorType >::Assign ( std::initializer_list< ElementType InList)
inline

◆ begin() [1/2]

◆ begin() [2/2]

STL IteratorType model compliance methods.

◆ CountBytes()

template<typename InElementType , int32 InPageSizeInBytes, typename InAllocatorType >
void TPagedArray< InElementType, InPageSizeInBytes, InAllocatorType >::CountBytes ( FArchive Ar) const
inline

Count bytes needed to serialize this paged array.

Parameters
ArArchive to count for.

◆ Emplace()

template<typename InElementType , int32 InPageSizeInBytes, typename InAllocatorType >
template<typename... ArgsType>
SizeType TPagedArray< InElementType, InPageSizeInBytes, InAllocatorType >::Emplace ( ArgsType &&...  Args)
inline

◆ Emplace_GetRef()

template<typename InElementType , int32 InPageSizeInBytes, typename InAllocatorType >
template<typename... ArgsType>
ElementType & TPagedArray< InElementType, InPageSizeInBytes, InAllocatorType >::Emplace_GetRef ( ArgsType &&...  Args)
inline

◆ Empty() [1/2]

◆ Empty() [2/2]

template<typename InElementType , int32 InPageSizeInBytes, typename InAllocatorType >
void TPagedArray< InElementType, InPageSizeInBytes, InAllocatorType >::Empty ( SizeType  InCapacity)
inline

◆ end() [1/2]

◆ end() [2/2]

◆ GetAllocatedSize()

template<typename InElementType , int32 InPageSizeInBytes, typename InAllocatorType >
SIZE_T TPagedArray< InElementType, InPageSizeInBytes, InAllocatorType >::GetAllocatedSize ( ) const
inline

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.

Returns
Number of bytes allocated by this container.

◆ IsEmpty()

◆ IsValidIndex()

◆ Last() [1/2]

◆ Last() [2/2]

template<typename InElementType , int32 InPageSizeInBytes, typename InAllocatorType >
const ElementType & TPagedArray< InElementType, InPageSizeInBytes, InAllocatorType >::Last ( ) const
inline

◆ Max()

◆ MaxPerPage()

template<typename InElementType , int32 InPageSizeInBytes, typename InAllocatorType >
static constexpr SizeType TPagedArray< InElementType, InPageSizeInBytes, InAllocatorType >::MaxPerPage ( )
inlinestaticconstexpr

◆ Num()

◆ NumPages()

◆ operator!=()

◆ operator=() [1/3]

◆ operator=() [2/3]

template<typename InElementType , int32 InPageSizeInBytes, typename InAllocatorType >
TPagedArray & TPagedArray< InElementType, InPageSizeInBytes, InAllocatorType >::operator= ( std::initializer_list< ElementType InList)
inline

◆ operator=() [3/3]

◆ operator==()

◆ operator[]() [1/2]

◆ operator[]() [2/2]

template<typename InElementType , int32 InPageSizeInBytes, typename InAllocatorType >
const ElementType & TPagedArray< InElementType, InPageSizeInBytes, InAllocatorType >::operator[] ( SizeType  Index) const
inline

◆ Pop() [1/2]

◆ Pop() [2/2]

◆ Push() [1/2]

◆ Push() [2/2]

◆ RemoveAtSwap() [1/2]

template<typename InElementType , int32 InPageSizeInBytes, typename InAllocatorType >
UE_FORCEINLINE_HINT void TPagedArray< InElementType, InPageSizeInBytes, InAllocatorType >::RemoveAtSwap ( SizeType  Index,
bool  bAllowShrinking 
)
inline

◆ RemoveAtSwap() [2/2]

Removes the element at the parameter index position and swaps the last element if existent to the same position to ensure the range is contiguous. This method provides efficient removal O(1) but it doesn't preserve the insertion order.

◆ Reserve()

template<typename InElementType , int32 InPageSizeInBytes, typename InAllocatorType >
void TPagedArray< InElementType, InPageSizeInBytes, InAllocatorType >::Reserve ( SizeType  InCount)
inline

◆ Reset() [1/2]

◆ Reset() [2/2]

template<typename InElementType , int32 InPageSizeInBytes, typename InAllocatorType >
void TPagedArray< InElementType, InPageSizeInBytes, InAllocatorType >::Reset ( SizeType  InCapacity)
inline

◆ SetMem()

template<typename InElementType , int32 InPageSizeInBytes, typename InAllocatorType >
void TPagedArray< InElementType, InPageSizeInBytes, InAllocatorType >::SetMem ( uint8  ByteValue)
inline

◆ SetNum() [1/2]

template<typename InElementType , int32 InPageSizeInBytes, typename InAllocatorType >
UE_FORCEINLINE_HINT void TPagedArray< InElementType, InPageSizeInBytes, InAllocatorType >::SetNum ( SizeType  NewNum,
bool  bAllowShrinking 
)
inline

◆ SetNum() [2/2]

Resizes array to the parameter number of elements. The allow shrinking parameter indicates whether the container page allocation can be reduced if possible.

◆ SetZero()

◆ ToArray() [1/2]

template<typename InElementType , int32 InPageSizeInBytes, typename InAllocatorType >
template<typename AnyAllocator >
void TPagedArray< InElementType, InPageSizeInBytes, InAllocatorType >::ToArray ( TArray< ElementType, AnyAllocator > &  OutDestination) &&
inline

◆ ToArray() [2/2]

template<typename InElementType , int32 InPageSizeInBytes, typename InAllocatorType >
template<typename AnyAllocator >
void TPagedArray< InElementType, InPageSizeInBytes, InAllocatorType >::ToArray ( TArray< ElementType, AnyAllocator > &  OutDestination) const &
inline

Friends And Related Symbol Documentation

◆ TPagedArray

template<typename InElementType , int32 InPageSizeInBytes, typename InAllocatorType >
template<typename AnyElementType , int32 AnyPageSizeInBytes, typename AnyAllocatorType >
friend class TPagedArray
friend

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