Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate > Class Template Reference

#include <SortedMap.h>

+ Collaboration diagram for TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >:

Classes

struct  FKeyForward
 
class  TBaseIterator
 
class  TBaseReverseIterator
 
class  TConstIterator
 
class  TConstKeyIterator
 
class  TConstReverseIterator
 
class  TIterator
 
class  TKeyIterator
 
class  TReverseIterator
 

Public Types

typedef TTypeTraits< KeyType >::ConstPointerType KeyConstPointerType
 
typedef TTypeTraits< KeyType >::ConstInitType KeyInitType
 
typedef TTypeTraits< ValueType >::ConstInitType ValueInitType
 
typedef TPair< KeyType, ValueType > ElementType
 
typedef ElementArrayType::RangedForIteratorType RangedForIteratorType
 
typedef ElementArrayType::RangedForConstIteratorType RangedForConstIteratorType
 

Public Member Functions

 TSortedMap ()=default
 
 TSortedMap (TSortedMap &&)=default
 
 TSortedMap (const TSortedMap &)=default
 
TSortedMapoperator= (TSortedMap &&)=default
 
TSortedMapoperator= (const TSortedMap &)=default
 
template<typename OtherArrayAllocator >
 TSortedMap (TSortedMap< KeyType, ValueType, OtherArrayAllocator, SortPredicate > &&Other)
 
template<typename OtherArrayAllocator >
 TSortedMap (const TSortedMap< KeyType, ValueType, OtherArrayAllocator, SortPredicate > &Other)
 
 TSortedMap (std::initializer_list< TPairInitializer< const KeyType &, const ValueType & > > InitList)
 
template<typename OtherArrayAllocator >
TSortedMapoperator= (TSortedMap< KeyType, ValueType, OtherArrayAllocator, SortPredicate > &&Other)
 
template<typename OtherArrayAllocator >
TSortedMapoperator= (const TSortedMap< KeyType, ValueType, OtherArrayAllocator, SortPredicate > &Other)
 
TSortedMapoperator= (std::initializer_list< TPairInitializer< const KeyType &, const ValueType & > > InitList)
 
FORCEINLINE bool operator== (const TSortedMap &Other) const
 
FORCEINLINE bool operator!= (const TSortedMap &Other) const
 
FORCEINLINE void Empty (int32 ExpectedNumElements=0)
 
FORCEINLINE void Reset ()
 
FORCEINLINE void Shrink ()
 
FORCEINLINE void Reserve (int32 Number)
 
bool IsEmpty () const
 
FORCEINLINE int32 Num () const
 
FORCEINLINE SIZE_T GetAllocatedSize () const
 
FORCEINLINE void CountBytes (FArchive &Ar) const
 
FORCEINLINE ValueType & Add (const KeyType &InKey, const ValueType &InValue)
 
FORCEINLINE ValueType & Add (const KeyType &InKey, ValueType &&InValue)
 
FORCEINLINE ValueType & Add (KeyType &&InKey, const ValueType &InValue)
 
FORCEINLINE ValueType & Add (KeyType &&InKey, ValueType &&InValue)
 
FORCEINLINE ValueType & Add (const KeyType &InKey)
 
FORCEINLINE ValueType & Add (KeyType &&InKey)
 
template<typename InitKeyType = KeyType, typename InitValueType = ValueType>
ValueType & Emplace (InitKeyType &&InKey, InitValueType &&InValue)
 
template<typename InitKeyType = KeyType>
ValueType & Emplace (InitKeyType &&InKey)
 
FORCEINLINE int32 Remove (KeyConstPointerType InKey)
 
const KeyType * FindKey (ValueInitType Value) const
 
FORCEINLINE ValueType * Find (KeyConstPointerType Key)
 
FORCEINLINE const ValueType * Find (KeyConstPointerType Key) const
 
FORCEINLINE ValueType & FindOrAdd (const KeyType &Key)
 
FORCEINLINE ValueType & FindOrAdd (KeyType &&Key)
 
FORCEINLINE ValueType & FindChecked (KeyConstPointerType Key)
 
FORCEINLINE const ValueType & FindChecked (KeyConstPointerType Key) const
 
FORCEINLINE ValueType FindRef (KeyConstPointerType Key) const
 
FORCEINLINE bool Contains (KeyConstPointerType Key) const
 
template<typename Allocator >
int32 GetKeys (TArray< KeyType, Allocator > &OutKeys) const
 
template<typename Allocator >
void GenerateKeyArray (TArray< KeyType, Allocator > &OutArray) const
 
template<typename Allocator >
void GenerateValueArray (TArray< ValueType, Allocator > &OutArray) const
 
void Dump (FOutputDevice &Ar)
 
FORCEINLINE bool RemoveAndCopyValue (KeyInitType Key, ValueType &OutRemovedValue)
 
FORCEINLINE ValueType FindAndRemoveChecked (KeyConstPointerType Key)
 
template<typename OtherArrayAllocator , typename OtherSortPredicate >
void Append (TSortedMap< KeyType, ValueType, OtherArrayAllocator, OtherSortPredicate > &&OtherMap)
 
template<typename OtherArrayAllocator , typename OtherSortPredicate >
void Append (const TSortedMap< KeyType, ValueType, OtherArrayAllocator, OtherSortPredicate > &OtherMap)
 
FORCEINLINE ValueType & operator[] (KeyConstPointerType Key)
 
FORCEINLINE const ValueType & operator[] (KeyConstPointerType Key) const
 
FORCEINLINE TIterator CreateIterator ()
 
FORCEINLINE TConstIterator CreateConstIterator () const
 
FORCEINLINE TKeyIterator CreateKeyIterator (KeyInitType InKey)
 
FORCEINLINE TConstKeyIterator CreateConstKeyIterator (KeyInitType InKey) const
 
FORCEINLINE RangedForIteratorType begin ()
 
FORCEINLINE RangedForConstIteratorType begin () const
 
FORCEINLINE RangedForIteratorType end ()
 
FORCEINLINE RangedForConstIteratorType end () const
 

Private Types

typedef TArray< ElementType, ArrayAllocatorElementArrayType
 

Private Member Functions

template<typename ArgType >
FORCEINLINE ValueType & FindOrAddImpl (ArgType &&Key)
 
FORCEINLINE int32 FindIndex (KeyConstPointerType Key)
 
template<typename InitKeyType >
FORCEINLINE ElementTypeAllocateMemoryForEmplace (InitKeyType &&InKey)
 

Private Attributes

ElementArrayType Pairs
 

Friends

template<typename OtherKeyType , typename OtherValueType , typename OtherArrayAllocator , typename OtherSortPredicate >
class TSortedMap
 
struct TSortedMapPrivateFriend
 

Detailed Description

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.

Definition at line 19 of file SortedMap.h.

Member Typedef Documentation

◆ ElementArrayType

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
typedef TArray<ElementType, ArrayAllocator> TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::ElementArrayType
private

Definition at line 460 of file SortedMap.h.

◆ ElementType

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
typedef TPair<KeyType, ValueType> TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::ElementType

Definition at line 28 of file SortedMap.h.

◆ KeyConstPointerType

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
typedef TTypeTraits<KeyType>::ConstPointerType TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::KeyConstPointerType

Definition at line 25 of file SortedMap.h.

◆ KeyInitType

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
typedef TTypeTraits<KeyType>::ConstInitType TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::KeyInitType

Definition at line 26 of file SortedMap.h.

◆ RangedForConstIteratorType

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
typedef ElementArrayType::RangedForConstIteratorType TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::RangedForConstIteratorType

Definition at line 757 of file SortedMap.h.

◆ RangedForIteratorType

Ranged For iterators. Unlike normal TMap these are not the same as the normal iterator for performance reasons

Definition at line 756 of file SortedMap.h.

◆ ValueInitType

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
typedef TTypeTraits<ValueType>::ConstInitType TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::ValueInitType

Definition at line 27 of file SortedMap.h.

Constructor & Destructor Documentation

◆ TSortedMap() [1/6]

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::TSortedMap ( )
default

◆ TSortedMap() [2/6]

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::TSortedMap ( TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate > && )
default

◆ TSortedMap() [3/6]

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::TSortedMap ( const TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate > & )
default

◆ TSortedMap() [4/6]

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::TSortedMap ( TSortedMap< KeyType, ValueType, OtherArrayAllocator, SortPredicate > && Other)
inline

Constructor for moving elements from a TSortedMap with a different ArrayAllocator.

Definition at line 38 of file SortedMap.h.

◆ TSortedMap() [5/6]

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::TSortedMap ( const TSortedMap< KeyType, ValueType, OtherArrayAllocator, SortPredicate > & Other)
inline

Constructor for copying elements from a TSortedMap with a different ArrayAllocator.

Definition at line 45 of file SortedMap.h.

◆ TSortedMap() [6/6]

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::TSortedMap ( std::initializer_list< TPairInitializer< const KeyType &, const ValueType & > > InitList)
inline

Constructor which gets its elements from a native initializer list

Definition at line 51 of file SortedMap.h.

Member Function Documentation

◆ Add() [1/6]

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
FORCEINLINE ValueType & TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::Add ( const KeyType & InKey)
inline

Sets a default value associated with a key.

Parameters
InKeyThe key to associate the value with.
Returns
A reference to the value as stored in the map. The reference is only valid until the next change to any key in the map.

Definition at line 179 of file SortedMap.h.

◆ Add() [2/6]

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
FORCEINLINE ValueType & TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::Add ( const KeyType & InKey,
const ValueType & InValue )
inline

Sets the value associated with a key.

Parameters
InKeyThe key to associate the value with.
InValueThe value to associate with the key.
Returns
A reference to the value as stored in the map (only valid until the next change to any key in the map).

Definition at line 168 of file SortedMap.h.

◆ Add() [3/6]

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
FORCEINLINE ValueType & TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::Add ( const KeyType & InKey,
ValueType && InValue )
inline

Definition at line 169 of file SortedMap.h.

◆ Add() [4/6]

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
FORCEINLINE ValueType & TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::Add ( KeyType && InKey)
inline

Definition at line 180 of file SortedMap.h.

◆ Add() [5/6]

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
FORCEINLINE ValueType & TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::Add ( KeyType && InKey,
const ValueType & InValue )
inline

Definition at line 170 of file SortedMap.h.

◆ Add() [6/6]

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
FORCEINLINE ValueType & TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::Add ( KeyType && InKey,
ValueType && InValue )
inline

Definition at line 171 of file SortedMap.h.

◆ AllocateMemoryForEmplace()

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
template<typename InitKeyType >
FORCEINLINE ElementType * TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::AllocateMemoryForEmplace ( InitKeyType && InKey)
inlineprivate

Allocates raw memory for emplacing

Definition at line 482 of file SortedMap.h.

◆ Append() [1/2]

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
void TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::Append ( const TSortedMap< KeyType, ValueType, OtherArrayAllocator, OtherSortPredicate > & OtherMap)
inline

Add all items from another map to our map (if any keys are in both, the value from the other map wins).

Parameters
OtherMapThe other map of items to add.

Definition at line 447 of file SortedMap.h.

◆ Append() [2/2]

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
void TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::Append ( TSortedMap< KeyType, ValueType, OtherArrayAllocator, OtherSortPredicate > && OtherMap)
inline

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.

Parameters
OtherMapThe other map of items to move the elements from.

Definition at line 430 of file SortedMap.h.

◆ begin() [1/2]

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
FORCEINLINE RangedForIteratorType TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::begin ( )
inline

DO NOT USE DIRECTLY STL-like iterators to enable range-based for loop support.

Definition at line 764 of file SortedMap.h.

◆ begin() [2/2]

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
FORCEINLINE RangedForConstIteratorType TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::begin ( ) const
inline

Definition at line 765 of file SortedMap.h.

◆ Contains()

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
FORCEINLINE bool TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::Contains ( KeyConstPointerType Key) const
inline

Checks if map contains the specified key.

Parameters
KeyThe key to check for.
Returns
true if the map contains the key.

Definition at line 328 of file SortedMap.h.

◆ CountBytes()

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
FORCEINLINE void TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::CountBytes ( FArchive & Ar) const
inline

Tracks the container's memory use through an archive.

Definition at line 156 of file SortedMap.h.

◆ CreateConstIterator()

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
FORCEINLINE TConstIterator TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::CreateConstIterator ( ) const
inline

Creates a const iterator over all the pairs in this map

Definition at line 738 of file SortedMap.h.

◆ CreateConstKeyIterator()

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
FORCEINLINE TConstKeyIterator TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::CreateConstKeyIterator ( KeyInitType InKey) const
inline

Creates a const iterator over the values associated with a specified key in a map. This will be at most one value because keys must be unique

Definition at line 750 of file SortedMap.h.

◆ CreateIterator()

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
FORCEINLINE TIterator TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::CreateIterator ( )
inline

Creates an iterator over all the pairs in this map

Definition at line 732 of file SortedMap.h.

◆ CreateKeyIterator()

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
FORCEINLINE TKeyIterator TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::CreateKeyIterator ( KeyInitType InKey)
inline

Creates an iterator over the values associated with a specified key in a map. This will be at most one value because keys must be unique

Definition at line 744 of file SortedMap.h.

◆ Dump()

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
void TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::Dump ( FOutputDevice & Ar)
inline

Describes the map's contents through an output device.

Parameters
ArThe output device to describe the map's contents through.

Definition at line 382 of file SortedMap.h.

◆ Emplace() [1/2]

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
template<typename InitKeyType = KeyType>
ValueType & TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::Emplace ( InitKeyType && InKey)
inline

Sets a default value associated with a key.

Parameters
InKeyThe key to associate the value with.
Returns
A reference to the value as stored in the map (only valid until the next change to any key in the map).

Definition at line 206 of file SortedMap.h.

◆ Emplace() [2/2]

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
template<typename InitKeyType = KeyType, typename InitValueType = ValueType>
ValueType & TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::Emplace ( InitKeyType && InKey,
InitValueType && InValue )
inline

Sets the value associated with a key.

Parameters
InKey- The key to associate the value with.
InValue- The value to associate with the key.
Returns
A reference to the value as stored in the map (only valid until the next change to any key in the map).

Definition at line 190 of file SortedMap.h.

◆ Empty()

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
FORCEINLINE void TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::Empty ( int32 ExpectedNumElements = 0)
inline

Removes all elements from the map, potentially leaving space allocated for an expected number of elements about to be added.

Parameters
ExpectedNumElementsThe number of elements about to be added to the set.

Definition at line 104 of file SortedMap.h.

◆ end() [1/2]

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
FORCEINLINE RangedForIteratorType TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::end ( )
inline

Definition at line 766 of file SortedMap.h.

◆ end() [2/2]

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
FORCEINLINE RangedForConstIteratorType TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::end ( ) const
inline

Definition at line 767 of file SortedMap.h.

◆ Find() [1/2]

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
FORCEINLINE ValueType * TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::Find ( KeyConstPointerType Key)
inline

Returns the value associated with a specified key.

Parameters
KeyThe key to search for.
Returns
A pointer to the value associated with the specified key, or nullptr if the key isn't contained in this map. The pointer (only valid until the next change to any key in the map).

Definition at line 259 of file SortedMap.h.

◆ Find() [2/2]

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
FORCEINLINE const ValueType * TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::Find ( KeyConstPointerType Key) const
inline

Definition at line 271 of file SortedMap.h.

◆ FindAndRemoveChecked()

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
FORCEINLINE ValueType TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::FindAndRemoveChecked ( KeyConstPointerType Key)
inline

Finds a pair with the specified key, removes it from the map, and returns the value part of the pair. If no pair was found, an exception is thrown.

Parameters
KeyThe key to search for
Returns
Whether or not the key was found

Definition at line 414 of file SortedMap.h.

◆ FindChecked() [1/2]

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
FORCEINLINE ValueType & TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::FindChecked ( KeyConstPointerType Key)
inline

Returns a reference to the value associated with a specified key.

Parameters
KeyThe key to search for.
Returns
The value associated with the specified key, or triggers an assertion if the key does not exist.

Definition at line 292 of file SortedMap.h.

◆ FindChecked() [2/2]

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
FORCEINLINE const ValueType & TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::FindChecked ( KeyConstPointerType Key) const
inline

Definition at line 299 of file SortedMap.h.

◆ FindIndex()

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
FORCEINLINE int32 TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::FindIndex ( KeyConstPointerType Key)
inlineprivate

Find index of key

Definition at line 475 of file SortedMap.h.

◆ FindKey()

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
const KeyType * TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::FindKey ( ValueInitType Value) const
inline

Returns the key associated with the specified value. The time taken is O(N) in the number of pairs.

Parameters
ValueThe value to search for.
Returns
A pointer to the key associated with the specified value, or nullptr if the value isn't contained in this map (only valid until the next change to any key in the map).

Definition at line 241 of file SortedMap.h.

◆ FindOrAdd() [1/2]

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
FORCEINLINE ValueType & TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::FindOrAdd ( const KeyType & Key)
inline

Returns the value associated with a specified key, or if none exists, adds a value using the default constructor.

Parameters
KeyThe key to search for.
Returns
A reference to the value associated with the specified key.

Definition at line 283 of file SortedMap.h.

◆ FindOrAdd() [2/2]

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
FORCEINLINE ValueType & TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::FindOrAdd ( KeyType && Key)
inline

Definition at line 284 of file SortedMap.h.

◆ FindOrAddImpl()

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
template<typename ArgType >
FORCEINLINE ValueType & TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::FindOrAddImpl ( ArgType && Key)
inlineprivate

Implementation of find and add

Definition at line 464 of file SortedMap.h.

◆ FindRef()

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
FORCEINLINE ValueType TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::FindRef ( KeyConstPointerType Key) const
inline

Returns the value associated with a specified key.

Parameters
KeyThe key to search for.
Returns
The value associated with the specified key, or the default value for the ValueType if the key isn't contained in this map.

Definition at line 312 of file SortedMap.h.

◆ GenerateKeyArray()

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
template<typename Allocator >
void TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::GenerateKeyArray ( TArray< KeyType, Allocator > & OutArray) const
inline

Generates an array from the keys in this map.

Definition at line 356 of file SortedMap.h.

◆ GenerateValueArray()

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
template<typename Allocator >
void TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::GenerateValueArray ( TArray< ValueType, Allocator > & OutArray) const
inline

Generates an array from the values in this map.

Definition at line 368 of file SortedMap.h.

◆ GetAllocatedSize()

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
FORCEINLINE SIZE_T TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::GetAllocatedSize ( ) const
inline

Helper function to return the amount of memory allocated by this container. Only returns the size of allocations made directly by the container, not the elements themselves.

Returns
number of bytes allocated by this container.

Definition at line 150 of file SortedMap.h.

◆ GetKeys()

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
template<typename Allocator >
int32 TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::GetKeys ( TArray< KeyType, Allocator > & OutKeys) const
inline

Returns the unique keys contained within this map.

Parameters
OutKeysUpon return, contains the set of unique keys in this map.
Returns
The number of unique keys in the map.

Definition at line 343 of file SortedMap.h.

◆ IsEmpty()

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
bool TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::IsEmpty ( ) const
inline

Returns true if the map is empty and contains no elements.

Returns
True if the map is empty.
See also
Num

Definition at line 133 of file SortedMap.h.

◆ Num()

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
FORCEINLINE int32 TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::Num ( ) const
inline
Returns
The number of elements in the map.

Definition at line 139 of file SortedMap.h.

◆ operator!=()

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
FORCEINLINE bool TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::operator!= ( const TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate > & Other) const
inline

Inequality operator. This is efficient because pairs are always sorted.

Definition at line 94 of file SortedMap.h.

◆ operator=() [1/5]

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
TSortedMap & TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::operator= ( const TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate > & )
default

◆ operator=() [2/5]

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
TSortedMap & TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::operator= ( const TSortedMap< KeyType, ValueType, OtherArrayAllocator, SortPredicate > & Other)
inline

Assignment operator for copying elements from a TSortedMap with a different ArrayAllocator.

Definition at line 70 of file SortedMap.h.

◆ operator=() [3/5]

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
TSortedMap & TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::operator= ( std::initializer_list< TPairInitializer< const KeyType &, const ValueType & > > InitList)
inline

Assignment operator which gets its elements from a native initializer list

Definition at line 77 of file SortedMap.h.

◆ operator=() [4/5]

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
TSortedMap & TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::operator= ( TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate > && )
default

◆ operator=() [5/5]

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
TSortedMap & TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::operator= ( TSortedMap< KeyType, ValueType, OtherArrayAllocator, SortPredicate > && Other)
inline

Assignment operator for moving elements from a TSortedMap with a different ArrayAllocator.

Definition at line 62 of file SortedMap.h.

◆ operator==()

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
FORCEINLINE bool TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::operator== ( const TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate > & Other) const
inline

Equality operator. This is efficient because pairs are always sorted.

Definition at line 88 of file SortedMap.h.

◆ operator[]() [1/2]

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
FORCEINLINE ValueType & TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::operator[] ( KeyConstPointerType Key)
inline

Definition at line 456 of file SortedMap.h.

◆ operator[]() [2/2]

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
FORCEINLINE const ValueType & TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::operator[] ( KeyConstPointerType Key) const
inline

Definition at line 457 of file SortedMap.h.

◆ Remove()

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
FORCEINLINE int32 TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::Remove ( KeyConstPointerType InKey)
inline

Removes all value associations for a key.

Parameters
InKeyThe key to remove associated values for.
Returns
The number of values that were associated with the key.

Definition at line 221 of file SortedMap.h.

◆ RemoveAndCopyValue()

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
FORCEINLINE bool TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::RemoveAndCopyValue ( KeyInitType Key,
ValueType & OutRemovedValue )
inline

Removes the pair with the specified key and copies the value that was removed to the ref parameter.

Parameters
KeyThe key to search for
OutRemovedValueIf found, the value that was removed (not modified if the key was not found)
Returns
Whether or not the key was found

Definition at line 394 of file SortedMap.h.

◆ Reserve()

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
FORCEINLINE void TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::Reserve ( int32 Number)
inline

Preallocates enough memory to contain Number elements.

Definition at line 122 of file SortedMap.h.

◆ Reset()

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
FORCEINLINE void TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::Reset ( )
inline

Efficiently empties out the map but preserves all allocations and capacities.

Definition at line 110 of file SortedMap.h.

◆ Shrink()

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
FORCEINLINE void TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::Shrink ( )
inline

Shrinks the pair set to avoid slack.

Definition at line 116 of file SortedMap.h.

Friends And Related Symbol Documentation

◆ TSortedMap

◆ TSortedMapPrivateFriend

Definition at line 769 of file SortedMap.h.

Member Data Documentation

◆ Pairs

template<typename KeyType , typename ValueType , typename ArrayAllocator , typename SortPredicate >
ElementArrayType TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate >::Pairs
private

An array of the key-value pairs in the map

Definition at line 607 of file SortedMap.h.


The documentation for this class was generated from the following file: