Choose your operating system:
Windows
macOS
Linux
| TSortedMap
|
Module |
|
Header |
/Engine/Source/Runtime/Core/Public/Containers/SortedMap.h |
Include |
#include "Containers/SortedMap.h" |
template<typename KeyType, typename ValueType, typename ArrayAllocator, typename SortPredicate>
class TSortedMap
A Map of keys to value, implemented as a sorted TArray of TPairs.
It has a mostly identical interface to TMap and is designed as a drop in replacement. Keys must be unique, there is no equivalent sorted version of TMultiMap. It uses half as much memory as TMap, but adding and removing elements is O(n), and finding is O(Log n). In practice it is faster than TMap for low element counts, and slower as n increases, This map is always kept sorted by the key type so cannot be sorted manually.
Name | Description | |
---|---|---|
|
TSortedMap() |
|
|
TSortedMap ( |
|
|
TSortedMap ( |
|
|
TSortedMap ( |
Constructor for moving elements from a TSortedMap with a different ArrayAllocator. |
|
TSortedMap ( |
Constructor for copying elements from a TSortedMap with a different ArrayAllocator. |
Name | Description | ||
---|---|---|---|
|
ValueType & |
Add ( |
|
|
ValueType & |
Add ( |
|
|
ValueType & |
Add ( |
|
|
ValueType & |
Add ( |
Sets the value associated with a key. |
|
ValueType & |
Add ( |
|
|
ValueType & |
Add ( |
Sets a default value associated with a key. |
|
Append ( |
Add all items from another map to our map (if any keys are in both, the value from the other map wins). |
|
|
Append ( |
Move all items from another map into our map (if any keys are in both, the value from the other map wins) and empty the other map. |
|
|
RangedForCon... |
begin() |
|
|
RangedForIte... |
begin() |
DO NOT USE DIRECTLY STL-like iterators to enable range-based for loop support. |
|
Contains ( |
Checks if map contains the specified key. |
|
|
CountBytes ( |
Tracks the container's memory use through an archive. |
|
|
TConstIterat... |
CreateConstIterator() |
Creates a const iterator over all the pairs in this map |
|
TConstKeyIte... |
CreateConstKeyIterator ( |
Creates a const iterator over the values associated with a specified key in a map. |
|
CreateIterator() |
Creates an iterator over all the pairs in this map |
|
|
CreateKeyIterator ( |
Creates an iterator over the values associated with a specified key in a map. |
|
|
Dump ( |
Describes the map's contents through an output device. |
|
|
ValueType & |
Emplace ( |
Sets a default value associated with a key. |
|
ValueType & |
Emplace ( |
Sets the value associated with a key. |
|
Empty ( |
Removes all elements from the map, potentially leaving space allocated for an expected number of elements about to be added. |
|
|
RangedForCon... |
end() |
|
|
RangedForIte... |
end() |
|
|
const ValueT... |
Find ( |
|
|
ValueType &#... |
Find ( |
Returns the value associated with a specified key. |
|
ValueType |
FindAndRemoveChecked ( |
Finds a pair with the specified key, removes it from the map, and returns the value part of the pair. |
|
ValueType & |
FindChecked ( |
Returns a reference to the value associated with a specified key. |
|
const ValueT... |
FindChecked ( |
|
|
const KeyTyp... |
FindKey ( |
Returns the key associated with the specified value. The time taken is O(N) in the number of pairs. |
|
ValueType & |
FindOrAdd ( |
Returns the value associated with a specified key, or if none exists, adds a value using the default constructor. |
|
ValueType & |
FindOrAdd ( |
|
|
ValueType |
FindRef ( |
Returns the value associated with a specified key. |
|
GenerateKeyArray |
Generates an array from the keys in this map. |
|
|
GenerateValueArray |
Generates an array from the values in this map. |
|
|
GetAllocatedSize() |
Helper function to return the amount of memory allocated by this container. |
|
|
GetKeys |
Returns the unique keys contained within this map. |
|
|
IsEmpty() |
Returns true if the map is empty and contains no elements. |
|
|
Num() |
||
|
Remove ( |
Removes all value associations for a key. |
|
|
RemoveAndCopyValue ( |
Removes the pair with the specified key and copies the value that was removed to the ref parameter. |
|
|
Reserve ( |
Preallocates enough memory to contain Number elements. |
|
|
Reset() |
Efficiently empties out the map but preserves all allocations and capacities. |
|
|
Shrink() |
Shrinks the pair set to avoid slack. |
Name | Description | ||
---|---|---|---|
|
operator!= ( |
Inequality operator. This is efficient because pairs are always sorted. |
|
|
ValueType & |
operator[] ( |
|
|
const ValueT... |
operator[] ( |
|
|
operator= ( |
||
|
operator= ( |
Assignment operator for copying elements from a TSortedMap with a different ArrayAllocator. |
|
|
operator= ( |
||
|
operator= ( |
Assignment operator for moving elements from a TSortedMap with a different ArrayAllocator. |
|
|
operator== ( |
Equality operator. This is efficient because pairs are always sorted. |
Name |
Description |
|
---|---|---|
|
TConstIterator |
Const map iterator |
|
TConstKeyIterator |
Iterates over values associated with a specified key in a const map. |
|
TConstReverseIterator |
Const map iterator |
|
TIterator |
Map iterator |
|
TKeyIterator |
Iterates over values associated with a specified key in a map. |
|
TReverseIterator |
Reverse Map iterator |
Name |
Description |
---|---|
ElementArrayType |
|
ElementType |
|
KeyConstPointerType |
|
KeyInitType |
|
RangedForConstIteratorType |
|
RangedForIteratorType |
Ranged For iterators. |
ValueInitType |