Navigation
API > API/Runtime > API/Runtime/Core
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:
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.
The contained elements' addresses are persistent as long as the container isn't resized.
| Name | TPagedArray |
| Type | class |
| Header File | /Engine/Source/Runtime/Core/Public/Containers/PagedArray.h |
| Include Path | #include "Containers/PagedArray.h" |
Syntax
template<typename InElementType, int32 InPageSizeInBytes, typename InAllocatorType>
class TPagedArray
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
TPagedArray () |
Containers/PagedArray.h | ||
TPagedArray
(
TPagedArray&& Other |
Containers/PagedArray.h | ||
TPagedArray
(
const TPagedArray& Other |
Containers/PagedArray.h | ||
TPagedArray
(
std::initializer_list< ElementType > InList |
Containers/PagedArray.h | ||
TPagedArray
(
const ElementType* InSource, |
Containers/PagedArray.h |
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
~TPagedArray() |
Containers/PagedArray.h |
Typedefs
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| AllocatorType | InAllocatorType | Containers/PagedArray.h | |
| ConstIteratorType | UE::Core::PagedArray::Private::TIterator< const ElementType, const PageType, PageTraits > | Containers/PagedArray.h | |
| ElementAllocatorType | std::conditional_t< AllocatorType::NeedsElementType, typename AllocatorType::template ForElementType< ElementType >, typename AllocatorType::ForAnyElementType > | Containers/PagedArray.h | |
| ElementType | InElementType | Containers/PagedArray.h | |
| IteratorType | UE::Core::PagedArray::Private::TIterator< ElementType, PageType, PageTraits > | Containers/PagedArray.h | |
| PageTraits | UE::Core::PagedArray::Private::TPageTraits< InElementType, InPageSizeInBytes > | Containers/PagedArray.h | |
| PageType | TArray< InElementType, InAllocatorType > | Containers/PagedArray.h | |
| SizeType | typename InAllocatorType::SizeType | Containers/PagedArray.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| Count | SizeType | Containers/PagedArray.h | ||
| Pages | TArray< PageType > | Containers/PagedArray.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
SizeType Add
(
ElementType&& Element |
Containers/PagedArray.h | ||
SizeType Add
(
const ElementType& Element |
Adds the parameter element at the back of the container. | Containers/PagedArray.h | |
ElementType & Add_GetRef
(
ElementType&& Element |
Containers/PagedArray.h | ||
ElementType & Add_GetRef
(
const ElementType& Element |
Containers/PagedArray.h | ||
void Append
(
const ElementType* InSource, |
Appends the parameter contiguous range to this container. | Containers/PagedArray.h | |
void Append
(
const TPagedArray< ElementType, OtherPageSizeInBytes, OtherAllocator >& Other |
Appends a compatible paged array to this container. | Containers/PagedArray.h | |
void Append
(
ContainerType&& Container |
Containers/PagedArray.h | ||
void Append
(
std::initializer_list< ElementType > InList |
Containers/PagedArray.h | ||
void Assign
(
const ElementType* InSource, |
Assigns the parameter contiguous range to this container. Any pre-existing content is removed. | Containers/PagedArray.h | |
void Assign
(
ContainerType&& Container |
Containers/PagedArray.h | ||
void Assign
(
std::initializer_list< ElementType > InList |
Containers/PagedArray.h | ||
void Assign
(
const TPagedArray< ElementType, OtherPageSizeInBytes, OtherAllocator >& Other |
Assigns a compatible paged array to this container. | Containers/PagedArray.h | |
IteratorType begin () |
Containers/PagedArray.h | ||
ConstIteratorType begin () |
STL IteratorType model compliance methods. | Containers/PagedArray.h | |
void CountBytes
(
FArchive& Ar |
Count bytes needed to serialize this paged array. | Containers/PagedArray.h | |
SizeType Emplace
(
ArgsType&&... Args |
Constructs an element in place using the parameter arguments and adds it at the back of the container. | Containers/PagedArray.h | |
ElementType & Emplace_GetRef
(
ArgsType&&... Args |
Constructs an element in place using the parameter arguments and adds it at the back of the container. | Containers/PagedArray.h | |
void Empty () |
Empties the container effectively destroying all contained elements and releases any acquired storage. | Containers/PagedArray.h | |
void Empty
(
SizeType InCapacity |
Empties the container effectively destroying all contained elements and ensures storage for the parameter capacity. | Containers/PagedArray.h | |
IteratorType end () |
Containers/PagedArray.h | ||
ConstIteratorType end () |
Containers/PagedArray.h | ||
SIZE_T GetAllocatedSize () |
Helper function to return the amount of memory allocated by this container. | Containers/PagedArray.h | |
bool IsEmpty() |
Containers/PagedArray.h | ||
bool IsValidIndex
(
SizeType Index |
Containers/PagedArray.h | ||
const ElementType & Last () |
Containers/PagedArray.h | ||
ElementType & Last () |
Containers/PagedArray.h | ||
SizeType Max() |
Containers/PagedArray.h | ||
SizeType Num() |
Containers/PagedArray.h | ||
SizeType NumPages() |
Containers/PagedArray.h | ||
void Pop
(
EAllowShrinking AllowShrinking |
Removes the last element in the container. | Containers/PagedArray.h | |
void Pop
(
bool bAllowShrinking |
Containers/PagedArray.h | ||
void Push
(
const ElementType& Element |
Containers/PagedArray.h | ||
void Push
(
ElementType&& Element |
Containers/PagedArray.h | ||
void RemoveAtSwap
(
SizeType Index, |
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. | Containers/PagedArray.h | |
void RemoveAtSwap
(
SizeType Index, |
Containers/PagedArray.h | ||
void Reserve
(
SizeType InCount |
Reserves storage for the parameter element count. | Containers/PagedArray.h | |
void Reset () |
Destroys all contained elements but doesn't release the container's storage. | Containers/PagedArray.h | |
void Reset
(
SizeType InCapacity |
Destroys all contained elements and ensures storage for the parameter capacity. | Containers/PagedArray.h | |
void SetMem
(
uint8 ByteValue |
Fills the memory used by the container elements with the parameter byte value. | Containers/PagedArray.h | |
void SetNum
(
SizeType NewNum, |
Containers/PagedArray.h | ||
void SetNum
(
SizeType NewNum, |
Resizes array to the parameter number of elements. | Containers/PagedArray.h | |
void SetZero() |
Sets the memory used by the container elements to zero. | Containers/PagedArray.h | |
| Copies this container elements into the parameter destination array. | Containers/PagedArray.h | ||
| Moves this container elements into the parameter destination array. | Containers/PagedArray.h |
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
static SizeType GetPageIndex
(
SizeType Index |
Containers/PagedArray.h | ||
static SizeType GetPageOffset
(
SizeType Index |
Containers/PagedArray.h | ||
static SizeType MaxPerPage() |
Containers/PagedArray.h | ||
static SizeType NumRequiredPages
(
SizeType Count |
Containers/PagedArray.h |
Operators
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
bool operator!=
(
const TPagedArray& Right |
Containers/PagedArray.h | ||
const ElementType & operator[]
(
SizeType Index |
Containers/PagedArray.h | ||
ElementType & operator[]
(
SizeType Index |
Containers/PagedArray.h | ||
TPagedArray & operator=
(
TPagedArray&& Other |
Containers/PagedArray.h | ||
TPagedArray & operator=
(
std::initializer_list< ElementType > InList |
Containers/PagedArray.h | ||
TPagedArray & operator=
(
const TPagedArray& Other |
Containers/PagedArray.h | ||
bool operator==
(
const TPagedArray& Right |
Friend operators. | Containers/PagedArray.h |