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

#include <SlateElementSortedArray.h>

Public Types

using SizeType = typename DataType::SizeType
 
using ElementType = InElementType
 
using ElementParamType = typename TCallTraits< ElementType >::ParamType
 
using SortPredicate = TLess<>
 
using RangedForConstIteratorType = typename DataType::RangedForConstIteratorType
 

Public Member Functions

FORCEINLINE ElementParamType operator[] (SizeType Index) const
 
FORCEINLINE void Empty (SizeType ExpectedNumElements=0)
 
FORCEINLINE bool IsValidIndex (SizeType Index) const
 
FORCEINLINE SizeType Num () const
 
SizeType Find (ElementParamType Item) const
 
bool Contains (ElementParamType Item) const
 
SizeType FindLowerBound (ElementParamType Value) const
 
SizeType FindUpperBound (ElementParamType Value) const
 
SizeType InsertUnique (ElementParamType Item)
 
FORCEINLINE SizeType AddUnsorted (ElementType Item)
 
SizeType RemoveSingle (ElementParamType Item)
 
template<typename CountType >
FORCEINLINE void RemoveAt (SizeType Index, CountType Count)
 
void Sort ()
 
FORCEINLINE RangedForConstIteratorType begin () const
 
FORCEINLINE RangedForConstIteratorType end () const
 

Detailed Description

template<typename InElementType, typename InSortPredicate = TLess<>>
class TSlateElementSortedArray< InElementType, InSortPredicate >

An Array of elements that are always sorted.

Member Typedef Documentation

◆ ElementParamType

◆ ElementType

◆ RangedForConstIteratorType

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

◆ SizeType

◆ SortPredicate

Member Function Documentation

◆ AddUnsorted()

Adds a new item to the end of the array. The array needs to be sorted manually after. Use when multiple insertion is needed and it would be faster to sort the array once.

Parameters
ItemThe item to add
Returns
Index to the new item

◆ begin()

◆ Contains()

Checks if this array contains the element.

Parameters
ItemItem to look for.
Returns
True if found. False otherwise.

◆ Empty()

FORCEINLINE void TSlateElementSortedArray< InElementType, InSortPredicate >::Empty ( SizeType  ExpectedNumElements = 0)
inline

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

◆ end()

◆ Find()

Binary searches the element within the array.

Parameters
ItemItem to look for.
Returns
Index of the found element. INDEX_NONE otherwise.

◆ FindLowerBound()

Returns
the index of the first element >= value, or INDEX_NONE if no such element is found.

◆ FindUpperBound()

Returns
the index of the first element > value, or INDEX_NONE if no such element if found.

◆ InsertUnique()

Adds a new item to the array at the sorted location if it doesn't exist, possibly reallocating the whole array to fit.

Parameters
ItemThe item to add
Returns
Index to the new item

◆ IsValidIndex()

Returns
True if index is valid. False otherwise.

◆ Num()

Returns
The number of elements in the array.

◆ operator[]()

Returns
Reference to indexed element.

◆ RemoveAt()

Removes an element (or elements) at given location optionally shrinking the array.

Parameters
IndexLocation in array of the element to remove.
Count(Optional) Number of elements to remove. Default is 1.
bAllowShrinking(Optional) Tells if this call can shrink array if suitable after remove. Default is true.

◆ RemoveSingle()

Removes the first occurrence of the specified item in the array, maintaining order but not indices.

Parameters
ItemThe item to remove.
Returns
The number of items removed. For RemoveSingle, this is always either 0 or 1.

◆ Sort()

Sorts the array using the SortPredicate.


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