Navigation
API > API/Runtime > API/Runtime/Core
A set of values, implemented as a sorted TArray of elements.
It has a mostly identical interface to TSet and is designed as a drop in replacement. Keys must be unique. It uses half as much memory as TSet and has a smaller static footprint, but adding and removing elements is O(n), and finding is O(Log n). In practice it is faster than TSet for low element counts, and slower as n increases. This set is always kept sorted by key so cannot be sorted manually.
| Name | TSortedSet |
| Type | class |
| Header File | /Engine/Source/Runtime/Core/Public/Containers/SortedSet.h |
| Include Path | #include "Containers/SortedSet.h" |
Syntax
template<typename InElementType, typename ArrayAllocator, typename SortPredicate>
class TSortedSet
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
TSortedSet () |
Containers/SortedSet.h | ||
TSortedSet
(
TSortedSet&& |
Containers/SortedSet.h | ||
TSortedSet
(
const TSortedSet& |
Containers/SortedSet.h | ||
TSortedSet
(
TSortedSet< InElementType, OtherArrayAllocator, SortPredicate >&& Other |
Constructor for moving elements from a TSortedSet with a different ArrayAllocator. | Containers/SortedSet.h | |
TSortedSet
(
const TSortedSet< InElementType, OtherArrayAllocator, SortPredicate >& Other |
Constructor for copying elements from a TSortedSet with a different ArrayAllocator. | Containers/SortedSet.h | |
TSortedSet
(
std::initializer_list< ElementType > InitList |
Constructor which gets its elements from a native initializer list | Containers/SortedSet.h | |
| Containers/SortedSet.h |
Classes
| Name | Remarks |
|---|---|
| TBaseIterator | The base of TSortedSet iterators |
| TConstIterator | Const set iterator |
| TIterator | Set iterator |
Typedefs
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| ElementArrayType | TArray< ElementType, ArrayAllocator > | Containers/SortedSet.h | |
| ElementType | InElementType | Containers/SortedSet.h | |
| IntrusiveUnsetOptionalStateType | TSortedSet | Containers/SortedSet.h | |
| KeyInitType | typename TTypeTraits< ElementType >::ConstPointerType | Containers/SortedSet.h |
Constants
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| bHasIntrusiveUnsetOptionalState | bool | Start - intrusive TOptional |
Containers/SortedSet.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| Elements | ElementArrayType | An array of the elements in the set | Containers/SortedSet.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FSetElementId Add
(
ElementType&& InValue, |
Containers/SortedSet.h | ||
FSetElementId Add
(
const ElementType& InValue, |
Adds an element to the set. | Containers/SortedSet.h | |
void Append
(
std::initializer_list< ElementType > Other |
Containers/SortedSet.h | ||
void Append
(
TArrayView< const ElementType > Other |
Containers/SortedSet.h | ||
| Containers/SortedSet.h | |||
void Append
(
const TSortedSet< ElementType, OtherArrayAllocator, OtherSortPredicate >& Other |
Containers/SortedSet.h | ||
void Append
(
TSortedSet< ElementType, OtherArrayAllocator, OtherSortPredicate >&& Other |
Adds all items from another set into our set (if any elements are in both, the value from the other set wins). | Containers/SortedSet.h | |
| Containers/SortedSet.h | |||
| Returns a TArray of the elements. | Containers/SortedSet.h | ||
auto begin () |
DO NOT USE DIRECTLY STL-like iterators to enable range-based for loop support. | Containers/SortedSet.h | |
auto begin () |
Containers/SortedSet.h | ||
bool Contains
(
KeyInitType Key |
Checks if set contains the specified key. | Containers/SortedSet.h | |
void CountBytes
(
FArchive& Ar |
Tracks the container's memory use through an archive. | Containers/SortedSet.h | |
TConstIterator CreateConstIterator() |
Creates a const iterator over all the elements in this set | Containers/SortedSet.h | |
TIterator CreateIterator() |
Creates an iterator over all the elements in this set | Containers/SortedSet.h | |
void Dump
(
FOutputDevice& Ar |
Describes the set's contents through an output device. | Containers/SortedSet.h | |
FSetElementId Emplace
(
InitArgType&& InInitArg, |
Adds an element to the set. | Containers/SortedSet.h | |
void Empty
(
int32 ExpectedNumElements |
Removes all elements from the set, potentially leaving space allocated for an expected number of elements about to be added. | Containers/SortedSet.h | |
auto end () |
Containers/SortedSet.h | ||
auto end () |
Containers/SortedSet.h | ||
ElementType * Find
(
KeyInitType Key |
Returns the value associated with a specified key. | Containers/SortedSet.h | |
const ElementType * Find
(
KeyInitType Key |
Containers/SortedSet.h | ||
ElementType * FindArbitraryElement () |
Finds any element in the set and returns a pointer to it. | Containers/SortedSet.h | |
const ElementType * FindArbitraryElement () |
Containers/SortedSet.h | ||
ElementType & FindOrAdd
(
const ElementType& InValue, |
Adds an element to the set if not already present and returns a reference to the added or existing element. | Containers/SortedSet.h | |
ElementType & FindOrAdd
(
ElementType&& InValue, |
Containers/SortedSet.h | ||
ElementType & Get
(
FSetElementId Id |
Containers/SortedSet.h | ||
const ElementType & Get
(
FSetElementId Id |
Containers/SortedSet.h | ||
SIZE_T GetAllocatedSize () |
Helper function to return the amount of memory allocated by this container. | Containers/SortedSet.h | |
int32 GetMaxIndex() |
Containers/SortedSet.h | ||
bool IsEmpty () |
Returns true if the set is empty and contains no elements. | Containers/SortedSet.h | |
bool IsValidId
(
FSetElementId Id |
Checks whether an element id is valid. | Containers/SortedSet.h | |
int32 Max() |
Containers/SortedSet.h | ||
int32 Num() |
Containers/SortedSet.h | ||
int32 Remove
(
KeyInitType InKey |
Removes all elements from the set matching the specified key. | Containers/SortedSet.h | |
void Reserve
(
int32 Number |
Preallocates enough memory to contain Number elements. | Containers/SortedSet.h | |
void Reset() |
Efficiently empties out the set but preserves all allocations and capacities. | Containers/SortedSet.h | |
void Shrink() |
Shrinks the set to avoid slack. | Containers/SortedSet.h |
Operators
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
bool operator!=
(
const TSortedSet& Other |
Inequality operator. This is efficient because elements are always sorted. | Containers/SortedSet.h | |
const ElementType & operator[]
(
FSetElementId Id |
Containers/SortedSet.h | ||
ElementType & operator[]
(
FSetElementId Id |
Containers/SortedSet.h | ||
TSortedSet & operator=
(
const TSortedSet< ElementType, OtherArrayAllocator, SortPredicate >& Other |
Assignment operator for copying elements from a TSortedSet with a different ArrayAllocator. | Containers/SortedSet.h | |
TSortedSet & operator=
(
TSortedSet< ElementType, OtherArrayAllocator, SortPredicate >&& Other |
End - intrusive TOptional |
Containers/SortedSet.h | |
TSortedSet & operator=
(
const TSortedSet& |
Containers/SortedSet.h | ||
TSortedSet & operator=
(
TSortedSet&& |
Containers/SortedSet.h | ||
TSortedSet & operator=
(
std::initializer_list< ElementType > InitList |
Assignment operator which gets its elements from a native initializer list | Containers/SortedSet.h | |
bool operator==
(
const TSortedSet& Other |
Equality operator. This is efficient because elements are always sorted. | Containers/SortedSet.h | |
bool operator==
(
FIntrusiveUnsetOptionalState Tag |
Containers/SortedSet.h |