Language:
Discover
By Skill Level
By Category

TSet

Choose your OS:

Inheritance Hierarchy

Syntax

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

Remarks

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

Constructors

Name Description

Public function

TSet()

Initialization constructor.

Public function

TSet

(
    const TSet & Copy
)

Copy constructor.

Public function

TSet

(
    const TArray < ElementType >& InArr...
)

Public function

TSet

(
    TArray < ElementType >&& InArray
)

Public function

TSet

(
    std::initializer_list< ElementType ...
)

Initializer list constructor.

Public function

TSet

(
    TSet && Other
)

Move constructor.

Public function

TSet

(
    TSet < ElementType , KeyFuncs, OtherA...
)

Constructor for moving elements from a TSet with a different SetAllocator

Public function

TSet

(
    const TSet < ElementType , KeyFuncs, ...
)

Constructor for copying elements from a TSet with a different SetAllocator

Destructors

Name Description

Public function

~TSet()

Destructor.

Functions

Name Description

Public function

FSetElementI ...

 

Add

(
    InElementType&& InElement,
    bool* bIsAlreadyInSetPtr
)

Public function

FSetElementI ...

 

Add

(
    const InElementType& InElement,
    bool* bIsAlreadyInSetPtr
)

Adds an element to the set.

A pointer to the element stored in the set.

Public function

void

 

Append

(
    const TArray < ElementType , ArrayAll...
)

Public function

void

 

Append

(
    TSet < ElementType , KeyFuncs, OtherA...
)

Public function

void

 

Append

(
    std::initializer_list< ElementType ...
)

Public function

void

 

Append

(
    TArray < ElementType , ArrayAllocator...
)

Public function

void

 

Append

(
    const TSet < ElementType , KeyFuncs, ...
)

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

Public function

TArray < Elem ...

 

Array()

A TArray of the elements

Public function

void

 

CheckAddress

(
    const ElementType * Addr
)

Checks that the specified address is not part of an element within the container.

Public function

void

 

Compact()

Compacts the allocated elements into a contiguous range.

Public function

void

 

CompactStable()

Compacts the allocated elements into a contiguous range.

Public function

bool

 

Contains

(
    KeyInitType Key
)

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

Public function

void

 

CountBytes

(
    FArchive & Ar
)

Tracks the container's memory use through an archive.

Public function

TConstIterat ...

 

CreateConstIterator()

Creates a const iterator for the contents of this set

Public function

TIterator

 

CreateIterator()

Creates an iterator for the contents of this set

Public function

TSet

 

Difference

(
    const TSet & OtherSet
)

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

Public function

void

 

Dump

(
    FOutputDevice & Ar
)

Describes the set's contents through an output device.

Public function

void

 

DumpHashElements

(
    FOutputDevice & Ar
)

Public function

FSetElementI ...

 

Emplace

(
    ArgsType&& Args,
    bool* bIsAlreadyInSetPtr
)

Adds an element to the set.

A pointer to the element stored in the set.

Public function

void

 

Empty

(
    int32 ExpectedNumElements
)

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

Public function

ElementType ...

 

Find

(
    KeyInitType Key
)

Finds an element with the given key in the set.

Public function

const Elemen ...

 

Find

(
    KeyInitType Key
)

Finds an element with the given key in the set.

Public function

FSetElementI ...

 

FindId

(
    KeyInitType Key
)

Finds an element with the given key in the set.

Public function

uint32

 

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.

Public function

bool

 

Includes

(
    const TSet < ElementType , KeyFuncs, ...
)

Determine whether the specified set is entirely included within this set

Public function

TSet

 

Intersect

(
    const TSet & OtherSet
)

The intersection of two sets. (A AND B)

Public function

bool

 

IsValidId

(
    FSetElementId Id
)

Checks whether an element id is valid.

Public function

int32

 

Num()

The number of elements.

Public function

void

 

Relax()

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

Public function

void

 

Remove

(
    FSetElementId ElementId
)

Removes an element from the set.

Public function

int32

 

Remove

(
    KeyInitType Key
)

Removes all elements from the set matching the specified key.

The number of elements removed.

Public function

void

 

Reserve

(
    int32 Number
)

Preallocates enough memory to contain Number elements

Public function

void

 

Reset()

Efficiently empties out the set but preserves all allocations and capacities

Public function

void

 

Shrink()

Shrinks the set's element storage to avoid slack.

Public function

void

 

Sort

(
    const PREDICATE_CLASS& Predicate
)

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

Public function

TSet

 

Union

(
    const TSet & OtherSet
)

The union of two sets. (A OR B)

Public function

bool

 

VerifyHashElementsKey

(
    KeyInitType Key
)

Operators

Name Description

Public function

const Elemen ...

 

operator[]

(
    FSetElementId Id
)

Accesses the identified element's value.

Public function

ElementType ...

 

operator[]

(
    FSetElementId Id
)

Accesses the identified element's value.

Public function

TSet &

 

operator=

(
    const TSet & Copy
)

Assignment operator.

Public function

TSet &

 

operator=

(
    TSet < ElementType , KeyFuncs, OtherA...
)

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

Public function

TSet &

 

operator=

(
    std::initializer_list< ElementType ...
)

Initializer list assignment operator

Public function

TSet &

 

operator=

(
    TSet && Other
)

Move assignment operator.

Public function

TSet &

 

operator=

(
    const TSet < ElementType , KeyFuncs, ...
)

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

Classes

Name

Description

Public class

TConstIterator

Used to iterate over the elements of a const TSet .

Public class

TConstKeyIterator

Used to iterate over the elements of a const TSet .

Public class

TIterator

Used to iterate over the elements of a TSet .

Public class

TKeyIterator

Used to iterate over the elements of a TSet .

Typedefs

References

Module

Core

Header

Runtime/Core/Public/Containers/Set.h