Navigation
API > API/Runtime > API/Runtime/Core > API/Runtime/Core/Containers
References
| Module | Core |
| Header | /Engine/Source/Runtime/Core/Public/Containers/PagedArray.h |
| Include | #include "Containers/PagedArray.h" |
Syntax
template<typename InElementType, int32 InPageSizeInBytes, typename InAllocatorType>
class TPagedArray
Remarks
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.
Constructors
| Type | Name | Description | |
|---|---|---|---|
TPagedArray () |
|||
TPagedArray
(
TPagedArray&& Other |
|||
TPagedArray
(
const TPagedArray& Other |
|||
TPagedArray
(
std::initializer_list< ElementType > InList |
|||
TPagedArray
(
const ElementType* InSource, |
Destructors
| Type | Name | Description | |
|---|---|---|---|
~TPagedArray () |
Functions
| Type | Name | Description | |
|---|---|---|---|
| SizeType | Add
(
ElementType&& Element |
||
| SizeType | Add
(
const ElementType& Element |
Adds the parameter element at the back of the container. | |
| ElementType & | Add_GetRef
(
ElementType&& Element |
||
| ElementType & | Add_GetRef
(
const ElementType& Element |
||
| void | Append
(
const ElementType* InSource, |
Appends the parameter contiguous range to this container. | |
| void | Append
(
const TPagedArray< ElementType, OtherPageSizeInBytes, OtherAllocator >& Other |
Appends a compatible paged array to this container. | |
| void | Append
(
ContainerType&& Container |
||
| void | Append
(
std::initializer_list< ElementType > InList |
||
| void | Assign
(
const ElementType* InSource, |
Assigns the parameter contiguous range to this container. Any pre-existing content is removed. | |
| void | Assign
(
const TPagedArray< ElementType, OtherPageSizeInBytes, OtherAllocator >& Other |
Assigns a compatible paged array to this container. | |
| void | Assign
(
ContainerType&& Container |
||
| void | Assign
(
std::initializer_list< ElementType > InList |
||
| ConstIteratorType | begin () |
STL IteratorType model compliance methods. | |
| IteratorType | begin () |
||
| void | CountBytes
(
FArchive& Ar |
Count bytes needed to serialize this paged array. | |
| SizeType | Emplace
(
ArgsType&&... Args |
Constructs an element in place using the parameter arguments and adds it at the back of the container. | |
| ElementType & | Emplace_GetRef
(
ArgsType&&... Args |
Constructs an element in place using the parameter arguments and adds it at the back of the container. | |
| void | Empties the container effectively destroying all contained elements and ensures storage for the parameter capacity. | ||
| void | Empty () |
Empties the container effectively destroying all contained elements and releases any acquired storage. | |
| ConstIteratorType | end () |
||
| IteratorType | end () |
||
| SIZE_T | Helper function to return the amount of memory allocated by this container. | ||
| bool | IsEmpty () |
||
| const ElementType & | Last () |
||
| ElementType & | Last () |
||
| SizeType | Max () |
||
| constexpr SizeType | MaxPerPage () |
||
| SizeType | Num () |
||
| SizeType | NumPages () |
||
| void | Pop
(
bool bAllowShrinking |
Removes the last element in the container. | |
| void | Push
(
const ElementType& Element |
||
| void | Push
(
ElementType&& Element |
||
| 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. | |
| void | Reserves storage for the parameter element count. | ||
| void | Reset () |
Destroys all contained elements but doesn't release the container's storage. | |
| void | Destroys all contained elements and ensures storage for the parameter capacity. | ||
| void | SetMem
(
uint8 ByteValue |
Fills the memory used by the container elements with the parameter byte value. | |
| void | Resizes array to the parameter number of elements. | ||
| void | SetZero () |
Sets the memory used by the container elements to zero. | |
| void | ToArray
(
TArray< ElementType, AnyAllocator >& OutDestination |
Copies this container elements into the parameter destination array. | |
| void | ToArray
(
TArray< ElementType, AnyAllocator >& OutDestination |
Moves this container elements into the parameter destination array. |
Operators
| Type | Name | Description | |
|---|---|---|---|
| bool | operator!=
(
const TPagedArray& Right |
||
| ElementType & | operator[]
(
SizeType Index |
||
| const ElementType & | operator[]
(
SizeType Index |
||
| TPagedArray & | operator=
(
const TPagedArray& Other |
||
| TPagedArray & | operator=
(
std::initializer_list< ElementType > InList |
||
| TPagedArray & | operator=
(
TPagedArray&& Other |
||
| bool | operator==
(
const TPagedArray& Right |
Friend operators. |