|
| FORCEINLINE ValueType & | Add (const KeyType &InKey) |
| | Sets a default value associated with a key. 更多...
|
| |
| FORCEINLINE ValueType & | Add (const KeyType &InKey, const ValueType &InValue) |
| | Sets the value associated with a key. 更多...
|
| |
| template<typename OtherArrayAllocator , typename OtherSortPredicate > |
| void | Append (const TSortedMap< KeyType, ValueType, OtherArrayAllocator, OtherSortPredicate > &OtherMap) |
| | Add all items from another map to our map (if any keys are in both, the value from the other map wins). 更多...
|
| |
| template<typename OtherArrayAllocator , typename OtherSortPredicate > |
| void | Append (TSortedMap< KeyType, ValueType, OtherArrayAllocator, OtherSortPredicate > &&OtherMap) |
| | 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. 更多...
|
| |
|
FORCEINLINE RangedForIteratorType | begin () |
| | DO NOT USE DIRECTLY STL-like iterators to enable range-based for loop support.
|
| |
| FORCEINLINE bool | Contains (KeyConstPointerType Key) const |
| | Checks if map contains the specified key. 更多...
|
| |
|
FORCEINLINE void | CountBytes (FArchive &Ar) const |
| | Tracks the container's memory use through an archive.
|
| |
|
FORCEINLINE TConstIterator | CreateConstIterator () const |
| | Creates a const iterator over all the pairs in this map
|
| |
| FORCEINLINE TConstKeyIterator | CreateConstKeyIterator (KeyInitType InKey) const |
| | Creates a const iterator over the values associated with a specified key in a map. 更多...
|
| |
|
FORCEINLINE TIterator | CreateIterator () |
| | Creates an iterator over all the pairs in this map
|
| |
| FORCEINLINE TKeyIterator | CreateKeyIterator (KeyInitType InKey) |
| | Creates an iterator over the values associated with a specified key in a map. 更多...
|
| |
| void | Dump (FOutputDevice &Ar) |
| | Describes the map's contents through an output device. 更多...
|
| |
| template<typename InitKeyType > |
| ValueType & | Emplace (InitKeyType &&InKey) |
| | Sets a default value associated with a key. 更多...
|
| |
| template<typename InitKeyType , typename InitValueType > |
| ValueType & | Emplace (InitKeyType &&InKey, InitValueType &&InValue) |
| | Sets the value associated with a key. 更多...
|
| |
| FORCEINLINE void | Empty (int32 ExpectedNumElements=0) |
| | Removes all elements from the map, potentially leaving space allocated for an expected number of elements about to be added. 更多...
|
| |
| FORCEINLINE ValueType * | Find (KeyConstPointerType Key) |
| | Returns the value associated with a specified key. 更多...
|
| |
| FORCEINLINE ValueType | FindAndRemoveChecked (KeyConstPointerType Key) |
| | Finds a pair with the specified key, removes it from the map, and returns the value part of the pair. 更多...
|
| |
| FORCEINLINE ValueType & | FindChecked (KeyConstPointerType Key) |
| | Returns a reference to the value associated with a specified key. 更多...
|
| |
| const KeyType * | FindKey (ValueInitType Value) const |
| | Returns the key associated with the specified value. 更多...
|
| |
| FORCEINLINE ValueType & | FindOrAdd (const KeyType &Key) |
| | Returns the value associated with a specified key, or if none exists, adds a value using the default constructor. 更多...
|
| |
| FORCEINLINE ValueType | FindRef (KeyConstPointerType Key) const |
| | Returns the value associated with a specified key. 更多...
|
| |
|
template<typename Allocator > |
| void | GenerateKeyArray (TArray< KeyType, Allocator > &OutArray) const |
| | Generates an array from the keys in this map.
|
| |
|
template<typename Allocator > |
| void | GenerateValueArray (TArray< ValueType, Allocator > &OutArray) const |
| | Generates an array from the values in this map.
|
| |
| FORCEINLINE SIZE_T | GetAllocatedSize () const |
| | Helper function to return the amount of memory allocated by this container. 更多...
|
| |
| template<typename Allocator > |
| int32 | GetKeys (TArray< KeyType, Allocator > &OutKeys) const |
| | Returns the unique keys contained within this map. 更多...
|
| |
| FORCEINLINE int32 | Num () const |
| |
| FORCEINLINE bool | operator!= (const TSortedMap &Other) const |
| | Inequality operator. 更多...
|
| |
|
template<typename OtherArrayAllocator > |
| TSortedMap & | operator= (const TSortedMap< KeyType, ValueType, OtherArrayAllocator, SortPredicate > &Other) |
| | Assignment operator for copying elements from a TSortedMap with a different ArrayAllocator.
|
| |
|
template<typename OtherArrayAllocator > |
| TSortedMap & | operator= (TSortedMap< KeyType, ValueType, OtherArrayAllocator, SortPredicate > &&Other) |
| | Assignment operator for moving elements from a TSortedMap with a different ArrayAllocator.
|
| |
| FORCEINLINE bool | operator== (const TSortedMap &Other) const |
| | Equality operator. 更多...
|
| |
| FORCEINLINE int32 | Remove (KeyConstPointerType InKey) |
| | Removes all value associations for a key. 更多...
|
| |
| FORCEINLINE bool | RemoveAndCopyValue (KeyInitType Key, ValueType &OutRemovedValue) |
| | Removes the pair with the specified key and copies the value that was removed to the ref parameter. 更多...
|
| |
|
FORCEINLINE void | Reserve (int32 Number) |
| | Preallocates enough memory to contain Number elements.
|
| |
|
FORCEINLINE void | Reset () |
| | Efficiently empties out the map but preserves all allocations and capacities.
|
| |
|
FORCEINLINE void | Shrink () |
| | Shrinks the pair set to avoid slack.
|
| |
|
template<typename OtherArrayAllocator > |
| | TSortedMap (const TSortedMap< KeyType, ValueType, OtherArrayAllocator, SortPredicate > &Other) |
| | Constructor for copying elements from a TSortedMap with a different ArrayAllocator.
|
| |
|
template<typename OtherArrayAllocator > |
| | TSortedMap (TSortedMap< KeyType, ValueType, OtherArrayAllocator, SortPredicate > &&Other) |
| | Constructor for moving elements from a TSortedMap with a different ArrayAllocator.
|
| |
template<typename KeyType, typename ValueType, typename ArrayAllocator, typename SortPredicate>
class TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >
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.