Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
TSet< InElementType, KeyFuncs, Allocator > Class Template Reference

#include <Set.h>

+ Collaboration diagram for TSet< InElementType, KeyFuncs, Allocator >:

Classes

class  FElementCompareClass
 
class  TBaseIterator
 
class  TBaseKeyIterator
 
class  TConstIterator
 
class  TConstKeyIterator
 
class  TIterator
 
class  TKeyIterator
 

Public Types

typedef InElementType ElementType
 
typedef KeyFuncs KeyFuncsType
 
typedef Allocator AllocatorType
 
using SizeType = typename Allocator::SparseArrayAllocator::ElementAllocator::SizeType
 
using TRangedForConstIterator = TBaseIterator<true, true>
 
using TRangedForIterator = TBaseIterator<false, true>
 

Public Member Functions

FORCEINLINE TSet ()
 
FORCEINLINE TSet (const TSet &Copy)
 
FORCEINLINE TSet (const TArray< ElementType > &InArray)
 
FORCEINLINE TSet (TArray< ElementType > &&InArray)
 
FORCEINLINE ~TSet ()
 
TSetoperator= (const TSet &Copy)
 
 TSet (std::initializer_list< ElementType > InitList)
 
 TSet (TSet &&Other)
 
TSetoperator= (TSet &&Other)
 
template<typename OtherAllocator >
 TSet (TSet< ElementType, KeyFuncs, OtherAllocator > &&Other)
 
template<typename OtherAllocator >
 TSet (const TSet< ElementType, KeyFuncs, OtherAllocator > &Other)
 
template<typename OtherAllocator >
TSetoperator= (TSet< ElementType, KeyFuncs, OtherAllocator > &&Other)
 
template<typename OtherAllocator >
TSetoperator= (const TSet< ElementType, KeyFuncs, OtherAllocator > &Other)
 
TSetoperator= (std::initializer_list< ElementType > InitList)
 
void Empty (int32 ExpectedNumElements=0)
 
void Reset ()
 
FORCEINLINE void Shrink ()
 
FORCEINLINE void Compact ()
 
FORCEINLINE void CompactStable ()
 
FORCEINLINE void Reserve (int32 Number)
 
FORCEINLINE void Relax ()
 
FORCEINLINE SIZE_T GetAllocatedSize (void) const
 
FORCEINLINE void CountBytes (FArchive &Ar) const
 
bool IsEmpty () const
 
FORCEINLINE int32 Num () const
 
FORCEINLINE int32 GetMaxIndex () const
 
FORCEINLINE bool IsValidId (FSetElementId Id) const
 
FORCEINLINE ElementTypeoperator[] (FSetElementId Id)
 
FORCEINLINE const ElementTypeoperator[] (FSetElementId Id) const
 
FORCEINLINE FSetElementId Add (const InElementType &InElement, bool *bIsAlreadyInSetPtr=nullptr)
 
FORCEINLINE FSetElementId Add (InElementType &&InElement, bool *bIsAlreadyInSetPtr=nullptr)
 
FORCEINLINE ElementTypeFindOrAdd (const InElementType &InElement, bool *bIsAlreadyInSetPtr=nullptr)
 
FORCEINLINE ElementTypeFindOrAdd (InElementType &&InElement, bool *bIsAlreadyInSetPtr=nullptr)
 
FORCEINLINE FSetElementId AddByHash (uint32 KeyHash, const InElementType &InElement, bool *bIsAlreadyInSetPtr=nullptr)
 
FORCEINLINE FSetElementId AddByHash (uint32 KeyHash, InElementType &&InElement, bool *bIsAlreadyInSetPtr=nullptr)
 
template<typename ElementReferenceType >
ElementTypeFindOrAddByHash (uint32 KeyHash, ElementReferenceType &&InElement, bool *bIsAlreadyInSetPtr=nullptr)
 
template<typename ArgsType = ElementType>
FSetElementId Emplace (ArgsType &&Args, bool *bIsAlreadyInSetPtr=nullptr)
 
template<typename ArgsType = ElementType>
FSetElementId EmplaceByHash (uint32 KeyHash, ArgsType &&Args, bool *bIsAlreadyInSetPtr=nullptr)
 
template<typename ViewSizeType >
void Append (TArrayView< ElementType, ViewSizeType > InElements)
 
template<typename ViewSizeType >
void Append (TArrayView< const ElementType, ViewSizeType > InElements)
 
template<typename ArrayAllocator >
void Append (const TArray< ElementType, ArrayAllocator > &InElements)
 
template<typename ArrayAllocator >
void Append (TArray< ElementType, ArrayAllocator > &&InElements)
 
template<typename OtherAllocator >
void Append (const TSet< ElementType, KeyFuncs, OtherAllocator > &OtherSet)
 
template<typename OtherAllocator >
void Append (TSet< ElementType, KeyFuncs, OtherAllocator > &&OtherSet)
 
void Append (std::initializer_list< ElementType > InitList)
 
void Remove (FSetElementId ElementId)
 
FSetElementId FindId (KeyInitType Key) const
 
template<typename ComparableKey >
FSetElementId FindIdByHash (uint32 KeyHash, const ComparableKey &Key) const
 
FORCEINLINE ElementTypeFind (KeyInitType Key)
 
FORCEINLINE const ElementTypeFind (KeyInitType Key) const
 
template<typename ComparableKey >
ElementTypeFindByHash (uint32 KeyHash, const ComparableKey &Key)
 
template<typename ComparableKey >
const ElementTypeFindByHash (uint32 KeyHash, const ComparableKey &Key) const
 
int32 Remove (KeyInitType Key)
 
template<typename ComparableKey >
int32 RemoveByHash (uint32 KeyHash, const ComparableKey &Key)
 
FORCEINLINE bool Contains (KeyInitType Key) const
 
template<typename ComparableKey >
FORCEINLINE bool ContainsByHash (uint32 KeyHash, const ComparableKey &Key) const
 
template<typename PREDICATE_CLASS >
void Sort (const PREDICATE_CLASS &Predicate)
 
template<typename PREDICATE_CLASS >
void StableSort (const PREDICATE_CLASS &Predicate)
 
void SortFreeList ()
 
void Dump (FOutputDevice &Ar)
 
bool VerifyHashElementsKey (KeyInitType Key)
 
void DumpHashElements (FOutputDevice &Ar)
 
TSet Intersect (const TSet &OtherSet) const
 
TSet Union (const TSet &OtherSet) const
 
TSet Difference (const TSet &OtherSet) const
 
bool Includes (const TSet< ElementType, KeyFuncs, Allocator > &OtherSet) const
 
TArray< ElementTypeArray () const
 
FORCEINLINE void CheckAddress (const ElementType *Addr) const
 
template<typename OtherKeyFuncs , typename AliasElementType = ElementType, typename std::enable_if_t< TIsContainerElementTypeCopyable< AliasElementType >::Value > * = nullptr>
TSetoperator= (TSet< typename TContainerElementTypeCompatibility< ElementType >::CopyFromOtherType, OtherKeyFuncs, Allocator > &&Other)
 
template<typename OtherKeyFuncs , typename OtherAllocator , typename AliasElementType = ElementType, typename std::enable_if_t< TIsContainerElementTypeCopyable< AliasElementType >::Value > * = nullptr>
TSetoperator= (const TSet< typename TContainerElementTypeCompatibility< ElementType >::CopyFromOtherType, OtherKeyFuncs, OtherAllocator > &Other)
 
template<typename OtherKeyFuncs , typename OtherAllocator , typename AliasElementType = ElementType, typename std::enable_if_t< TIsContainerElementTypeCopyable< AliasElementType >::Value > * = nullptr>
void Append (const TSet< typename TContainerElementTypeCompatibility< ElementType >::CopyFromOtherType, OtherKeyFuncs, OtherAllocator > &OtherSet)
 
template<typename OtherKeyFuncs , typename AliasElementType = ElementType, typename std::enable_if_t< TIsContainerElementTypeCopyable< AliasElementType >::Value > * = nullptr>
void Append (TSet< typename TContainerElementTypeCompatibility< ElementType >::CopyFromOtherType, OtherKeyFuncs, Allocator > &&OtherSet)
 
void WriteMemoryImage (FMemoryImageWriter &Writer) const
 
void CopyUnfrozen (const FMemoryUnfreezeContent &Context, void *Dst) const
 
FORCEINLINE TIterator CreateIterator ()
 
FORCEINLINE TConstIterator CreateConstIterator () const
 
FORCEINLINE TRangedForIterator begin ()
 
FORCEINLINE TRangedForConstIterator begin () const
 
FORCEINLINE TRangedForIterator end ()
 
FORCEINLINE TRangedForConstIterator end () const
 

Static Public Member Functions

static void AppendHash (const FPlatformTypeLayoutParameters &LayoutParams, FSHA1 &Hasher)
 

Private Types

typedef KeyFuncs::KeyInitType KeyInitType
 
typedef KeyFuncs::ElementInitType ElementInitType
 
typedef TSetElement< InElementTypeSetElementType
 
using ElementArrayType = TSparseArray<SetElementType, typename Allocator::SparseArrayAllocator>
 
using HashType = typename Allocator::HashAllocator::template ForElementType<FSetElementId>
 

Private Member Functions

bool TryReplaceExisting (uint32 KeyHash, SetElementType &Element, SizeType &InOutElementIndex, bool *bIsAlreadyInSetPtr)
 
FORCEINLINE void RehashOrLink (uint32 KeyHash, SetElementType &Element, SizeType ElementIndex)
 
void RemoveByIndex (SizeType ElementIndex)
 
template<typename ComparableKey >
SizeType FindIndexByHash (uint32 KeyHash, const ComparableKey &Key) const
 
template<typename ComparableKey >
FORCEINLINE int32 RemoveImpl (uint32 KeyHash, const ComparableKey &Key)
 
FORCEINLINE FSetElementIdGetTypedHash (int32 HashIndex) const
 
FORCEINLINE void LinkElement (SizeType ElementIndex, const SetElementType &Element, uint32 KeyHash) const
 
FORCEINLINE void HashElement (SizeType ElementIndex, const SetElementType &Element) const
 
void UnhashElements ()
 
FORCEINLINE bool ShouldRehash (int32 NumHashedElements, int32 DesiredHashSize, bool bAllowShrinking=false) const
 
bool ConditionalRehash (int32 NumHashedElements, bool bAllowShrinking=false) const
 
void Rehash () const
 

Static Private Member Functions

template<typename SetType >
static FORCEINLINE void Move (SetType &ToSet, SetType &FromSet)
 

Private Attributes

ElementArrayType Elements
 
HashType Hash
 
int32 HashSize
 

Friends

template<typename , typename >
class TScriptSet
 
struct TSetPrivateFriend
 

Detailed Description

template<typename InElementType, typename KeyFuncs, typename Allocator>
class TSet< InElementType, KeyFuncs, Allocator >

A set with an optional KeyFuncs parameters for customizing how the elements are compared and searched.
E.g. You can specify a mapping from elements to keys if you want to find elements by specifying a subset of the element type. It uses a TSparseArray of the elements, and also links the elements into a hash with a number of buckets proportional to the number of elements. Addition, removal, and finding are O(1).

The ByHash() functions are somewhat dangerous but particularly useful in two scenarios: – Heterogeneous lookup to avoid creating expensive keys like FString when looking up by const TCHAR*. You must ensure the hash is calculated in the same way as ElementType is hashed. If possible put both ComparableKey and ElementType hash functions next to each other in the same header to avoid bugs when the ElementType hash function is changed. – Reducing contention around hash tables protected by a lock. It is often important to incur the cache misses of reading key data and doing the hashing before acquiring the lock.

Definition at line 281 of file Set.h.

Member Typedef Documentation

◆ AllocatorType

Definition at line 286 of file Set.h.

◆ ElementArrayType

using TSet< InElementType, KeyFuncs, Allocator >::ElementArrayType = TSparseArray<SetElementType, typename Allocator::SparseArrayAllocator>
private

Definition at line 1376 of file Set.h.

◆ ElementInitType

typedef KeyFuncs::ElementInitType TSet< InElementType, KeyFuncs, Allocator >::ElementInitType
private

Definition at line 297 of file Set.h.

◆ ElementType

◆ HashType

using TSet< InElementType, KeyFuncs, Allocator >::HashType = typename Allocator::HashAllocator::template ForElementType<FSetElementId>
private

Definition at line 1377 of file Set.h.

◆ KeyFuncsType

Definition at line 285 of file Set.h.

◆ KeyInitType

typedef KeyFuncs::KeyInitType TSet< InElementType, KeyFuncs, Allocator >::KeyInitType
private

Definition at line 296 of file Set.h.

◆ SetElementType

Definition at line 299 of file Set.h.

◆ SizeType

using TSet< InElementType, KeyFuncs, Allocator >::SizeType = typename Allocator::SparseArrayAllocator::ElementAllocator::SizeType

Definition at line 288 of file Set.h.

◆ TRangedForConstIterator

Definition at line 1710 of file Set.h.

◆ TRangedForIterator

Definition at line 1711 of file Set.h.

Constructor & Destructor Documentation

◆ TSet() [1/8]

Initialization constructor.

Definition at line 303 of file Set.h.

◆ TSet() [2/8]

Copy constructor.

Definition at line 308 of file Set.h.

◆ TSet() [3/8]

Definition at line 314 of file Set.h.

◆ TSet() [4/8]

Definition at line 320 of file Set.h.

◆ ~TSet()

Destructor.

Definition at line 327 of file Set.h.

◆ TSet() [5/8]

TSet< InElementType, KeyFuncs, Allocator >::TSet ( std::initializer_list< ElementType > InitList)
inline

Initializer list constructor.

Definition at line 363 of file Set.h.

◆ TSet() [6/8]

Move constructor.

Definition at line 370 of file Set.h.

◆ TSet() [7/8]

Constructor for moving elements from a TSet with a different SetAllocator

Definition at line 389 of file Set.h.

◆ TSet() [8/8]

Constructor for copying elements from a TSet with a different SetAllocator

Definition at line 397 of file Set.h.

Member Function Documentation

◆ Add() [1/2]

Adds an element to the set.

Parameters
InElementElement to add to set
bIsAlreadyInSetPtr[out] Optional pointer to bool that will be set depending on whether element is already in set
Returns
A pointer to the element stored in the set.

Definition at line 596 of file Set.h.

◆ Add() [2/2]

Definition at line 597 of file Set.h.

◆ AddByHash() [1/2]

FORCEINLINE FSetElementId TSet< InElementType, KeyFuncs, Allocator >::AddByHash ( uint32 KeyHash,
const InElementType & InElement,
bool * bIsAlreadyInSetPtr = nullptr )
inline

Adds an element to the set.

See also
Class documentation section on ByHash() functions
Parameters
InElementElement to add to set
bIsAlreadyInSetPtr[out] Optional pointer to bool that will be set depending on whether element is already in set
Returns
A handle to the element stored in the set

Definition at line 623 of file Set.h.

◆ AddByHash() [2/2]

FORCEINLINE FSetElementId TSet< InElementType, KeyFuncs, Allocator >::AddByHash ( uint32 KeyHash,
InElementType && InElement,
bool * bIsAlreadyInSetPtr = nullptr )
inline

Definition at line 627 of file Set.h.

◆ Append() [1/9]

Definition at line 774 of file Set.h.

◆ Append() [2/9]

Add all items from another set to our set (union without creating a new set)

Parameters
OtherSet- The other set of items to add.

Definition at line 799 of file Set.h.

◆ Append() [3/9]

Add all items from another set to our set (union without creating a new set) Compatible element type version.

Parameters
OtherSet- The other set of items to add.

Definition at line 1327 of file Set.h.

◆ Append() [4/9]

void TSet< InElementType, KeyFuncs, Allocator >::Append ( std::initializer_list< ElementType > InitList)
inline

Definition at line 819 of file Set.h.

◆ Append() [5/9]

Definition at line 784 of file Set.h.

◆ Append() [6/9]

Definition at line 764 of file Set.h.

◆ Append() [7/9]

Definition at line 754 of file Set.h.

◆ Append() [8/9]

Definition at line 809 of file Set.h.

◆ Append() [9/9]

Add all items from another set to our set (union without creating a new set) Compatible element type version.

Parameters
OtherSet- The other set of items to add.

Definition at line 1347 of file Set.h.

◆ AppendHash()

Definition at line 1418 of file Set.h.

◆ Array()

Returns
a TArray of the elements

Definition at line 1254 of file Set.h.

◆ begin() [1/2]

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

Definition at line 1769 of file Set.h.

◆ begin() [2/2]

◆ CheckAddress()

Checks that the specified address is not part of an element within the container. Used for implementations to check that reference arguments aren't going to be invalidated by possible reallocation.

Parameters
AddrThe address to check.

Definition at line 1271 of file Set.h.

◆ Compact()

Compacts the allocated elements into a contiguous range.

Definition at line 476 of file Set.h.

◆ CompactStable()

Compacts the allocated elements into a contiguous range. Does not change the iteration order of the elements.

Definition at line 486 of file Set.h.

◆ ConditionalRehash()

bool TSet< InElementType, KeyFuncs, Allocator >::ConditionalRehash ( int32 NumHashedElements,
bool bAllowShrinking = false ) const
inlineprivate

Checks if the hash has an appropriate number of buckets, and if not resizes it.

Parameters
NumHashedElements- The number of elements to size the hash for.
bAllowShrinking- true if the hash is allowed to shrink.
Returns
true if the set was rehashed.

Definition at line 1491 of file Set.h.

◆ Contains()

Checks if the element contains an element with the given key.

Parameters
Key- The key to check for.
Returns
true if the set contains an element with the given key.

Definition at line 1050 of file Set.h.

◆ ContainsByHash()

Checks if the element contains an element with the given key.

See also
Class documentation section on ByHash() functions

Definition at line 1061 of file Set.h.

◆ CopyUnfrozen()

void TSet< InElementType, KeyFuncs, Allocator >::CopyUnfrozen ( const FMemoryUnfreezeContent & Context,
void * Dst ) const
inline

Definition at line 1400 of file Set.h.

◆ CountBytes()

Tracks the container's memory use through an archive.

Definition at line 535 of file Set.h.

◆ CreateConstIterator()

Creates a const iterator for the contents of this set

Definition at line 1757 of file Set.h.

◆ CreateIterator()

Creates an iterator for the contents of this set

Definition at line 1751 of file Set.h.

◆ Difference()

Returns
the complement of two sets. (A not in B where A is this and B is Other)

Definition at line 1209 of file Set.h.

◆ Dump()

Describes the set's contents through an output device.

Parameters
Ar- The output device to describe the set's contents through.

Definition at line 1108 of file Set.h.

◆ DumpHashElements()

Definition at line 1147 of file Set.h.

◆ Emplace()

template<typename ArgsType = ElementType>
FSetElementId TSet< InElementType, KeyFuncs, Allocator >::Emplace ( ArgsType && Args,
bool * bIsAlreadyInSetPtr = nullptr )
inline

Adds an element to the set.

Parameters
ArgsThe argument(s) to be forwarded to the set element's constructor.
bIsAlreadyInSetPtr[out] Optional pointer to bool that will be set depending on whether element is already in set
Returns
A handle to the element stored in the set.

Definition at line 713 of file Set.h.

◆ EmplaceByHash()

template<typename ArgsType = ElementType>
FSetElementId TSet< InElementType, KeyFuncs, Allocator >::EmplaceByHash ( uint32 KeyHash,
ArgsType && Args,
bool * bIsAlreadyInSetPtr = nullptr )
inline

Adds an element to the set.

See also
Class documentation section on ByHash() functions
Parameters
ArgsThe argument(s) to be forwarded to the set element's constructor.
bIsAlreadyInSetPtr[out] Optional pointer to bool that will be set depending on whether element is already in set
Returns
A handle to the element stored in the set.

Definition at line 738 of file Set.h.

◆ Empty()

void TSet< InElementType, KeyFuncs, Allocator >::Empty ( int32 ExpectedNumElements = 0)
inline

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

Parameters
ExpectedNumElements- The number of elements about to be added to the set.

Definition at line 433 of file Set.h.

◆ end() [1/2]

◆ end() [2/2]

◆ Find() [1/2]

Finds an element with the given key in the set.

Parameters
Key- The key to search for.
Returns
A pointer to an element with the given key. If no element in the set has the given key, this will return NULL.

Definition at line 928 of file Set.h.

◆ Find() [2/2]

Finds an element with the given key in the set.

Parameters
Key- The key to search for.
Returns
A const pointer to an element with the given key. If no element in the set has the given key, this will return NULL.

Definition at line 946 of file Set.h.

◆ FindByHash() [1/2]

Finds an element with a pre-calculated hash and a key that can be compared to KeyType.

See also
Class documentation section on ByHash() functions
Returns
A pointer to the contained element or nullptr.

Definition at line 957 of file Set.h.

◆ FindByHash() [2/2]

Definition at line 971 of file Set.h.

◆ FindId()

Finds an element with the given key in the set.

Parameters
Key- The key to search for.
Returns
The id of the set element matching the given key, or the NULL id if none matches.

Definition at line 905 of file Set.h.

◆ FindIdByHash()

Finds an element with a pre-calculated hash and a key that can be compared to KeyType

See also
Class documentation section on ByHash() functions
Returns
The element id that matches the key and hash or an invalid element id

Definition at line 916 of file Set.h.

◆ FindIndexByHash()

template<typename ComparableKey >
SizeType TSet< InElementType, KeyFuncs, Allocator >::FindIndexByHash ( uint32 KeyHash,
const ComparableKey & Key ) const
inlineprivate

Finds an element with a pre-calculated hash and a key that can be compared to KeyType

See also
Class documentation section on ByHash() functions
Returns
The element id that matches the key and hash or an invalid element id

Definition at line 873 of file Set.h.

◆ FindOrAdd() [1/2]

FORCEINLINE ElementType & TSet< InElementType, KeyFuncs, Allocator >::FindOrAdd ( const InElementType & InElement,
bool * bIsAlreadyInSetPtr = nullptr )
inline

Adds an element to the set if not already present and returns a reference to the added or existing element.

Parameters
InElementElement to add to set
bIsAlreadyInSetPtr[out] Optional pointer to bool that will be set depending on whether element is already in set
Returns
A reference to the element stored in the set.

Definition at line 606 of file Set.h.

◆ FindOrAdd() [2/2]

FORCEINLINE ElementType & TSet< InElementType, KeyFuncs, Allocator >::FindOrAdd ( InElementType && InElement,
bool * bIsAlreadyInSetPtr = nullptr )
inline

Definition at line 610 of file Set.h.

◆ FindOrAddByHash()

ElementType & TSet< InElementType, KeyFuncs, Allocator >::FindOrAddByHash ( uint32 KeyHash,
ElementReferenceType && InElement,
bool * bIsAlreadyInSetPtr = nullptr )
inline

Adds an element to the set if not already present and returns a reference to the added or existing element.

See also
Class documentation section on ByHash() functions
Parameters
InElementElement to add to set
bIsAlreadyInSetPtr[out] Optional pointer to bool that will be set depending on whether element is already in set
Returns
A reference to the element stored in the set

Definition at line 641 of file Set.h.

◆ GetAllocatedSize()

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 529 of file Set.h.

◆ GetMaxIndex()

Definition at line 558 of file Set.h.

◆ GetTypedHash()

FORCEINLINE FSetElementId & TSet< InElementType, KeyFuncs, Allocator >::GetTypedHash ( int32 HashIndex) const
inlineprivate

Definition at line 1425 of file Set.h.

◆ HashElement()

FORCEINLINE void TSet< InElementType, KeyFuncs, Allocator >::HashElement ( SizeType ElementIndex,
const SetElementType & Element ) const
inlineprivate

Hashes and links an added element to the hash chain.

Definition at line 1442 of file Set.h.

◆ Includes()

Determine whether the specified set is entirely included within this set

Parameters
OtherSetSet to check
Returns
True if the other set is entirely included in this set, false if it is not

Definition at line 1231 of file Set.h.

◆ Intersect()

Returns
the intersection of two sets. (A AND B)

Definition at line 1172 of file Set.h.

◆ IsEmpty()

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

Returns
True if the set is empty.
See also
Num

Definition at line 547 of file Set.h.

◆ IsValidId()

Checks whether an element id is valid.

Parameters
Id- The element id to check.
Returns
true if the element identifier refers to a valid element in this set.

Definition at line 568 of file Set.h.

◆ LinkElement()

FORCEINLINE void TSet< InElementType, KeyFuncs, Allocator >::LinkElement ( SizeType ElementIndex,
const SetElementType & Element,
uint32 KeyHash ) const
inlineprivate

Links an added element to the hash chain.

Definition at line 1431 of file Set.h.

◆ Move()

template<typename SetType >
static FORCEINLINE void TSet< InElementType, KeyFuncs, Allocator >::Move ( SetType & ToSet,
SetType & FromSet )
inlinestaticprivate

Definition at line 351 of file Set.h.

◆ Num()

Returns
the number of elements.

Definition at line 553 of file Set.h.

◆ operator=() [1/7]

Assignment operator.

Definition at line 333 of file Set.h.

◆ operator=() [2/7]

Assignment operator for copying elements from a TSet with a different SetAllocator

Definition at line 414 of file Set.h.

◆ operator=() [3/7]

Assignment operator. First deletes all currently contained elements and then copies from other set. Compatible element type version.

Parameters
OtherThe source set to assign from.

Definition at line 1308 of file Set.h.

◆ operator=() [4/7]

TSet & TSet< InElementType, KeyFuncs, Allocator >::operator= ( std::initializer_list< ElementType > InitList)
inline

Initializer list assignment operator

Definition at line 422 of file Set.h.

◆ operator=() [5/7]

Move assignment operator.

Definition at line 377 of file Set.h.

◆ operator=() [6/7]

Assignment operator for moving elements from a TSet with a different SetAllocator

Definition at line 405 of file Set.h.

◆ operator=() [7/7]

Move assignment operator. Compatible element type version.

Parameters
OtherSet to assign and move from.

Definition at line 1287 of file Set.h.

◆ operator[]() [1/2]

Accesses the identified element's value.

Definition at line 578 of file Set.h.

◆ operator[]() [2/2]

Accesses the identified element's value.

Definition at line 584 of file Set.h.

◆ Rehash()

void TSet< InElementType, KeyFuncs, Allocator >::Rehash ( ) const
inlineprivate

Resizes the hash.

Definition at line 1507 of file Set.h.

◆ RehashOrLink()

FORCEINLINE void TSet< InElementType, KeyFuncs, Allocator >::RehashOrLink ( uint32 KeyHash,
SetElementType & Element,
SizeType ElementIndex )
inlineprivate

Definition at line 694 of file Set.h.

◆ Relax()

Relaxes the set's hash to a size strictly bounded by the number of elements in the set.

Definition at line 519 of file Set.h.

◆ Remove() [1/2]

Removes an element from the set.

Parameters
Element- A pointer to the element in the set, as returned by Add or Find.

Definition at line 861 of file Set.h.

◆ Remove() [2/2]

Removes all elements from the set matching the specified key.

Parameters
Key- The key to match elements against.
Returns
The number of elements removed.

Definition at line 1015 of file Set.h.

◆ RemoveByHash()

Removes all elements from the set matching the specified key.

See also
Class documentation section on ByHash() functions
Parameters
Key- The key to match elements against.
Returns
The number of elements removed.

Definition at line 1033 of file Set.h.

◆ RemoveByIndex()

void TSet< InElementType, KeyFuncs, Allocator >::RemoveByIndex ( SizeType ElementIndex)
inlineprivate

Definition at line 829 of file Set.h.

◆ RemoveImpl()

Definition at line 978 of file Set.h.

◆ Reserve()

Preallocates enough memory to contain Number elements

Definition at line 496 of file Set.h.

◆ Reset()

Efficiently empties out the set but preserves all allocations and capacities

Definition at line 456 of file Set.h.

◆ ShouldRehash()

FORCEINLINE bool TSet< InElementType, KeyFuncs, Allocator >::ShouldRehash ( int32 NumHashedElements,
int32 DesiredHashSize,
bool bAllowShrinking = false ) const
inlineprivate

Checks if the hash has an appropriate number of buckets, and if it should be resized.

Parameters
NumHashedElements- The number of elements to size the hash for.
DesiredHashSize- Desired size if we should rehash.
bAllowShrinking- true if the hash is allowed to shrink.
Returns
true if the set should berehashed.

Definition at line 1478 of file Set.h.

◆ Shrink()

Shrinks the set's element storage to avoid slack.

Definition at line 469 of file Set.h.

◆ Sort()

Sorts the set's elements using the provided comparison class.

Definition at line 1072 of file Set.h.

◆ SortFreeList()

Sort the free element list so that subsequent additions will occur in the lowest available TSparseArray index resulting in tighter packing without moving any existing items. Also useful for some types of determinism.

See also
TSparseArray::SortFreeList() for more info.

Definition at line 1099 of file Set.h.

◆ StableSort()

Stable sorts the set's elements using the provided comparison class.

Definition at line 1085 of file Set.h.

◆ TryReplaceExisting()

bool TSet< InElementType, KeyFuncs, Allocator >::TryReplaceExisting ( uint32 KeyHash,
SetElementType & Element,
SizeType & InOutElementIndex,
bool * bIsAlreadyInSetPtr )
inlineprivate

Definition at line 662 of file Set.h.

◆ UnhashElements()

void TSet< InElementType, KeyFuncs, Allocator >::UnhashElements ( )
inlineprivate

Reset hash buckets to invalid

Reset the whole hash to invalid

Definition at line 1448 of file Set.h.

◆ Union()

Returns
the union of two sets. (A OR B)

Definition at line 1192 of file Set.h.

◆ VerifyHashElementsKey()

bool TSet< InElementType, KeyFuncs, Allocator >::VerifyHashElementsKey ( KeyInitType Key)
inline

Definition at line 1126 of file Set.h.

◆ WriteMemoryImage()

void TSet< InElementType, KeyFuncs, Allocator >::WriteMemoryImage ( FMemoryImageWriter & Writer) const
inline

Definition at line 1385 of file Set.h.

Friends And Related Symbol Documentation

◆ TScriptSet

Definition at line 294 of file Set.h.

◆ TSetPrivateFriend

Definition at line 1762 of file Set.h.

Member Data Documentation

◆ Elements

Definition at line 1379 of file Set.h.

◆ Hash

Definition at line 1381 of file Set.h.

◆ HashSize

Definition at line 1382 of file Set.h.


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