| TSet
|
Module |
|
Header |
/Engine/Source/Runtime/Core/Public/Containers/Set.h |
Include |
#include "Containers/Set.h" |
template<typename InElementType, typename KeyFuncs, typename Allocator>
class TSet
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.
Name | Description | |
---|---|---|
|
TSet() |
Initialization constructor. |
|
TSet ( |
Copy constructor. |
|
TSet ( |
|
|
TSet ( |
|
|
TSet ( |
Initializer list constructor. |
|
TSet ( |
Move constructor. |
|
TSet ( |
Constructor for moving elements from a TSet with a different SetAllocator |
|
TSet ( |
Constructor for copying elements from a TSet with a different SetAllocator |
Name | Description | |
---|---|---|
|
~TSet() |
Destructor. |
Name | Description | ||
---|---|---|---|
|
FSetElementI... |
Add ( |
|
|
FSetElementI... |
Add ( |
Adds an element to the set. |
|
FSetElementI... |
AddByHash ( |
|
|
FSetElementI... |
AddByHash ( |
Adds an element to the set. |
|
void |
Append ( |
|
|
void |
Append ( |
Add all items from another set to our set (union without creating a new set) Compatible element type version. |
|
void |
Append ( |
Add all items from another set to our set (union without creating a new set) Compatible element type version. |
|
void |
Append ( |
|
|
void |
Append ( |
|
|
void |
Append ( |
Add all items from another set to our set (union without creating a new set) |
|
void |
Append ( |
|
|
void |
Append ( |
|
|
void |
Append ( |
|
|
void |
AppendHash ( |
|
|
Array() |
||
|
TRangedForCo... |
begin() |
|
|
TRangedForIt... |
begin() |
DO NOT USE DIRECTLY STL-like iterators to enable range-based for loop support. |
|
void |
CheckAddress ( |
Checks that the specified address is not part of an element within the container. |
|
void |
Compact() |
Compacts the allocated elements into a contiguous range. |
|
void |
CompactStable() |
Compacts the allocated elements into a contiguous range. |
|
bool |
Contains ( |
Checks if the element contains an element with the given key. |
|
bool |
ContainsByHash ( |
Checks if the element contains an element with the given key. |
|
void |
CopyUnfrozen ( |
|
|
void |
CountBytes ( |
Tracks the container's memory use through an archive. |
|
TConstIterat... |
CreateConstIterator() |
Creates a const iterator for the contents of this set |
|
CreateIterator() |
Creates an iterator for the contents of this set |
|
|
Difference ( |
||
|
void |
Dump ( |
Describes the set's contents through an output device. |
|
void |
DumpHashElements ( |
|
|
FSetElementI... |
Emplace ( |
Adds an element to the set. |
|
FSetElementI... |
EmplaceByHash ( |
Adds an element to the set. |
|
void |
Empty ( |
Removes all elements from the set, potentially leaving space allocated for an expected number of elements about to be added. |
|
TRangedForIt... |
end() |
|
|
TRangedForCo... |
end() |
|
|
ElementType ... |
Find ( |
Finds an element with the given key in the set. |
|
const Elemen... |
Find ( |
Finds an element with the given key in the set. |
|
ElementType ... |
FindByHash ( |
Finds an element with a pre-calculated hash and a key that can be compared to KeyType. |
|
const Elemen... |
FindByHash ( |
|
|
FSetElementI... |
FindId ( |
Finds an element with the given key in the set. |
|
FSetElementI... |
FindIdByHash ( |
Finds an element with a pre-calculated hash and a key that can be compared to KeyType |
|
ElementType ... |
FindOrAdd ( |
Adds an element to the set if not already present and returns a reference to the added or existing element. |
|
ElementType ... |
FindOrAdd ( |
Adds an element to the set if not already present and returns a reference to the added or existing element. |
|
ElementType ... |
FindOrAddByHash ( |
Adds an element to the set if not already present and returns a reference to the added or existing element. |
|
const Elemen... |
Get ( |
Accesses the identified element's value. Element must be valid (see ). |
|
ElementType ... |
Get ( |
Accesses the identified element's value. Element must be valid (see ). |
|
SIZE_T |
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. |
|
int32 |
GetMaxIndex() |
|
|
bool |
Includes ( |
Determine whether the specified set is entirely included within this set |
|
Intersect ( |
||
|
bool |
IsEmpty() |
Returns true if the sets is empty and contains no elements. |
|
bool |
IsValidId ( |
Checks whether an element id is valid. |
|
int32 |
Num() |
|
|
void |
Relax() |
Relaxes the set's hash to a size strictly bounded by the number of elements in the set. |
|
void |
Remove ( |
Removes an element from the set. |
|
int32 |
Remove ( |
Removes all elements from the set matching the specified key. |
|
int32 |
RemoveByHash ( |
Removes all elements from the set matching the specified key. |
|
void |
Reserve ( |
Preallocates enough memory to contain Number elements |
|
void |
Reset() |
Efficiently empties out the set but preserves all allocations and capacities |
|
void |
Shrink() |
Shrinks the set's element storage to avoid slack. |
|
void |
Sort ( |
Sorts the set's elements using the provided comparison class. |
|
void |
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. |
|
void |
StableSort ( |
Stable sorts the set's elements using the provided comparison class. |
|
Union ( |
||
|
bool |
VerifyHashElementsKey ( |
|
|
void |
WriteMemoryImage ( |
Name | Description | ||
---|---|---|---|
|
const Elemen... |
operator[] ( |
Accesses the identified element's value. Element must be valid (see ). |
|
ElementType ... |
operator[] ( |
Accesses the identified element's value. Element must be valid (see ). |
|
TSet & |
operator= ( |
Move assignment operator. Compatible element type version. |
|
TSet & |
operator= ( |
Assignment operator for copying elements from a TSet with a different SetAllocator |
|
TSet & |
operator= ( |
Assignment operator for moving elements from a TSet with a different SetAllocator |
|
TSet & |
operator= ( |
Move assignment operator. |
|
TSet & |
operator= ( |
Assignment operator. |
|
TSet & |
operator= ( |
Assignment operator. |
|
TSet & |
operator= ( |
Initializer list assignment operator |
Name |
Description |
|
---|---|---|
|
TConstIterator |
Used to iterate over the elements of a const TSet. |
|
TConstKeyIterator |
Used to iterate over the elements of a const TSet. |
|
TIterator |
Used to iterate over the elements of a TSet. |
|
TKeyIterator |
Used to iterate over the elements of a TSet. |