UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator > Class Template Reference

Classes

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 IntrusiveUnsetOptionalStateType = UE_TSPARSE_SET
 
using TRangedForConstIterator = TBaseIterator< true, true >
 
using TRangedForIterator = TBaseIterator< false, true >
 

Public Member Functions

UE_FORCEINLINE_HINT constexpr UE_TSPARSE_SET ()=default
 
consteval UE_TSPARSE_SET (EConstEval)
 
UE_FORCEINLINE_HINT UE_TSPARSE_SET (const UE_TSPARSE_SET &Copy)
 
UE_FORCEINLINE_HINT UE_TSPARSE_SET (TArrayView< const ElementType > InArrayView)
 
UE_FORCEINLINE_HINT UE_TSPARSE_SET (TArray< ElementType > &&InArray)
 
UE_FORCEINLINE_HINT ~UE_TSPARSE_SET ()
 
 UE_TSPARSE_SET (FIntrusiveUnsetOptionalState Tag)
 
bool operator== (FIntrusiveUnsetOptionalState Tag) const
 
UE_TSPARSE_SEToperator= (const UE_TSPARSE_SET &Copy)
 
 UE_TSPARSE_SET (std::initializer_list< ElementType > InitList)
 
 UE_TSPARSE_SET (UE_TSPARSE_SET &&Other)
 
UE_TSPARSE_SEToperator= (UE_TSPARSE_SET &&Other)
 
template<typename OtherAllocator >
 UE_TSPARSE_SET (UE_TSPARSE_SET< ElementType, KeyFuncs, OtherAllocator > &&Other)
 
template<typename OtherAllocator >
 UE_TSPARSE_SET (const UE_TSPARSE_SET< ElementType, KeyFuncs, OtherAllocator > &Other)
 
template<typename OtherAllocator >
UE_TSPARSE_SEToperator= (UE_TSPARSE_SET< ElementType, KeyFuncs, OtherAllocator > &&Other)
 
template<typename OtherAllocator >
UE_TSPARSE_SEToperator= (const UE_TSPARSE_SET< ElementType, KeyFuncs, OtherAllocator > &Other)
 
UE_TSPARSE_SEToperator= (std::initializer_list< ElementType > InitList)
 
void Empty (int32 ExpectedNumElements=0)
 
void Reset ()
 
void Shrink ()
 
void Compact ()
 
void CompactStable ()
 
void Reserve (int32 Number)
 
UE_FORCEINLINE_HINT void Relax ()
 
UE_FORCEINLINE_HINT SIZE_T GetAllocatedSize (void) const
 
void CountBytes (FArchive &Ar) const
 
bool IsEmpty () const
 
UE_FORCEINLINE_HINT int32 Num () const
 
UE_FORCEINLINE_HINT int32 Max () const
 
UE_FORCEINLINE_HINT int32 GetMaxIndex () const
 
bool IsValidId (FSetElementId Id) const
 
UE_FORCEINLINE_HINT ElementTypeoperator[] (FSetElementId Id)
 
UE_FORCEINLINE_HINT const ElementTypeoperator[] (FSetElementId Id) const
 
UE_FORCEINLINE_HINT ElementTypeGet (FSetElementId Id)
 
UE_FORCEINLINE_HINT const ElementTypeGet (FSetElementId Id) const
 
UE_FORCEINLINE_HINT FSetElementId Add (const InElementType &InElement, bool *bIsAlreadyInSetPtr=nullptr)
 
UE_FORCEINLINE_HINT FSetElementId Add (InElementType &&InElement, bool *bIsAlreadyInSetPtr=nullptr)
 
UE_FORCEINLINE_HINT ElementTypeFindOrAdd (const InElementType &InElement, bool *bIsAlreadyInSetPtr=nullptr)
 
UE_FORCEINLINE_HINT ElementTypeFindOrAdd (InElementType &&InElement, bool *bIsAlreadyInSetPtr=nullptr)
 
UE_FORCEINLINE_HINT FSetElementId AddByHash (uint32 KeyHash, const InElementType &InElement, bool *bIsAlreadyInSetPtr=nullptr)
 
UE_FORCEINLINE_HINT FSetElementId AddByHash (uint32 KeyHash, InElementType &&InElement, bool *bIsAlreadyInSetPtr=nullptr)
 
template<typename ElementReferenceType >
ElementTypeFindOrAddByHash (uint32 KeyHash, ElementReferenceType &&InElement, bool *bIsAlreadyInSetPtr=nullptr)
 
template<typename ArgType = ElementType>
FSetElementId Emplace (ArgType &&Arg, bool *bIsAlreadyInSetPtr=nullptr)
 
template<typename... ArgTypes>
TPair< FSetElementId, boolEmplace (EInPlace, ArgTypes &&... InArgs)
 
template<typename ArgType = ElementType>
FSetElementId EmplaceByHash (uint32 KeyHash, ArgType &&Args, bool *bIsAlreadyInSetPtr=nullptr)
 
template<typename... ArgTypes>
TPair< FSetElementId, boolEmplaceByHash (EInPlace, uint32 KeyHash, ArgTypes &&... InArgs)
 
void Append (TArrayView< const ElementType > InElements)
 
template<typename ArrayAllocator >
void Append (TArray< ElementType, ArrayAllocator > &&InElements)
 
template<typename OtherAllocator >
void Append (const UE_TSPARSE_SET< ElementType, KeyFuncs, OtherAllocator > &OtherSet)
 
template<typename OtherAllocator >
void Append (UE_TSPARSE_SET< ElementType, KeyFuncs, OtherAllocator > &&OtherSet)
 
void Append (std::initializer_list< ElementType > InitList)
 
void Remove (FSetElementId ElementId)
 
void RemoveStable (FSetElementId ElementId)
 
ElementTypeFindArbitraryElement ()
 
const ElementTypeFindArbitraryElement () const
 
FSetElementId FindId (KeyInitType Key) const
 
template<typename ComparableKey >
FSetElementId FindIdByHash (uint32 KeyHash, const ComparableKey &Key) const
 
ElementTypeFind (KeyInitType Key)
 
UE_FORCEINLINE_HINT 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)
 
int32 RemoveStable (KeyInitType Key)
 
template<typename ComparableKey >
int32 RemoveByHash (uint32 KeyHash, const ComparableKey &Key)
 
UE_FORCEINLINE_HINT bool Contains (KeyInitType Key) const
 
template<typename ComparableKey >
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) const
 
void DumpHashElements (FOutputDevice &Ar)
 
UE_TSPARSE_SET Intersect (const UE_TSPARSE_SET &OtherSet) const
 
UE_TSPARSE_SET Union (const UE_TSPARSE_SET &OtherSet) const
 
UE_TSPARSE_SET Difference (const UE_TSPARSE_SET &OtherSet) const
 
bool Includes (const UE_TSPARSE_SET< ElementType, KeyFuncs, Allocator > &OtherSet) const
 
TArray< ElementTypeArray () const
 
UE_FORCEINLINE_HINT void CheckAddress (const ElementType *Addr) const
 
template<typename OtherKeyFuncs , typename AliasElementType = ElementType>
UE_TSPARSE_SEToperator= (UE_TSPARSE_SET< typename TContainerElementTypeCompatibility< ElementType >::CopyFromOtherType, OtherKeyFuncs, Allocator > &&Other)
 
template<typename OtherKeyFuncs , typename OtherAllocator , typename AliasElementType = ElementType>
UE_TSPARSE_SEToperator= (const UE_TSPARSE_SET< typename TContainerElementTypeCompatibility< ElementType >::CopyFromOtherType, OtherKeyFuncs, OtherAllocator > &Other)
 
template<typename OtherKeyFuncs , typename OtherAllocator , typename AliasElementType = ElementType>
void Append (const UE_TSPARSE_SET< typename TContainerElementTypeCompatibility< ElementType >::CopyFromOtherType, OtherKeyFuncs, OtherAllocator > &OtherSet)
 
template<typename OtherKeyFuncs , typename AliasElementType = ElementType>
void Append (UE_TSPARSE_SET< typename TContainerElementTypeCompatibility< ElementType >::CopyFromOtherType, OtherKeyFuncs, Allocator > &&OtherSet)
 
void WriteMemoryImage (FMemoryImageWriter &Writer) const
 
void CopyUnfrozen (const FMemoryUnfreezeContent &Context, void *Dst) const
 
UE_FORCEINLINE_HINT TIterator CreateIterator ()
 
UE_FORCEINLINE_HINT TConstIterator CreateConstIterator () const
 
UE_FORCEINLINE_HINT TRangedForIterator begin ()
 
UE_FORCEINLINE_HINT TRangedForConstIterator begin () const
 
UE_FORCEINLINE_HINT TRangedForIterator end ()
 
UE_FORCEINLINE_HINT TRangedForConstIterator end () const
 

Static Public Member Functions

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

Static Public Attributes

static constexpr bool bHasIntrusiveUnsetOptionalState = true
 

Friends

template<typename >
class TScriptSparseSet
 
struct TSETPRIVATEFRIEND
 
uint32 GetTypeHash (const UE_TSPARSE_SET &Set)=delete
 
bool operator== (const UE_TSPARSE_SET &, const UE_TSPARSE_SET &)=delete
 
bool operator!= (const UE_TSPARSE_SET &, const UE_TSPARSE_SET &)=delete
 

Detailed Description

template<typename InElementType, typename KeyFuncs, typename Allocator>
class UE_TSPARSE_SET< 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.

Member Typedef Documentation

◆ AllocatorType

◆ ElementType

◆ IntrusiveUnsetOptionalStateType

using UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::IntrusiveUnsetOptionalStateType = UE_TSPARSE_SET

◆ KeyFuncsType

typedef KeyFuncs UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::KeyFuncsType

◆ SizeType

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

◆ TRangedForConstIterator

using UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::TRangedForConstIterator = TBaseIterator<true, true>

◆ TRangedForIterator

using UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::TRangedForIterator = TBaseIterator<false, true>

Constructor & Destructor Documentation

◆ UE_TSPARSE_SET() [1/10]

Initialization constructor.

◆ UE_TSPARSE_SET() [2/10]

◆ UE_TSPARSE_SET() [3/10]

Copy constructor.

◆ UE_TSPARSE_SET() [4/10]

◆ UE_TSPARSE_SET() [5/10]

◆ ~UE_TSPARSE_SET()

◆ UE_TSPARSE_SET() [6/10]

◆ UE_TSPARSE_SET() [7/10]

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

Initializer list constructor.

◆ UE_TSPARSE_SET() [8/10]

Move constructor.

◆ UE_TSPARSE_SET() [9/10]

Constructor for moving elements from a UE_TSPARSE_SET with a different SetAllocator

◆ UE_TSPARSE_SET() [10/10]

Constructor for copying elements from a UE_TSPARSE_SET with a different SetAllocator

Member Function Documentation

◆ Add() [1/2]

UE_FORCEINLINE_HINT FSetElementId UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::Add ( const InElementType InElement,
bool bIsAlreadyInSetPtr = nullptr 
)
inline

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.

◆ Add() [2/2]

UE_FORCEINLINE_HINT FSetElementId UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::Add ( InElementType &&  InElement,
bool bIsAlreadyInSetPtr = nullptr 
)
inline

◆ AddByHash() [1/2]

UE_FORCEINLINE_HINT FSetElementId UE_TSPARSE_SET< 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
KeyHashA precomputed hash value, calculated in the same way as ElementType is hashed.
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

◆ AddByHash() [2/2]

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

◆ Append() [1/7]

void UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::Append ( const UE_TSPARSE_SET< ElementType, KeyFuncs, OtherAllocator > &  OtherSet)
inline

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

Parameters
OtherSet- The other set of items to add.

◆ Append() [2/7]

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.

◆ Append() [3/7]

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

◆ Append() [4/7]

void UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::Append ( TArray< ElementType, ArrayAllocator > &&  InElements)
inline

◆ Append() [5/7]

void UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::Append ( TArrayView< const ElementType InElements)
inline

◆ Append() [6/7]

void UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::Append ( UE_TSPARSE_SET< ElementType, KeyFuncs, OtherAllocator > &&  OtherSet)
inline

◆ Append() [7/7]

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.

◆ AppendHash()

static void UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::AppendHash ( const FPlatformTypeLayoutParameters LayoutParams,
FSHA1 Hasher 
)
inlinestatic

◆ Array()

TArray< ElementType > UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::Array ( ) const
inline
Returns
a TArray of the elements

◆ begin() [1/2]

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

◆ begin() [2/2]

◆ CheckAddress()

UE_FORCEINLINE_HINT void UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::CheckAddress ( const ElementType Addr) const
inline

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.

◆ Compact()

void UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::Compact ( )
inline

Compacts the allocated elements into a contiguous range.

◆ CompactStable()

void UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::CompactStable ( )
inline

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

◆ Contains()

UE_FORCEINLINE_HINT bool UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::Contains ( KeyInitType  Key) const
inline

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.

◆ ContainsByHash()

template<typename ComparableKey >
bool UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::ContainsByHash ( uint32  KeyHash,
const ComparableKey Key 
) const
inline

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

See also
Class documentation section on ByHash() functions

◆ CopyUnfrozen()

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

◆ CountBytes()

void UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::CountBytes ( FArchive Ar) const
inline

Tracks the container's memory use through an archive.

◆ CreateConstIterator()

UE_FORCEINLINE_HINT TConstIterator UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::CreateConstIterator ( ) const
inline

Creates a const iterator for the contents of this set

◆ CreateIterator()

UE_FORCEINLINE_HINT TIterator UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::CreateIterator ( )
inline

Creates an iterator for the contents of this set

◆ Difference()

UE_TSPARSE_SET UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::Difference ( const UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator > &  OtherSet) const
inline
Returns
the complement of two sets. (A not in B where A is this and B is Other)

◆ Dump()

void UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::Dump ( FOutputDevice Ar)
inline

Describes the set's contents through an output device.

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

◆ DumpHashElements()

void UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::DumpHashElements ( FOutputDevice Ar)
inline

◆ Emplace() [1/2]

template<typename ArgType = ElementType>
FSetElementId UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::Emplace ( ArgType &&  Arg,
bool bIsAlreadyInSetPtr = nullptr 
)
inline

Adds an element to the set.

Parameters
ArgThe 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.

◆ Emplace() [2/2]

template<typename... ArgTypes>
TPair< FSetElementId, bool > UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::Emplace ( EInPlace  ,
ArgTypes &&...  InArgs 
)
inline

Adds an element to the set by constructing the ElementType in-place with multiple args.

Parameters
EInPlaceTag to disambiguate in-place construction.
InArgsArguments forwarded to ElementType's constructor.
Returns
Pair of (element id, whether an equivalent element already existed).

◆ EmplaceByHash() [1/2]

template<typename... ArgTypes>
TPair< FSetElementId, bool > UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::EmplaceByHash ( EInPlace  ,
uint32  KeyHash,
ArgTypes &&...  InArgs 
)
inline

Adds an element to the set by constructing in-place with multiple args, using a precomputed hash.

See also
Class documentation section on ByHash() functions.
Parameters
KeyHashA precomputed hash value, calculated in the same way as ElementType is hashed.
EInPlaceTag to disambiguate in-place construction.
InArgsArguments forwarded to ElementType's constructor.
Returns
Pair of (element id, whether an equivalent element already existed).

◆ EmplaceByHash() [2/2]

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

Adds an element to the set.

See also
Class documentation section on ByHash() functions
Parameters
KeyHashA precomputed hash value, calculated in the same way as ElementType is hashed.
ArgThe 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.

◆ Empty()

void UE_TSPARSE_SET< 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.

◆ end() [1/2]

◆ end() [2/2]

◆ Find() [1/2]

ElementType * UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::Find ( KeyInitType  Key)
inline

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.

◆ Find() [2/2]

UE_FORCEINLINE_HINT const ElementType * UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::Find ( KeyInitType  Key) const
inline

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.

◆ FindArbitraryElement() [1/2]

ElementType * UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::FindArbitraryElement ( )
inline

Finds any element in the set and returns a pointer to it. Callers should not depend on particular patterns in the behaviour of this function.

Returns
A pointer to an arbitrary element, or nullptr if the container is empty.

◆ FindArbitraryElement() [2/2]

const ElementType * UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::FindArbitraryElement ( ) const
inline

◆ FindByHash() [1/2]

template<typename ComparableKey >
ElementType * UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::FindByHash ( uint32  KeyHash,
const ComparableKey Key 
)
inline

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.

◆ FindByHash() [2/2]

template<typename ComparableKey >
const ElementType * UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::FindByHash ( uint32  KeyHash,
const ComparableKey Key 
) const
inline

◆ FindId()

FSetElementId UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::FindId ( KeyInitType  Key) const
inline

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.

◆ FindIdByHash()

template<typename ComparableKey >
FSetElementId UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::FindIdByHash ( uint32  KeyHash,
const ComparableKey Key 
) const
inline

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

◆ FindOrAdd() [1/2]

UE_FORCEINLINE_HINT ElementType & UE_TSPARSE_SET< 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.

◆ FindOrAdd() [2/2]

UE_FORCEINLINE_HINT ElementType & UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::FindOrAdd ( InElementType &&  InElement,
bool bIsAlreadyInSetPtr = nullptr 
)
inline

◆ FindOrAddByHash()

ElementType & UE_TSPARSE_SET< 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
KeyHashA precomputed hash value, calculated in the same way as ElementType is hashed.
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

◆ Get() [1/2]

Accesses the identified element's value. Element must be valid (see @IsValidId).

◆ Get() [2/2]

UE_FORCEINLINE_HINT const ElementType & UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::Get ( FSetElementId  Id) const
inline

Accesses the identified element's value. Element must be valid (see @IsValidId).

◆ GetAllocatedSize()

UE_FORCEINLINE_HINT SIZE_T UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::GetAllocatedSize ( void  ) 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

◆ GetMaxIndex()

UE_FORCEINLINE_HINT int32 UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::GetMaxIndex ( ) const
inline
Returns
The non-inclusive maximum index of elements in the set.

◆ Includes()

bool UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::Includes ( const UE_TSPARSE_SET< ElementType, KeyFuncs, Allocator > &  OtherSet) const
inline

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

◆ Intersect()

UE_TSPARSE_SET UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::Intersect ( const UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator > &  OtherSet) const
inline
Returns
the intersection of two sets. (A AND B)

◆ IsEmpty()

bool UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::IsEmpty ( ) const
inline

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

Returns
True if the set is empty.
See also
Num

◆ IsValidId()

bool UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::IsValidId ( FSetElementId  Id) const
inline

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.

◆ Max()

UE_FORCEINLINE_HINT int32 UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::Max ( ) const
inline
Returns
The number of elements the set can hold before reallocation.

◆ Num()

UE_FORCEINLINE_HINT int32 UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::Num ( ) const
inline
Returns
the number of elements.

◆ operator=() [1/7]

UE_TSPARSE_SET & UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::operator= ( const UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator > &  Copy)
inline

Assignment operator.

◆ operator=() [2/7]

UE_TSPARSE_SET & UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::operator= ( const UE_TSPARSE_SET< ElementType, KeyFuncs, OtherAllocator > &  Other)
inline

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

◆ 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.

◆ operator=() [4/7]

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

Initializer list assignment operator

◆ operator=() [5/7]

UE_TSPARSE_SET & UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::operator= ( UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator > &&  Other)
inline

Move assignment operator.

◆ operator=() [6/7]

UE_TSPARSE_SET & UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::operator= ( UE_TSPARSE_SET< ElementType, KeyFuncs, OtherAllocator > &&  Other)
inline

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

◆ operator=() [7/7]

Move assignment operator. Compatible element type version.

Parameters
OtherSet to assign and move from.

◆ operator==()

bool UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::operator== ( FIntrusiveUnsetOptionalState  Tag) const
inline

◆ operator[]() [1/2]

Accesses the identified element's value. Element must be valid (see @IsValidId).

◆ operator[]() [2/2]

UE_FORCEINLINE_HINT const ElementType & UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::operator[] ( FSetElementId  Id) const
inline

Accesses the identified element's value. Element must be valid (see @IsValidId).

◆ Relax()

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

◆ Remove() [1/2]

void UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::Remove ( FSetElementId  ElementId)
inline

Removes an element from the set.

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

◆ Remove() [2/2]

int32 UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::Remove ( KeyInitType  Key)
inline

Removes all elements from the set matching the specified key.

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

◆ RemoveByHash()

template<typename ComparableKey >
int32 UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::RemoveByHash ( uint32  KeyHash,
const ComparableKey Key 
)
inline

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.

◆ RemoveStable() [1/2]

void UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::RemoveStable ( FSetElementId  ElementId)
inline

Removes an element from the set while maintaining set order.

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

◆ RemoveStable() [2/2]

int32 UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::RemoveStable ( KeyInitType  Key)
inline

Removes an element from the set while maintaining set order.

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

◆ Reserve()

void UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::Reserve ( int32  Number)
inline

Preallocates enough memory to contain Number elements

◆ Reset()

void UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::Reset ( )
inline

Efficiently empties out the set but preserves all allocations and capacities

◆ Shrink()

void UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::Shrink ( )
inline

Shrinks the set's element storage to avoid slack.

◆ Sort()

void UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::Sort ( const PREDICATE_CLASS Predicate)
inline

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

◆ SortFreeList()

void UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::SortFreeList ( )
inline

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.

◆ StableSort()

void UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::StableSort ( const PREDICATE_CLASS Predicate)
inline

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

◆ Union()

UE_TSPARSE_SET UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::Union ( const UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator > &  OtherSet) const
inline
Returns
the union of two sets. (A OR B)

◆ VerifyHashElementsKey()

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

◆ WriteMemoryImage()

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

Friends And Related Symbol Documentation

◆ GetTypeHash

uint32 GetTypeHash ( const UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator > &  Set)
friend

◆ operator!=

bool operator!= ( const UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator > &  ,
const UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator > &   
)
friend

◆ operator==

bool operator== ( const UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator > &  ,
const UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator > &   
)
friend

◆ TScriptSparseSet

template<typename >
friend class TScriptSparseSet
friend

◆ TSETPRIVATEFRIEND

Member Data Documentation

◆ bHasIntrusiveUnsetOptionalState

constexpr bool UE_TSPARSE_SET< InElementType, KeyFuncs, Allocator >::bHasIntrusiveUnsetOptionalState = true
staticconstexpr

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