UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
Algo Namespace Reference

Namespaces

namespace  MergeSort
 
namespace  Private
 

Enumerations

enum  ENoRef { NoRef }
 
enum class  ETopologicalSort { None , AllowCycles }
 

Functions

template<typename RangeType , typename PredicateType >
void ParallelSort (RangeType &&Range, PredicateType Predicate)
 
template<typename RangeType , typename PredicateType >
void ParallelSortForceSingleThreaded (RangeType &&Range, PredicateType Predicate)
 
template<typename RangeType >
void ParallelSort (RangeType &&Range)
 
template<typename RangeType , typename PredicateType >
void ParallelSortForceSingleThreaded (RangeType &&Range)
 
int32 FindSortedStringCaseInsensitive (const TCHAR *Str, const TCHAR *const *SortedArray, int32 ArrayCount)
 
template<typename T , typename A , typename OpT >
Accumulate (const A &Input, T Init, OpT Op)
 
template<typename T , typename A >
UE_REWRITEAccumulate (const A &Input, T Init)
 
template<typename T , typename A , typename MapT , typename OpT >
TransformAccumulate (const A &Input, MapT MapOp, T Init, OpT Op)
 
template<typename T , typename A , typename MapT >
UE_REWRITETransformAccumulate (const A &Input, MapT MapOp, T Init)
 
template<typename RangeType >
bool AllOf (const RangeType &Range)
 
template<typename RangeType , typename ProjectionType >
bool AllOf (const RangeType &Range, ProjectionType Projection)
 
template<typename RangeType >
UE_REWRITE bool AnyOf (const RangeType &Range)
 
template<typename RangeType , typename ProjectionType >
UE_REWRITE bool AnyOf (const RangeType &Range, ProjectionType Projection)
 
template<typename RangeType , typename ProjectionType >
UE_REWRITE bool AnyOf (const RangeType &Range, ProjectionType Projection, ENoRef NoRef)
 
template<typename RangeType , typename ValueType , typename SortPredicateType >
UE_REWRITE auto LowerBound (const RangeType &Range, const ValueType &Value, SortPredicateType SortPredicate) -> decltype(GetNum(Range))
 
template<typename RangeType , typename ValueType >
UE_REWRITE auto LowerBound (const RangeType &Range, const ValueType &Value) -> decltype(GetNum(Range))
 
template<typename RangeType , typename ValueType , typename ProjectionType , typename SortPredicateType >
UE_REWRITE auto LowerBoundBy (const RangeType &Range, const ValueType &Value, ProjectionType Projection, SortPredicateType SortPredicate) -> decltype(GetNum(Range))
 
template<typename RangeType , typename ValueType , typename ProjectionType >
UE_REWRITE auto LowerBoundBy (const RangeType &Range, const ValueType &Value, ProjectionType Projection) -> decltype(GetNum(Range))
 
template<typename RangeType , typename ValueType , typename SortPredicateType >
UE_REWRITE auto UpperBound (const RangeType &Range, const ValueType &Value, SortPredicateType SortPredicate) -> decltype(GetNum(Range))
 
template<typename RangeType , typename ValueType >
UE_REWRITE auto UpperBound (const RangeType &Range, const ValueType &Value) -> decltype(GetNum(Range))
 
template<typename RangeType , typename ValueType , typename ProjectionType , typename SortPredicateType >
UE_REWRITE auto UpperBoundBy (const RangeType &Range, const ValueType &Value, ProjectionType Projection, SortPredicateType SortPredicate) -> decltype(GetNum(Range))
 
template<typename RangeType , typename ValueType , typename ProjectionType >
UE_REWRITE auto UpperBoundBy (const RangeType &Range, const ValueType &Value, ProjectionType Projection) -> decltype(GetNum(Range))
 
template<typename RangeType , typename ValueType , typename SortPredicateType >
auto BinarySearch (const RangeType &Range, const ValueType &Value, SortPredicateType SortPredicate) -> decltype(GetNum(Range))
 
template<typename RangeType , typename ValueType >
UE_REWRITE auto BinarySearch (const RangeType &Range, const ValueType &Value)
 
template<typename RangeType , typename ValueType , typename ProjectionType , typename SortPredicateType >
auto BinarySearchBy (const RangeType &Range, const ValueType &Value, ProjectionType Projection, SortPredicateType SortPredicate) -> decltype(GetNum(Range))
 
template<typename RangeType , typename ValueType , typename ProjectionType >
UE_REWRITE auto BinarySearchBy (const RangeType &Range, const ValueType &Value, ProjectionType Projection)
 
template<typename InAT , typename InBT >
constexpr bool Compare (const InAT &InputA, const InBT &InputB)
 
template<typename InAT , typename InBT , typename PredicateT >
constexpr bool Compare (const InAT &InputA, const InBT &InputB, PredicateT Predicate)
 
template<typename InAT , typename InBT , typename ProjectionT >
constexpr bool CompareBy (const InAT &InputA, const InBT &InputB, ProjectionT Projection)
 
template<typename InAT , typename InBT , typename ProjectionT , typename PredicateT >
constexpr bool CompareBy (const InAT &InputA, const InBT &InputB, ProjectionT Projection, PredicateT Predicate)
 
template<typename MapType , typename KeyLessThanType , typename ValueLessThanType >
int CompareMap (const MapType &A, const MapType &B, KeyLessThanType KeyLessThan, ValueLessThanType ValueLessThan)
 
template<typename MapType >
int CompareMap (const MapType &A, const MapType &B)
 
template<typename MapType , typename KeyLessThanType >
int CompareMap (const MapType &A, const MapType &B, KeyLessThanType KeyLessThan)
 
template<typename SetType , typename KeyLessThanType >
int CompareSet (const SetType &A, const SetType &B, KeyLessThanType KeyLessThan)
 
template<typename SetType >
int CompareSet (const SetType &A, const SetType &B)
 
template<typename RangeType , typename ValueType >
UE_REWRITE constexpr bool Contains (RangeType &&Range, const ValueType &Value)
 
template<typename RangeType , typename ValueType , typename ProjectionType >
UE_REWRITE constexpr bool ContainsBy (RangeType &&Range, const ValueType &Value, ProjectionType Proj)
 
template<typename InT , typename OutT , typename PredicateT >
void CopyIf (const InT &Input, OutT &Output, PredicateT Predicate)
 
template<typename InT , typename OutT >
void Copy (const InT &Input, OutT &Output)
 
template<typename InT , typename OutT >
void Copy (const InT &Input, OutT &Output, ENoRef NoRef)
 
template<typename InT , typename ValueT >
SIZE_T Count (const InT &Input, const ValueT &InValue)
 
template<typename InT , typename PredicateT >
SIZE_T CountIf (const InT &Input, PredicateT Predicate)
 
template<typename InT , typename ValueT , typename ProjectionT >
SIZE_T CountBy (const InT &Input, const ValueT &InValue, ProjectionT Proj)
 
template<typename RangeType , typename ValueType >
UE_REWRITE constexpr auto Find (RangeType &&Range, const ValueType &Value) -> decltype(AlgoImpl::FindBy(Forward< RangeType >(Range), Value, FIdentityFunctor()))
 
template<typename RangeType , typename ValueType , typename ProjectionType >
UE_REWRITE constexpr auto FindBy (RangeType &&Range, const ValueType &Value, ProjectionType Proj) -> decltype(AlgoImpl::FindBy(Forward< RangeType >(Range), Value, MoveTemp(Proj)))
 
template<typename RangeType , typename PredicateType >
UE_REWRITE constexpr auto FindByPredicate (RangeType &&Range, PredicateType Pred) -> decltype(AlgoImpl::FindByPredicate(Forward< RangeType >(Range), MoveTemp(Pred)))
 
template<typename RangeType , typename ValueType >
UE_REWRITE auto FindLast (RangeType &&Range, const ValueType &Value) -> decltype(AlgoImpl::FindLastBy(GetData(Range), GetNum(Range), Value, FIdentityFunctor()))
 
template<typename RangeType , typename ValueType , typename ProjectionType >
UE_REWRITE auto FindLastBy (RangeType &&Range, const ValueType &Value, ProjectionType Proj) -> decltype(AlgoImpl::FindLastBy(GetData(Range), GetNum(Range), Value, MoveTemp(Proj)))
 
template<typename RangeType , typename PredicateType >
UE_REWRITE auto FindLastByPredicate (RangeType &&Range, PredicateType Pred) -> decltype(AlgoImpl::FindLastByPredicate(GetData(Range), GetNum(Range), MoveTemp(Pred)))
 
template<typename RangeWhereType , typename RangeWhatType >
auto FindSequence (const RangeWhereType &Where, const RangeWhatType &What) -> decltype(AlgoImpl::FindSequence(GetData(Where), GetData(Where)+GetNum(Where), GetData(What), GetData(What)+GetNum(What)))
 
template<int32 ArraySize>
UE_REWRITE int32 FindSortedStringCaseInsensitive (const TCHAR *Str, const TCHAR *const (&SortedArray)[ArraySize])
 
template<typename InT , typename PredicateT , typename CallableT >
void ForEachIf (InT &&Input, PredicateT Predicate, CallableT Callable)
 
template<typename InT , typename CallableT >
void ForEach (InT &&Input, CallableT Callable)
 
template<typename RangeType >
UE_REWRITE void Heapify (RangeType &&Range)
 
template<typename RangeType , typename PredicateType >
UE_REWRITE void Heapify (RangeType &&Range, PredicateType Predicate)
 
template<typename RangeType , typename ProjectionType , typename PredicateType >
UE_REWRITE void HeapifyBy (RangeType &&Range, ProjectionType Projection)
 
template<typename RangeType , typename ProjectionType , typename PredicateType >
UE_REWRITE void HeapifyBy (RangeType &&Range, ProjectionType Projection, PredicateType Predicate)
 
template<typename RangeType >
UE_REWRITE void HeapSort (RangeType &&Range)
 
template<typename RangeType , typename PredicateType >
UE_REWRITE void HeapSort (RangeType &&Range, PredicateType Predicate)
 
template<typename RangeType , typename ProjectionType >
UE_REWRITE void HeapSortBy (RangeType &&Range, ProjectionType Projection)
 
template<typename RangeType , typename ProjectionType , typename PredicateType >
UE_REWRITE void HeapSortBy (RangeType &&Range, ProjectionType Projection, PredicateType Predicate)
 
template<typename RangeTypeA , typename RangeTypeB >
constexpr bool Includes (const RangeTypeA &RangeA, const RangeTypeB &RangeB)
 
template<typename RangeTypeA , typename RangeTypeB , typename SortPredicateType >
constexpr bool Includes (const RangeTypeA &RangeA, const RangeTypeB &RangeB, SortPredicateType SortPredicate)
 
template<typename RangeTypeA , typename RangeTypeB , typename ProjectionType >
constexpr bool IncludesBy (const RangeTypeA &RangeA, const RangeTypeB &RangeB, ProjectionType Projection)
 
template<typename RangeTypeA , typename RangeTypeB , typename ProjectionType , typename SortPredicateType >
constexpr bool IncludesBy (const RangeTypeA &RangeA, const RangeTypeB &RangeB, ProjectionType Projection, SortPredicateType SortPredicate)
 
template<typename RangeType , typename ValueType >
UE_REWRITE auto IndexOf (const RangeType &Range, const ValueType &Value)
 
template<typename RangeType , typename ValueType , typename ProjectionType >
UE_REWRITE auto IndexOfBy (const RangeType &Range, const ValueType &Value, ProjectionType Proj)
 
template<typename RangeType , typename PredicateType >
UE_REWRITE auto IndexOfByPredicate (const RangeType &Range, PredicateType Pred)
 
template<typename RangeType >
UE_REWRITE void IntroSort (RangeType &&Range)
 
template<typename RangeType , typename PredicateType >
UE_REWRITE void IntroSort (RangeType &&Range, PredicateType Predicate)
 
template<typename RangeType , typename ProjectionType >
UE_REWRITE void IntroSortBy (RangeType &&Range, ProjectionType Proj)
 
template<typename RangeType , typename ProjectionType , typename PredicateType >
UE_REWRITE void IntroSortBy (RangeType &&Range, ProjectionType Proj, PredicateType Predicate)
 
template<typename RangeType >
UE_REWRITE bool IsHeap (const RangeType &Range)
 
template<typename RangeType , typename PredicateType >
UE_REWRITE bool IsHeap (const RangeType &Range, PredicateType Predicate)
 
template<typename RangeType , typename ProjectionType >
UE_REWRITE bool IsHeapBy (const RangeType &Range, ProjectionType Projection)
 
template<typename RangeType , typename ProjectionType , typename PredicateType >
UE_REWRITE bool IsHeapBy (const RangeType &Range, ProjectionType Projection, PredicateType Predicate)
 
template<typename RangeType >
UE_REWRITE bool IsSorted (const RangeType &Range)
 
template<typename RangeType , typename PredType >
UE_REWRITE bool IsSorted (const RangeType &Range, PredType Pred)
 
template<typename RangeType , typename ProjectionType >
UE_REWRITE bool IsSortedBy (const RangeType &Range, ProjectionType Projection)
 
template<typename RangeType , typename ProjectionType , typename PredType >
UE_REWRITE bool IsSortedBy (const RangeType &Range, ProjectionType Projection, PredType Pred)
 
 ENUM_CLASS_FLAGS (ETopologicalSort)
 
template<typename RangeType , typename GetElementDependenciesType >
bool KahnTopologicalSort (RangeType &&UniqueRange, GetElementDependenciesType GetElementDependencies, ETopologicalSort Flags)
 
template<typename RangeType >
UE_REWRITE void LegacySort (RangeType &&Range)
 
template<typename RangeType , typename PredicateType >
UE_REWRITE void LegacySort (RangeType &&Range, PredicateType Pred)
 
template<typename RangeType , typename ProjectionType >
UE_REWRITE void LegacySortBy (RangeType &&Range, ProjectionType Proj)
 
template<typename RangeType , typename ProjectionType , typename PredicateType >
UE_REWRITE void LegacySortBy (RangeType &&Range, ProjectionType Proj, PredicateType Pred)
 
template<typename RangeAType , typename RangeBType >
int32 LevenshteinDistance (const RangeAType &RangeA, const RangeBType &RangeB)
 
template<typename RangeType >
UE_REWRITE constexpr auto MaxElement (RangeType &&Range) -> decltype(AlgoImpl::MaxElementBy(Range, FIdentityFunctor(), TLess<>()))
 
template<typename RangeType , typename ComparatorType >
UE_REWRITE auto MaxElement (RangeType &&Range, ComparatorType Comp) -> decltype(AlgoImpl::MaxElementBy(Range, FIdentityFunctor(), MoveTemp(Comp)))
 
template<typename RangeType , typename ProjectionType >
UE_REWRITE auto MaxElementBy (RangeType &&Range, ProjectionType Proj) -> decltype(AlgoImpl::MaxElementBy(Range, MoveTemp(Proj), TLess<>()))
 
template<typename RangeType , typename ProjectionType , typename ComparatorType >
UE_REWRITE auto MaxElementBy (RangeType &&Range, ProjectionType Proj, ComparatorType Comp) -> decltype(AlgoImpl::MaxElementBy(Range, MoveTemp(Proj), MoveTemp(Comp)))
 
template<typename RangeType >
UE_REWRITE auto MinElement (RangeType &&Range) -> decltype(AlgoImpl::MinElementBy(Range, FIdentityFunctor(), TLess<>()))
 
template<typename RangeType , typename ComparatorType >
UE_REWRITE auto MinElement (RangeType &&Range, ComparatorType Comp) -> decltype(AlgoImpl::MinElementBy(Range, FIdentityFunctor(), MoveTemp(Comp)))
 
template<typename RangeType , typename ProjectionType >
UE_REWRITE auto MinElementBy (RangeType &&Range, ProjectionType Proj) -> decltype(AlgoImpl::MinElementBy(Range, MoveTemp(Proj), TLess<>()))
 
template<typename RangeType , typename ProjectionType , typename ComparatorType >
UE_REWRITE auto MinElementBy (RangeType &&Range, ProjectionType Proj, ComparatorType Comp) -> decltype(AlgoImpl::MinElementBy(Range, MoveTemp(Proj), MoveTemp(Comp)))
 
template<typename InputAType , typename InputBType >
constexpr auto Mismatch (const InputAType &InputA, const InputBType &InputB) -> std::common_type_t< decltype(GetNum(InputA)), decltype(GetNum(InputB))>
 
template<typename InputAType , typename InputBType , typename PredicateType >
constexpr auto Mismatch (const InputAType &InputA, const InputBType &InputB, PredicateType Predicate) -> std::common_type_t< decltype(GetNum(InputA)), decltype(GetNum(InputB))>
 
template<typename InputAType , typename InputBType , typename ProjectionType >
constexpr auto MismatchBy (const InputAType &InputA, const InputBType &InputB, ProjectionType Projection) -> std::common_type_t< decltype(GetNum(InputA)), decltype(GetNum(InputB))>
 
template<typename InputAType , typename InputBType , typename ProjectionType , typename PredicateType >
constexpr auto MismatchBy (const InputAType &InputA, const InputBType &InputB, ProjectionType Projection, PredicateType Predicate) -> std::common_type_t< decltype(GetNum(InputA)), decltype(GetNum(InputB))>
 
template<typename RangeType >
bool NoneOf (const RangeType &Range)
 
template<typename RangeType , typename ProjectionType >
bool NoneOf (const RangeType &Range, ProjectionType Projection)
 
template<typename RangeType , typename ProjectionType >
bool NoneOf (const RangeType &Range, ProjectionType Projection, ENoRef NoRef)
 
template<class T , typename IndexType , typename UnaryPredicate >
IndexType Partition (T *Elements, const IndexType Num, UnaryPredicate Predicate)
 
template<typename RangeType , typename UnaryPredicateType >
UE_REWRITE auto Partition (RangeType &&Range, UnaryPredicateType Predicate) -> decltype(GetNum(Range))
 
template<typename RangeType >
void RandomShuffle (RangeType &&Range)
 
template<typename RangeType , typename Predicate >
int32 RemoveIf (RangeType &Range, Predicate Pred)
 
template<typename RangeType , typename Predicate >
int32 StableRemoveIf (RangeType &&Range, Predicate Pred)
 
template<typename RangeType , typename ValueType >
void Replace (RangeType &&Range, const ValueType &InOld, const ValueType &InNew)
 
template<typename RangeType , typename ValueType , typename PredicateType >
void ReplaceIf (RangeType &&Range, PredicateType InPred, const ValueType &InNew)
 
template<typename T , int32 ArraySize>
UE_REWRITE void Reverse (T(&Array)[ArraySize])
 
template<typename T >
UE_REWRITE void Reverse (T *Array, int32 ArraySize)
 
template<typename ContainerType >
UE_REWRITE void Reverse (ContainerType &&Container)
 
template<typename RangeType >
UE_REWRITE int32 Rotate (RangeType &&Range, int32 Count)
 
template<typename RangeType , typename ProjectionType >
UE_REWRITE auto SelectRandomWeightedBy (RangeType &&Range, ProjectionType Proj) -> decltype(AlgoImpl::SelectRandomWeightedBy(Forward< RangeType >(Range), MoveTemp(Proj)))
 
template<typename RangeType >
UE_REWRITE void Sort (RangeType &&Range)
 
template<typename RangeType , typename PredicateType >
UE_REWRITE void Sort (RangeType &&Range, PredicateType Pred)
 
template<typename RangeType , typename ProjectionType >
UE_REWRITE void SortBy (RangeType &&Range, ProjectionType Proj)
 
template<typename RangeType , typename ProjectionType , typename PredicateType >
UE_REWRITE void SortBy (RangeType &&Range, ProjectionType Proj, PredicateType Pred)
 
template<typename RangeType >
UE_REWRITE void StableSort (RangeType &&Range)
 
template<typename RangeType , typename PredicateType >
UE_REWRITE void StableSort (RangeType &&Range, PredicateType Pred)
 
template<typename RangeType , typename ProjectionType >
UE_REWRITE void StableSortBy (RangeType &&Range, ProjectionType Proj)
 
template<typename RangeType , typename ProjectionType , typename PredicateType >
UE_REWRITE void StableSortBy (RangeType &&Range, ProjectionType Proj, PredicateType Pred)
 
template<typename... OutputTypes>
Private::TTiedTupleAdder< OutputTypes... > TieTupleAdd (OutputTypes &... Outputs)
 
template<typename RangeType , typename GetElementDependenciesType >
UE_REWRITE bool TopologicalSort (RangeType &&UniqueRange, GetElementDependenciesType GetElementDependencies, ETopologicalSort Flags=ETopologicalSort::None)
 
template<typename InT , typename OutT , typename PredicateT , typename TransformT >
void TransformIf (const InT &Input, OutT &&Output, PredicateT Predicate, TransformT Trans)
 
template<typename InT , typename OutT , typename TransformT >
void Transform (const InT &Input, OutT &&Output, TransformT Trans)
 
template<typename InAT , typename InBT , typename LessThanType >
constexpr int CompareAsInt (InAT &&InputA, InBT &&InputB, LessThanType LessThan)
 
template<typename MapType , typename KeyLessThanType , typename ValueLessThanType >
int CompareMultiMap (const MapType &A, const MapType &B, KeyLessThanType KeyLessThan, ValueLessThanType ValueLessThan)
 

Enumeration Type Documentation

◆ ENoRef

A special enum indicating that reference should NOT be used when iterating a container.

Enumerator
NoRef 

◆ ETopologicalSort

Flags for behavior of TopologicalSort; see the function comment in TopologicalSort.h

Enumerator
None 
AllowCycles 

Function Documentation

◆ Accumulate() [1/2]

template<typename T , typename A >
UE_REWRITE T Algo::Accumulate ( const A Input,
Init 
)

Sums a range.

Parameters
InputAny iterable type
InitInitial value for the summation
Returns
the result of summing all the elements of Input

◆ Accumulate() [2/2]

template<typename T , typename A , typename OpT >
T Algo::Accumulate ( const A Input,
Init,
OpT  Op 
)

Sums a range by successively applying Op.

Parameters
InputAny iterable type
InitInitial value for the summation
OpSumming Operation (the default is TPlus<>)
Returns
the result of summing all the elements of Input

◆ AllOf() [1/2]

template<typename RangeType >
bool Algo::AllOf ( const RangeType &  Range)

Checks if every element in the range is truthy.

Parameters
RangeThe range to check.
Returns
true if all the elements are truthy, false otherwise.

◆ AllOf() [2/2]

template<typename RangeType , typename ProjectionType >
bool Algo::AllOf ( const RangeType &  Range,
ProjectionType  Projection 
)

Checks if every projection of the elements in the range is truthy.

Parameters
RangeThe range to check.
ProjectionThe projection to apply to each element.
Returns
true if all the projections are truthy, false otherwise.

◆ AnyOf() [1/3]

template<typename RangeType >
UE_REWRITE bool Algo::AnyOf ( const RangeType &  Range)

Checks if any element in the range is truthy.

Parameters
RangeThe range to check.
Returns
true if at least one element is truthy, false otherwise.

◆ AnyOf() [2/3]

template<typename RangeType , typename ProjectionType >
UE_REWRITE bool Algo::AnyOf ( const RangeType &  Range,
ProjectionType  Projection 
)

Checks if any projection of the elements in the range is truthy.

Parameters
RangeThe range to check.
ProjectionThe projection to apply to each element.
Returns
true if at least one projection is truthy, false otherwise.

◆ AnyOf() [3/3]

template<typename RangeType , typename ProjectionType >
UE_REWRITE bool Algo::AnyOf ( const RangeType &  Range,
ProjectionType  Projection,
ENoRef  NoRef 
)

Checks if any projection of the elements in the range is truthy. Should be used when the range iterator doesn't return a reference.

Parameters
RangeThe range to check.
ProjectionThe projection to apply to each element.
Returns
true if at least one projection is truthy, false otherwise.

◆ BinarySearch() [1/2]

template<typename RangeType , typename ValueType >
UE_REWRITE auto Algo::BinarySearch ( const RangeType &  Range,
const ValueType &  Value 
)

◆ BinarySearch() [2/2]

template<typename RangeType , typename ValueType , typename SortPredicateType >
auto Algo::BinarySearch ( const RangeType &  Range,
const ValueType &  Value,
SortPredicateType  SortPredicate 
) -> decltype(GetNum(Range))

Returns index to the first found element matching a value in a range, the range must be sorted by <

Parameters
RangeThe range to search, must be already sorted by SortPredicate
ValueThe value to search for
SortPredicatePredicate for sort comparison, defaults to <
Returns
Index of found element, or INDEX_NONE

◆ BinarySearchBy() [1/2]

template<typename RangeType , typename ValueType , typename ProjectionType >
UE_REWRITE auto Algo::BinarySearchBy ( const RangeType &  Range,
const ValueType &  Value,
ProjectionType  Projection 
)

◆ BinarySearchBy() [2/2]

template<typename RangeType , typename ValueType , typename ProjectionType , typename SortPredicateType >
auto Algo::BinarySearchBy ( const RangeType &  Range,
const ValueType &  Value,
ProjectionType  Projection,
SortPredicateType  SortPredicate 
) -> decltype(GetNum(Range))

Returns index to the first found element with projected value matching Value in a range, the range must be sorted by predicate

Parameters
RangeThe range to search, must be already sorted by SortPredicate
ValueThe value to search for
ProjectionFunctor or data member pointer, called via Invoke to compare to Value
SortPredicatePredicate for sort comparison, defaults to <
Returns
Index of found element, or INDEX_NONE

◆ Compare() [1/2]

template<typename InAT , typename InBT >
constexpr bool Algo::Compare ( const InAT InputA,
const InBT InputB 
)
constexpr

Compares two contiguous containers using operator== to compare pairs of elements.

Parameters
InputAContainer of elements that are used as the first argument to operator==.
InputBContainer of elements that are used as the second argument to operator==.
Returns
Whether the containers are the same size and operator== returned true for every pair of elements.

◆ Compare() [2/2]

constexpr bool Algo::Compare ( const InAT InputA,
const InBT InputB,
PredicateT  Predicate 
)
constexpr

Compares two contiguous containers using a predicate to compare pairs of elements.

Parameters
InputAContainer of elements that are used as the first argument to the predicate.
InputBContainer of elements that are used as the second argument to the predicate.
PredicateCondition which returns true for elements which are deemed equal.
Returns
Whether the containers are the same size and the predicate returned true for every pair of elements.

◆ CompareAsInt()

constexpr int Algo::CompareAsInt ( InAT &&  InputA,
InBT &&  InputB,
LessThanType  LessThan 
)
constexpr

◆ CompareBy() [1/2]

constexpr bool Algo::CompareBy ( const InAT InputA,
const InBT InputB,
ProjectionT  Projection 
)
constexpr

Compares two contiguous containers using operator== to compare pairs of projected elements.

Parameters
InputAContainer of elements that are used as the first argument to operator==.
InputBContainer of elements that are used as the second argument to operator==.
ProjectionProjection to apply to the elements before comparing them.
Returns
Whether the containers are the same size and operator== returned true for every pair of elements.

◆ CompareBy() [2/2]

constexpr bool Algo::CompareBy ( const InAT InputA,
const InBT InputB,
ProjectionT  Projection,
PredicateT  Predicate 
)
constexpr

Compares two contiguous containers using a predicate to compare pairs of projected elements.

Parameters
InputAContainer of elements that are used as the first argument to the predicate.
InputBContainer of elements that are used as the second argument to the predicate.
ProjectionProjection to apply to the elements before comparing them.
PredicateCondition which returns true for elements which are deemed equal.
Returns
Whether the containers are the same size and the predicate returned true for every pair of elements.

◆ CompareMap() [1/3]

template<typename MapType >
int Algo::CompareMap ( const MapType &  A,
const MapType &  B 
)

◆ CompareMap() [2/3]

template<typename MapType , typename KeyLessThanType >
int Algo::CompareMap ( const MapType &  A,
const MapType &  B,
KeyLessThanType  KeyLessThan 
)

◆ CompareMap() [3/3]

int Algo::CompareMap ( const MapType &  A,
const MapType &  B,
KeyLessThanType  KeyLessThan,
ValueLessThanType  ValueLessThan 
)

Compares two unique-key maps (e.g. TMap) as if they were sorted arrays of key,value pairs sorted by Key and then by Value (almost, see note on sort order). Does not support multiple values per key (e.g. TMultiMap).

Note on sort order: Maps with a smaller number of elements are considered less than maps with a larger number of elements, no matter what keys are present in each map. This drastically improves performance when comparing maps of different sizes. This is different than would be exepcted from a lexical compare of strings, but it does match the comparison of two numbers represented as a string of digits.

MapType interface: typename KeyType, typename ValueType, IntType Num(), ValueType* Find(const KeyType&), IteratorType<PairType> begin(), end() PairType interface: const KeyType& Key, const ValueType& Value

Parameters
ALeft-Hand-Side map container.
BRight-Hand-Side map container.
KeyLessThanbool(const KeyType& A, const KeyType& B) that returns A < B.
ValueLessThanbool(const ValueType& A, const ValueType& B) that returns A < B.
Returns
-1 if A < B, 0 if A == B, 1 if A > B

◆ CompareMultiMap()

int Algo::CompareMultiMap ( const MapType &  A,
const MapType &  B,
KeyLessThanType  KeyLessThan,
ValueLessThanType  ValueLessThan 
)

◆ CompareSet() [1/2]

template<typename SetType >
int Algo::CompareSet ( const SetType &  A,
const SetType &  B 
)

◆ CompareSet() [2/2]

template<typename SetType , typename KeyLessThanType >
int Algo::CompareSet ( const SetType &  A,
const SetType &  B,
KeyLessThanType  KeyLessThan 
)

Compares two sets (e.g. TSet) as if they were sorted arrays of keys (almost, see note on sort order).

Note on sort order: Maps with a smaller number of elements are considered less than maps with a larger number of elements, no matter what keys are present in each map. This drastically improves performance when comparing maps of different sizes. This is different than would be exepcted from a lexical compare of strings, but it does match the comparison of two numbers represented as a string of digits.

SetType interface: typename ElementType IntType Num(), bool Contains(const KeyType&), IteratorType<KeyType> begin(), end()

Parameters
ALeft-Hand-Side set container.
BRight-Hand-Side set container.
KeyLessThanbool(const KeyType& A, const KeyType& B) that returns A < B.
Returns
-1 if A < B, 0 if A == B, 1 if A > B

◆ Contains()

template<typename RangeType , typename ValueType >
UE_REWRITE constexpr bool Algo::Contains ( RangeType &&  Range,
const ValueType &  Value 
)
constexpr

Checks if the value exists in the range.

Parameters
RangeThe range to search.
ValueThe value to search for.
Returns
true if an element was found, false otherwise.

◆ ContainsBy()

template<typename RangeType , typename ValueType , typename ProjectionType >
UE_REWRITE constexpr bool Algo::ContainsBy ( RangeType &&  Range,
const ValueType &  Value,
ProjectionType  Proj 
)
constexpr

Checks if the value exists in the range given by the projection.

Parameters
RangeThe range to search.
ValueThe value to search for.
ProjThe projection to apply to the element.
Returns
true if an element was found, false otherwise.

◆ Copy() [1/2]

template<typename InT , typename OutT >
void Algo::Copy ( const InT Input,
OutT Output 
)

Copies a range into a container

Parameters
InputAny iterable type
OutputContainer to hold the output

◆ Copy() [2/2]

template<typename InT , typename OutT >
void Algo::Copy ( const InT Input,
OutT Output,
ENoRef  NoRef 
)

Copies a range into a container. Should be used if when the input iterator doesn't return a reference.

Parameters
InputAny iterable type
OutputContainer to hold the output

◆ CopyIf()

void Algo::CopyIf ( const InT Input,
OutT Output,
PredicateT  Predicate 
)

Conditionally copies a range into a container

Parameters
InputAny iterable type
OutputContainer to hold the output
PredicateCondition which returns true for elements that should be copied and false for elements that should be skipped

◆ Count()

template<typename InT , typename ValueT >
SIZE_T Algo::Count ( const InT Input,
const ValueT InValue 
)

Counts elements of a range that equal the supplied value

Parameters
InputAny iterable type
InValueValue to compare against

◆ CountBy()

SIZE_T Algo::CountBy ( const InT Input,
const ValueT InValue,
ProjectionT  Proj 
)

Counts elements of a range whose projection equals the supplied value

Parameters
InputAny iterable type
InValueValue to compare against
ProjectionThe projection to apply to the element

◆ CountIf()

SIZE_T Algo::CountIf ( const InT Input,
PredicateT  Predicate 
)

Counts elements of a range that match a given predicate

Parameters
InputAny iterable type
PredicateCondition which returns true for elements that should be counted and false for elements that should be skipped

◆ ENUM_CLASS_FLAGS()

Algo::ENUM_CLASS_FLAGS ( ETopologicalSort  )

◆ Find()

template<typename RangeType , typename ValueType >
UE_REWRITE constexpr auto Algo::Find ( RangeType &&  Range,
const ValueType &  Value 
) -> decltype(AlgoImpl::FindBy(Forward<RangeType>(Range), Value, FIdentityFunctor()))
constexpr

Returns a pointer to the first element in the range which is equal to the given value.

Parameters
RangeThe range to search.
ValueThe value to search for.
Returns
A pointer to the first element found, or nullptr if none was found.

◆ FindBy()

template<typename RangeType , typename ValueType , typename ProjectionType >
UE_REWRITE constexpr auto Algo::FindBy ( RangeType &&  Range,
const ValueType &  Value,
ProjectionType  Proj 
) -> decltype(AlgoImpl::FindBy(Forward<RangeType>(Range), Value, MoveTemp(Proj)))
constexpr

Returns a pointer to the first element in the range whose projection is equal to the given value.

Parameters
RangeThe range to search.
ValueThe value to search for.
ProjThe projection to apply to the element.
Returns
A pointer to the first element found, or nullptr if none was found.

◆ FindByPredicate()

template<typename RangeType , typename PredicateType >
UE_REWRITE constexpr auto Algo::FindByPredicate ( RangeType &&  Range,
PredicateType  Pred 
) -> decltype(AlgoImpl::FindByPredicate(Forward<RangeType>(Range), MoveTemp(Pred)))
constexpr

Returns a pointer to the first element in the range which matches the predicate.

Parameters
RangeThe range to search.
PredThe predicate to search for.
Returns
A pointer to the first element found, or nullptr if none was found.

◆ FindLast()

template<typename RangeType , typename ValueType >
UE_REWRITE auto Algo::FindLast ( RangeType &&  Range,
const ValueType &  Value 
) -> decltype(AlgoImpl::FindLastBy(GetData(Range), GetNum(Range), Value, FIdentityFunctor()))

Returns a pointer to the last element in the range which is equal to the given value.

Parameters
RangeThe range to search.
ValueThe value to search for.
Returns
A pointer to the last element found, or nullptr if none was found.

◆ FindLastBy()

template<typename RangeType , typename ValueType , typename ProjectionType >
UE_REWRITE auto Algo::FindLastBy ( RangeType &&  Range,
const ValueType &  Value,
ProjectionType  Proj 
) -> decltype(AlgoImpl::FindLastBy(GetData(Range), GetNum(Range), Value, MoveTemp(Proj)))

Returns a pointer to the last element in the range whose projection is equal to the given value.

Parameters
RangeThe range to search.
ValueThe value to search for.
ProjThe projection to apply to the element.
Returns
A pointer to the last element found, or nullptr if none was found.

◆ FindLastByPredicate()

template<typename RangeType , typename PredicateType >
UE_REWRITE auto Algo::FindLastByPredicate ( RangeType &&  Range,
PredicateType  Pred 
) -> decltype(AlgoImpl::FindLastByPredicate(GetData(Range), GetNum(Range), MoveTemp(Pred)))

Returns a pointer to the last element in the range which matches the predicate.

Parameters
RangeThe range to search.
PredThe predicate to search for.
Returns
A pointer to the last element found, or nullptr if none was found.

◆ FindSequence()

auto Algo::FindSequence ( const RangeWhereType Where,
const RangeWhatType What 
) -> decltype( AlgoImpl::FindSequence( GetData(Where), GetData(Where) + GetNum(Where), GetData(What), GetData(What) + GetNum(What)) )

◆ FindSortedStringCaseInsensitive() [1/2]

template<int32 ArraySize>
UE_REWRITE int32 Algo::FindSortedStringCaseInsensitive ( const TCHAR Str,
const TCHAR *const (&)  SortedArray[ArraySize] 
)

Finds a string in an array of sorted strings, by case-insensitive search, by using binary subdivision of the array.

Parameters
StrThe string to look for.
SortedArrayThe array of strings to search. The strings must be sorted lexicographically, case-insensitively.
Returns
The index of the found string in the array, or -1 if the string was not found.

◆ FindSortedStringCaseInsensitive() [2/2]

CORE_API int32 Algo::FindSortedStringCaseInsensitive ( const TCHAR Str,
const TCHAR *const *  SortedArray,
int32  ArrayCount 
)

Finds a string in an array of sorted strings, by case-insensitive search, by using binary subdivision of the array.

Parameters
StrThe string to look for.
SortedArrayThe array of strings to search. The strings must be sorted lexicographically, case-insensitively.
ArrayCountThe number of strings in the array.
Returns
The index of the found string in the array, or -1 if the string was not found.

◆ ForEach()

void Algo::ForEach ( InT &&  Input,
CallableT  Callable 
)

Invokes a callable to each element in a range

Parameters
InputAny iterable type
CallableCallable object

◆ ForEachIf()

void Algo::ForEachIf ( InT &&  Input,
PredicateT  Predicate,
CallableT  Callable 
)

Conditionally invokes a callable to each element in a range

Parameters
InputAny iterable type
PredicateCondition which returns true for elements that should be called with and false for elements that should be skipped
CallableCallable object

◆ Heapify() [1/2]

template<typename RangeType >
UE_REWRITE void Algo::Heapify ( RangeType &&  Range)

Builds an implicit min-heap from a range of elements. Assumes < operator is defined for the element type.

Parameters
RangeThe range to heapify.

◆ Heapify() [2/2]

template<typename RangeType , typename PredicateType >
UE_REWRITE void Algo::Heapify ( RangeType &&  Range,
PredicateType  Predicate 
)

Builds an implicit min-heap from a range of elements.

Parameters
RangeThe range to heapify.
PredicateA binary predicate object used to specify if one element should precede another.

◆ HeapifyBy() [1/2]

UE_REWRITE void Algo::HeapifyBy ( RangeType &&  Range,
ProjectionType  Projection 
)

Builds an implicit min-heap from a range of elements. Assumes < operator is defined for the projected element type.

Parameters
RangeThe range to heapify.
ProjectionThe projection to apply to the elements.

◆ HeapifyBy() [2/2]

UE_REWRITE void Algo::HeapifyBy ( RangeType &&  Range,
ProjectionType  Projection,
PredicateType  Predicate 
)

Builds an implicit min-heap from a range of elements.

Parameters
RangeThe range to heapify.
ProjectionThe projection to apply to the elements.
PredicateA binary predicate object used to specify if one element should precede another.

◆ HeapSort() [1/2]

template<typename RangeType >
UE_REWRITE void Algo::HeapSort ( RangeType &&  Range)

Performs heap sort on the elements. Assumes < operator is defined for the element type.

Parameters
RangeThe range to sort.

◆ HeapSort() [2/2]

template<typename RangeType , typename PredicateType >
UE_REWRITE void Algo::HeapSort ( RangeType &&  Range,
PredicateType  Predicate 
)

Performs heap sort on the elements.

Parameters
RangeThe range to sort.
PredicateA binary predicate object used to specify if one element should precede another.

◆ HeapSortBy() [1/2]

template<typename RangeType , typename ProjectionType >
UE_REWRITE void Algo::HeapSortBy ( RangeType &&  Range,
ProjectionType  Projection 
)

Performs heap sort on the elements. Assumes < operator is defined for the projected element type.

Parameters
RangeThe range to sort.
ProjectionThe projection to sort by when applied to the element.

◆ HeapSortBy() [2/2]

UE_REWRITE void Algo::HeapSortBy ( RangeType &&  Range,
ProjectionType  Projection,
PredicateType  Predicate 
)

Performs heap sort on the elements.

Parameters
RangeThe range to sort.
ProjectionThe projection to sort by when applied to the element.
PredicateA binary predicate object, applied to the projection, used to specify if one element should precede another.

◆ Includes() [1/2]

constexpr bool Algo::Includes ( const RangeTypeA RangeA,
const RangeTypeB RangeB 
)
constexpr

Checks if one sorted contiguous container is a subsequence of another sorted contiguous container by comparing pairs of elements. The subsequence does not need to be contiguous. Uses operator< to compare pairs of elements.

Parameters
RangeAContainer of elements to search through. Must be already sorted by operator<.
RangeBContainer of elements to search for. Must be already sorted by operator<.
Returns
True if RangeB is a subsequence of RangeA, false otherwise.

◆ Includes() [2/2]

constexpr bool Algo::Includes ( const RangeTypeA RangeA,
const RangeTypeB RangeB,
SortPredicateType  SortPredicate 
)
constexpr

Checks if one sorted contiguous container is a subsequence of another sorted contiguous container by comparing pairs of elements using a custom predicate. The subsequence does not need to be contiguous.

Parameters
RangeAContainer of elements to search through. Must be already sorted by SortPredicate.
RangeBContainer of elements to search for. Must be already sorted by SortPredicate.
SortPredicateA binary predicate object used to specify if one element should precede another.
Returns
True if RangeB is a subsequence of RangeA according to the provided predicate, false otherwise.

◆ IncludesBy() [1/2]

constexpr bool Algo::IncludesBy ( const RangeTypeA RangeA,
const RangeTypeB RangeB,
ProjectionType  Projection 
)
constexpr

Checks if one sorted contiguous container is a subsequence of another sorted contiguous container by comparing pairs of projected elements. The subsequence does not need to be contiguous. Uses operator< to compare pairs of projected elements.

Parameters
RangeAContainer of elements to search through. Must be already sorted by operator<.
RangeBContainer of elements to search for. Must be already sorted by operator<.
ProjectionProjection to apply to the elements before comparing them.
Returns
True if RangeB is a subsequence of RangeA, based on the comparison of projected elements, false otherwise.

◆ IncludesBy() [2/2]

constexpr bool Algo::IncludesBy ( const RangeTypeA RangeA,
const RangeTypeB RangeB,
ProjectionType  Projection,
SortPredicateType  SortPredicate 
)
constexpr

Checks if one sorted contiguous container is a subsequence of another sorted contiguous container by comparing pairs of projected elements using a custom predicate. The subsequence does not need to be contiguous.

Parameters
RangeAContainer of elements to search through. Must be already sorted by SortPredicate.
RangeBContainer of elements to search for. Must be already sorted by SortPredicate.
ProjectionProjection to apply to the elements before comparing them.
SortPredicateA binary predicate object, applied to the projection, used to specify if one element should precede another.
Returns
True if RangeB is a subsequence of RangeA according to the comparison of projected elements using the provided predicate, false otherwise.

◆ IndexOf()

template<typename RangeType , typename ValueType >
UE_REWRITE auto Algo::IndexOf ( const RangeType &  Range,
const ValueType &  Value 
)

Returns the index of the first element in the range which is equal to the given value.

Parameters
RangeThe range to search.
ValueThe value to search for.
Returns
The index of the first element found, or (SizeType)-1 if none was found (where SizeType = decltype(GetNum(Range)))

◆ IndexOfBy()

template<typename RangeType , typename ValueType , typename ProjectionType >
UE_REWRITE auto Algo::IndexOfBy ( const RangeType &  Range,
const ValueType &  Value,
ProjectionType  Proj 
)

Returns the index of the first element in the range whose projection is equal to the given value.

Parameters
RangeThe range to search.
ValueThe value to search for.
ProjThe projection to apply to the element.
Returns
The index of the first element found, or (SizeType)-1 if none was found (where SizeType = decltype(GetNum(Range)))

◆ IndexOfByPredicate()

template<typename RangeType , typename PredicateType >
UE_REWRITE auto Algo::IndexOfByPredicate ( const RangeType &  Range,
PredicateType  Pred 
)

Returns the index of the first element in the range which matches the predicate.

Parameters
RangeThe range to search.
PredThe predicate to search for.
Returns
The index of the first element found, or (SizeType)-1 if none was found (where SizeType = decltype(GetNum(Range)))

◆ IntroSort() [1/2]

template<typename RangeType >
UE_REWRITE void Algo::IntroSort ( RangeType &&  Range)

Sort a range of elements using its operator<. The sort is unstable.

Parameters
RangeThe range to sort.

◆ IntroSort() [2/2]

template<typename RangeType , typename PredicateType >
UE_REWRITE void Algo::IntroSort ( RangeType &&  Range,
PredicateType  Predicate 
)

Sort a range of elements using a user-defined predicate class. The sort is unstable.

Parameters
RangeThe range to sort.
PredicateA binary predicate object used to specify if one element should precede another.

◆ IntroSortBy() [1/2]

template<typename RangeType , typename ProjectionType >
UE_REWRITE void Algo::IntroSortBy ( RangeType &&  Range,
ProjectionType  Proj 
)

Sort a range of elements by a projection using the projection's operator<. The sort is unstable.

Parameters
RangeThe range to sort.
ProjThe projection to sort by when applied to the element.

◆ IntroSortBy() [2/2]

UE_REWRITE void Algo::IntroSortBy ( RangeType &&  Range,
ProjectionType  Proj,
PredicateType  Predicate 
)

Sort a range of elements by a projection using a user-defined predicate class. The sort is unstable.

Parameters
RangeThe range to sort.
ProjThe projection to sort by when applied to the element.
PredicateA binary predicate object, applied to the projection, used to specify if one element should precede another.

◆ IsHeap() [1/2]

template<typename RangeType >
UE_REWRITE bool Algo::IsHeap ( const RangeType &  Range)

Verifies that the range is a min-heap (parent <= child). Assumes < operator is defined for the element type.

Parameters
RangeThe range to verify.
Returns
returns true if the range is a min-heap

◆ IsHeap() [2/2]

template<typename RangeType , typename PredicateType >
UE_REWRITE bool Algo::IsHeap ( const RangeType &  Range,
PredicateType  Predicate 
)

Verifies that the range is a min-heap (parent <= child)

Parameters
RangeThe range to verify.
PredicateA binary predicate object used to specify if one element should precede another.
Returns
returns true if the range is a min-heap

◆ IsHeapBy() [1/2]

template<typename RangeType , typename ProjectionType >
UE_REWRITE bool Algo::IsHeapBy ( const RangeType &  Range,
ProjectionType  Projection 
)

Verifies that the range is a min-heap (parent <= child). Assumes < operator is defined for the projected element type.

Parameters
RangeThe range to verify.
ProjectionThe projection to apply to the elements.
Returns
returns true if the range is a min-heap

◆ IsHeapBy() [2/2]

UE_REWRITE bool Algo::IsHeapBy ( const RangeType &  Range,
ProjectionType  Projection,
PredicateType  Predicate 
)

Verifies that the range is a min-heap (parent <= child)

Parameters
RangeThe range to verify.
ProjectionThe projection to apply to the elements.
PredicateA binary predicate object used to specify if one element should precede another.
Returns
returns true if the range is a min-heap

◆ IsSorted() [1/2]

template<typename RangeType >
UE_REWRITE bool Algo::IsSorted ( const RangeType &  Range)

Tests if a range is sorted by its element type's operator<.

Parameters
RangeThe container to test for being sorted.
Returns
true if the range is sorted, false otherwise.

◆ IsSorted() [2/2]

template<typename RangeType , typename PredType >
UE_REWRITE bool Algo::IsSorted ( const RangeType &  Range,
PredType  Pred 
)

Tests if a range is sorted by a user-defined predicate.

Parameters
RangeThe container to test for being sorted.
PredA binary sorting predicate which describes the ordering of the elements in the array.
Returns
true if the range is sorted, false otherwise.

◆ IsSortedBy() [1/2]

template<typename RangeType , typename ProjectionType >
UE_REWRITE bool Algo::IsSortedBy ( const RangeType &  Range,
ProjectionType  Projection 
)

Tests if a range is sorted by a projection of the element type, using the projection's operator<.

Parameters
RangeThe container to test for being sorted.
Returns
true if the range is sorted, false otherwise.

◆ IsSortedBy() [2/2]

template<typename RangeType , typename ProjectionType , typename PredType >
UE_REWRITE bool Algo::IsSortedBy ( const RangeType &  Range,
ProjectionType  Projection,
PredType  Pred 
)

Tests if a range is sorted by a projection of the element type, using a user-defined predicate on the projection.

Parameters
RangeThe container to test for being sorted.
PredA binary sorting predicate which describes the ordering of the elements in the array.
Returns
true if the range is sorted, false otherwise.

◆ KahnTopologicalSort()

bool Algo::KahnTopologicalSort ( RangeType &&  UniqueRange,
GetElementDependenciesType  GetElementDependencies,
ETopologicalSort  Flags 
)

Public entrypoint. Implements Algo::TopologicalSort using the Kahn Topological Sort algorithm.

◆ LegacySort() [1/2]

template<typename RangeType >
UE_REWRITE void Algo::LegacySort ( RangeType &&  Range)

Sort a range of elements using its operator<. The sort is unstable. This used to be Algo::Sort and is now considered legacy.

Parameters
RangeThe range to sort.

◆ LegacySort() [2/2]

template<typename RangeType , typename PredicateType >
UE_REWRITE void Algo::LegacySort ( RangeType &&  Range,
PredicateType  Pred 
)

Sort a range of elements using a user-defined predicate class. The sort is unstable. This used to be Algo::Sort and is now considered legacy.

Parameters
RangeThe range to sort.
PredicateA binary predicate object used to specify if one element should precede another.

◆ LegacySortBy() [1/2]

template<typename RangeType , typename ProjectionType >
UE_REWRITE void Algo::LegacySortBy ( RangeType &&  Range,
ProjectionType  Proj 
)

Sort a range of elements by a projection using the projection's operator<. The sort is unstable. This used to be Algo::Sort and is now considered legacy.

Parameters
RangeThe range to sort.
ProjThe projection to sort by when applied to the element.

◆ LegacySortBy() [2/2]

UE_REWRITE void Algo::LegacySortBy ( RangeType &&  Range,
ProjectionType  Proj,
PredicateType  Pred 
)

Sort a range of elements by a projection using a user-defined predicate class. The sort is unstable. This used to be Algo::Sort and is now considered legacy.

Parameters
RangeThe range to sort.
ProjThe projection to sort by when applied to the element.
PredicateA binary predicate object, applied to the projection, used to specify if one element should precede another.

◆ LevenshteinDistance()

int32 Algo::LevenshteinDistance ( const RangeAType RangeA,
const RangeBType RangeB 
)

LevenshteinDistance return the number of edit operation we need to transform RangeA to RangeB. Operation type are Add/Remove/substitution of range element. Base on Levenshtein algorithm.

Range[A/B]Type: Support [] operator and the range element must be able to be compare with == operator Support GetNum() functionality

Parameters
RangeAThe first range of element
RangeBThe second range of element
Returns
The number of operation to transform RangeA to RangeB

◆ LowerBound() [1/2]

template<typename RangeType , typename ValueType >
UE_REWRITE auto Algo::LowerBound ( const RangeType &  Range,
const ValueType &  Value 
) -> decltype(GetNum(Range))

◆ LowerBound() [2/2]

template<typename RangeType , typename ValueType , typename SortPredicateType >
UE_REWRITE auto Algo::LowerBound ( const RangeType &  Range,
const ValueType &  Value,
SortPredicateType  SortPredicate 
) -> decltype(GetNum(Range))

Performs binary search, resulting in position of the first element >= Value using predicate

Parameters
RangeRange to search through, must be already sorted by SortPredicate
ValueValue to look for
SortPredicatePredicate for sort comparison, defaults to <
Returns
Position of the first element >= Value, may be position after last element in range

◆ LowerBoundBy() [1/2]

template<typename RangeType , typename ValueType , typename ProjectionType >
UE_REWRITE auto Algo::LowerBoundBy ( const RangeType &  Range,
const ValueType &  Value,
ProjectionType  Projection 
) -> decltype(GetNum(Range))

◆ LowerBoundBy() [2/2]

template<typename RangeType , typename ValueType , typename ProjectionType , typename SortPredicateType >
UE_REWRITE auto Algo::LowerBoundBy ( const RangeType &  Range,
const ValueType &  Value,
ProjectionType  Projection,
SortPredicateType  SortPredicate 
) -> decltype(GetNum(Range))

Performs binary search, resulting in position of the first element with projected value >= Value using predicate

Parameters
RangeRange to search through, must be already sorted by SortPredicate
ValueValue to look for
ProjectionFunctor or data member pointer, called via Invoke to compare to Value
SortPredicatePredicate for sort comparison, defaults to <
Returns
Position of the first element >= Value, may be position after last element in range

◆ MaxElement() [1/2]

template<typename RangeType >
UE_REWRITE constexpr auto Algo::MaxElement ( RangeType &&  Range) -> decltype(AlgoImpl::MaxElementBy(Range, FIdentityFunctor(), TLess<>()))
constexpr

Returns a pointer to the maximum element in a range. If the range contains multiple maximum elements, a pointer to the first one will be returned.

Parameters
RangeThe range to find the maximum element in.
Returns
A pointer to the maximum element, or nullptr if the range was empty.

◆ MaxElement() [2/2]

template<typename RangeType , typename ComparatorType >
UE_REWRITE auto Algo::MaxElement ( RangeType &&  Range,
ComparatorType  Comp 
) -> decltype(AlgoImpl::MaxElementBy(Range, FIdentityFunctor(), MoveTemp(Comp)))

Returns a pointer to the maximum element in a range with a user-defined binary comparator. If the range contains multiple maximum elements, a pointer to the first one will be returned.

Parameters
RangeThe range to find the maximum element in.
CompThe comparator to use when comparing two elements.
Returns
A pointer to the maximum element, or nullptr if the range was empty.

◆ MaxElementBy() [1/2]

template<typename RangeType , typename ProjectionType >
UE_REWRITE auto Algo::MaxElementBy ( RangeType &&  Range,
ProjectionType  Proj 
) -> decltype(AlgoImpl::MaxElementBy(Range, MoveTemp(Proj), TLess<>()))

Returns a pointer to the maximum element in a range with a user-defined binary comparator. If the range contains multiple maximum elements, a pointer to the first one will be returned.

Parameters
RangeThe range to find the maximum element in.
ProjThe projection to apply to the element to use for comparison.
Returns
A pointer to the maximum element, or nullptr if the range was empty.

◆ MaxElementBy() [2/2]

UE_REWRITE auto Algo::MaxElementBy ( RangeType &&  Range,
ProjectionType  Proj,
ComparatorType  Comp 
) -> decltype(AlgoImpl::MaxElementBy(Range, MoveTemp(Proj), MoveTemp(Comp)))

Returns a pointer to the maximum element in a range with a user-defined binary comparator. If the range contains multiple maximum elements, a pointer to the first one will be returned.

Parameters
RangeThe range to find the maximum element in.
ProjThe projection to apply to the element to use for comparison.
CompThe comparator to use when comparing two elements.
Returns
A pointer to the maximum element, or nullptr if the range was empty.

◆ MinElement() [1/2]

template<typename RangeType >
UE_REWRITE auto Algo::MinElement ( RangeType &&  Range) -> decltype(AlgoImpl::MinElementBy(Range, FIdentityFunctor(), TLess<>()))

Returns a pointer to the minimum element in a range. If the range contains multiple minimum elements, a pointer to the first one will be returned.

Parameters
RangeThe range to find the minimum element in.
Returns
A pointer to the minimum element, or nullptr if the range was empty.

◆ MinElement() [2/2]

template<typename RangeType , typename ComparatorType >
UE_REWRITE auto Algo::MinElement ( RangeType &&  Range,
ComparatorType  Comp 
) -> decltype(AlgoImpl::MinElementBy(Range, FIdentityFunctor(), MoveTemp(Comp)))

Returns a pointer to the minimum element in a range with a user-defined binary comparator. If the range contains multiple minimum elements, a pointer to the first one will be returned.

Parameters
RangeThe range to find the minimum element in.
CompThe comparator to use when comparing two elements.
Returns
A pointer to the minimum element, or nullptr if the range was empty.

◆ MinElementBy() [1/2]

template<typename RangeType , typename ProjectionType >
UE_REWRITE auto Algo::MinElementBy ( RangeType &&  Range,
ProjectionType  Proj 
) -> decltype(AlgoImpl::MinElementBy(Range, MoveTemp(Proj), TLess<>()))

Returns a pointer to the minimum element in a range with a user-defined binary comparator. If the range contains multiple minimum elements, a pointer to the first one will be returned.

Parameters
RangeThe range to find the minimum element in.
ProjThe projection to apply to the element to use for comparison.
Returns
A pointer to the minimum element, or nullptr if the range was empty.

◆ MinElementBy() [2/2]

UE_REWRITE auto Algo::MinElementBy ( RangeType &&  Range,
ProjectionType  Proj,
ComparatorType  Comp 
) -> decltype(AlgoImpl::MinElementBy(Range, MoveTemp(Proj), MoveTemp(Comp)))

Returns a pointer to the minimum element in a range with a user-defined binary comparator. If the range contains multiple minimum elements, a pointer to the first one will be returned.

Parameters
RangeThe range to find the minimum element in.
ProjThe projection to apply to the element to use for comparison.
CompThe comparator to use when comparing two elements.
Returns
A pointer to the minimum element, or nullptr if the range was empty.

◆ Mismatch() [1/2]

constexpr auto Algo::Mismatch ( const InputAType InputA,
const InputBType InputB 
) -> std::common_type_t<decltype(GetNum(InputA)), decltype(GetNum(InputB))>
constexpr

Returns the index at which two contiguous containers differ, using operator== to compare pairs of elements.

Parameters
InputAContainer of elements that are used as the first argument to operator==.
InputBContainer of elements that are used as the second argument to operator==.
Returns
The index at which the containers differ.

◆ Mismatch() [2/2]

constexpr auto Algo::Mismatch ( const InputAType InputA,
const InputBType InputB,
PredicateType  Predicate 
) -> std::common_type_t<decltype(GetNum(InputA)), decltype(GetNum(InputB))>
constexpr

Returns the index at which two contiguous containers differ, using operator== to compare pairs of elements.

Parameters
InputAContainer of elements that are used as the first argument to operator==.
InputBContainer of elements that are used as the second argument to operator==.
PredicateCondition which returns true for elements which are deemed equal.
Returns
The index at which the containers differ.

◆ MismatchBy() [1/2]

constexpr auto Algo::MismatchBy ( const InputAType InputA,
const InputBType InputB,
ProjectionType  Projection 
) -> std::common_type_t<decltype(GetNum(InputA)), decltype(GetNum(InputB))>
constexpr

Returns the index at which two contiguous containers differ, using operator== to compare pairs of projected elements.

Parameters
InputAContainer of elements that are used as the first argument to operator==.
InputBContainer of elements that are used as the second argument to operator==.
ProjectionProjection to apply to the elements before comparing them.
Returns
The index at which the containers differ.

◆ MismatchBy() [2/2]

constexpr auto Algo::MismatchBy ( const InputAType InputA,
const InputBType InputB,
ProjectionType  Projection,
PredicateType  Predicate 
) -> std::common_type_t<decltype(GetNum(InputA)), decltype(GetNum(InputB))>
constexpr

Returns the index at which two contiguous containers differ, using a predicate to compare pairs of projected elements.

Parameters
InputAContainer of elements that are used as the first argument to the predicate.
InputBContainer of elements that are used as the second argument to the predicate.
ProjectionProjection to apply to the elements before comparing them.
PredicateCondition which returns true for elements which are deemed equal.
Returns
The index at which the containers differ.

◆ NoneOf() [1/3]

template<typename RangeType >
bool Algo::NoneOf ( const RangeType &  Range)

Checks if no element in the range is truthy.

Parameters
RangeThe range to check.
Returns
true if no element is truthy, false otherwise.

◆ NoneOf() [2/3]

template<typename RangeType , typename ProjectionType >
bool Algo::NoneOf ( const RangeType &  Range,
ProjectionType  Projection 
)

Checks if no projection of the elements in the range is truthy.

Parameters
RangeThe range to check.
ProjectionThe projection to apply to each element.
Returns
true if none of the projections are truthy, false otherwise.

◆ NoneOf() [3/3]

template<typename RangeType , typename ProjectionType >
bool Algo::NoneOf ( const RangeType &  Range,
ProjectionType  Projection,
ENoRef  NoRef 
)

Checks if no projection of the elements in the range is truthy. Should be used when the range iterator doesn't return a reference.

Parameters
RangeThe range to check.
ProjectionThe projection to apply to each element.
Returns
true if none of the projections are truthy, false otherwise.

◆ ParallelSort() [1/2]

template<typename RangeType >
void Algo::ParallelSort ( RangeType &&  Range)

◆ ParallelSort() [2/2]

template<typename RangeType , typename PredicateType >
void Algo::ParallelSort ( RangeType &&  Range,
PredicateType  Predicate 
)

Sort a range of elements using a user-defined predicate class. The sort is stable. The sort operation will be distributed to task threads using UE::Tasks::Launch, and the Predicate will be called on elements in the input range in parallel (possibly even the same element being read from multiple threads at the same time); the Predicate must be thread safe.

bool Predicate(const T& A, const T& B) -> true if A < B.

Parameters
RangeThe range to sort.
PredicateA binary predicate object used to specify if one element should precede another.

◆ ParallelSortForceSingleThreaded() [1/2]

template<typename RangeType , typename PredicateType >
void Algo::ParallelSortForceSingleThreaded ( RangeType &&  Range)

◆ ParallelSortForceSingleThreaded() [2/2]

template<typename RangeType , typename PredicateType >
void Algo::ParallelSortForceSingleThreaded ( RangeType &&  Range,
PredicateType  Predicate 
)

Debug version of ParallelSort that shares implementation but is single threaded.

◆ Partition() [1/2]

template<typename RangeType , typename UnaryPredicateType >
UE_REWRITE auto Algo::Partition ( RangeType &&  Range,
UnaryPredicateType  Predicate 
) -> decltype(GetNum(Range))

Rearranges the elements so that all the elements for which Predicate returns true precede all those for which it returns false. (not stable)

Parameters
Rangethe range to sort
Predicatea unary predicate object
Returns
index of the first element in the second group

◆ Partition() [2/2]

template<class T , typename IndexType , typename UnaryPredicate >
IndexType Algo::Partition ( T *  Elements,
const IndexType  Num,
UnaryPredicate  Predicate 
)

Rearranges the elements so that all the elements for which Predicate returns true precede all those for which it returns false. (not stable)

Parameters
Firstpointer to the first element
Numthe number of items
Predicateunary predicate class
Returns
index of the first element in the second group

◆ RandomShuffle()

template<typename RangeType >
void Algo::RandomShuffle ( RangeType &&  Range)

Randomly shuffle a range of elements.

Parameters
RangeAny contiguous container.

◆ RemoveIf()

template<typename RangeType , typename Predicate >
int32 Algo::RemoveIf ( RangeType &  Range,
Predicate  Pred 
)

Moves all elements which do not match the predicate to the front of the range, while leaving all other elements is a constructed but unspecified state. The elements which were not removed are not guaranteed to be kept in order (unstable).

Parameters
RangeThe range of elements to manipulate.
PredA callable which maps elements to truthy values, specifying elements to be removed.
Returns
The number of elements that should be kept.

◆ Replace()

template<typename RangeType , typename ValueType >
void Algo::Replace ( RangeType &&  Range,
const ValueType &  InOld,
const ValueType &  InNew 
)

Replaces all elements that compare equal to one value with a new value.

Parameters
RangeThe range to search and modify in-place.
InOldThe value to search for.
InNewThe value to copy in as a replacement.

◆ ReplaceIf()

template<typename RangeType , typename ValueType , typename PredicateType >
void Algo::ReplaceIf ( RangeType &&  Range,
PredicateType  InPred,
const ValueType &  InNew 
)

Replaces all elements that satisfy the predicate with the given value.

Parameters
RangeThe range to search and modify in-place.
InPredThe predicate to apply to each element.
InNewThe value to copy in as a replacement for each element satisfying the predicate.

◆ Reverse() [1/3]

template<typename ContainerType >
UE_REWRITE void Algo::Reverse ( ContainerType &&  Container)

Reverses a range

Parameters
ContainerThe container to reverse

◆ Reverse() [2/3]

template<typename T >
UE_REWRITE void Algo::Reverse ( T *  Array,
int32  ArraySize 
)

Reverses a range

Parameters
ArrayA pointer to the array to reverse
ArraySizeThe number of elements in the array.

◆ Reverse() [3/3]

template<typename T , int32 ArraySize>
UE_REWRITE void Algo::Reverse ( T(&)  Array[ArraySize])

Reverses a range

Parameters
ArrayThe array to reverse.

◆ Rotate()

template<typename RangeType >
UE_REWRITE int32 Algo::Rotate ( RangeType &&  Range,
int32  Count 
)

Rotates a given amount of elements from the front of the range to the end of the range.

Parameters
RangeThe range to rotate.
NumThe number of elements to rotate from the front of the range.
Returns
The new index of the element that was previously at the start of the range.

◆ SelectRandomWeightedBy()

template<typename RangeType , typename ProjectionType >
UE_REWRITE auto Algo::SelectRandomWeightedBy ( RangeType &&  Range,
ProjectionType  Proj 
) -> decltype(AlgoImpl::SelectRandomWeightedBy(Forward<RangeType>(Range), MoveTemp(Proj)))

Randomly select an element from a range of elements, weighted by a projection. The chance of any element being chosen is its weight / the sum of all the weights in the range. Negative- or zero- weighted elements will not be chosen or count toward the total.

Parameters
RangeThe range to select from. Can be any iterable type.
ProjThe projection to weight the random selection by. Should yield a numeric type.

◆ Sort() [1/2]

template<typename RangeType >
UE_REWRITE void Algo::Sort ( RangeType &&  Range)

Sort a range of elements using its operator<. The sort is unstable.

Parameters
RangeThe range to sort.

◆ Sort() [2/2]

template<typename RangeType , typename PredicateType >
UE_REWRITE void Algo::Sort ( RangeType &&  Range,
PredicateType  Pred 
)

Sort a range of elements using a user-defined predicate class. The sort is unstable.

Parameters
RangeThe range to sort.
PredicateA binary predicate object used to specify if one element should precede another.

◆ SortBy() [1/2]

template<typename RangeType , typename ProjectionType >
UE_REWRITE void Algo::SortBy ( RangeType &&  Range,
ProjectionType  Proj 
)

Sort a range of elements by a projection using the projection's operator<. The sort is unstable.

Parameters
RangeThe range to sort.
ProjThe projection to sort by when applied to the element.

◆ SortBy() [2/2]

UE_REWRITE void Algo::SortBy ( RangeType &&  Range,
ProjectionType  Proj,
PredicateType  Pred 
)

Sort a range of elements by a projection using a user-defined predicate class. The sort is unstable.

Parameters
RangeThe range to sort.
ProjThe projection to sort by when applied to the element.
PredicateA binary predicate object, applied to the projection, used to specify if one element should precede another.

◆ StableRemoveIf()

template<typename RangeType , typename Predicate >
int32 Algo::StableRemoveIf ( RangeType &&  Range,
Predicate  Pred 
)

Moves all elements which do not match the predicate to the front of the range, while leaving all other elements is a constructed but unspecified state. The elements which were not removed are guaranteed to be kept in order (stable).

Parameters
RangeThe range of elements to manipulate.
PredA callable which maps elements to truthy values, specifying elements to be removed.
Returns
The number of elements that should be kept.

◆ StableSort() [1/2]

template<typename RangeType >
UE_REWRITE void Algo::StableSort ( RangeType &&  Range)

Sort a range of elements using its operator<. The sort is stable.

Parameters
RangeThe range to sort.

◆ StableSort() [2/2]

template<typename RangeType , typename PredicateType >
UE_REWRITE void Algo::StableSort ( RangeType &&  Range,
PredicateType  Pred 
)

Sort a range of elements using a user-defined predicate class. The sort is stable.

Parameters
RangeThe range to sort.
PredicateA binary predicate object used to specify if one element should precede another.

◆ StableSortBy() [1/2]

template<typename RangeType , typename ProjectionType >
UE_REWRITE void Algo::StableSortBy ( RangeType &&  Range,
ProjectionType  Proj 
)

Sort a range of elements by a projection using the projection's operator<. The sort is stable.

Parameters
RangeThe range to sort.
ProjThe projection to sort by when applied to the element.

◆ StableSortBy() [2/2]

UE_REWRITE void Algo::StableSortBy ( RangeType &&  Range,
ProjectionType  Proj,
PredicateType  Pred 
)

Sort a range of elements by a projection using a user-defined predicate class. The sort is stable.

Parameters
RangeThe range to sort.
ProjThe projection to sort by when applied to the element.
PredicateA binary predicate object, applied to the projection, used to specify if one element should precede another.

◆ TieTupleAdd()

template<typename... OutputTypes>
Private::TTiedTupleAdder< OutputTypes... > Algo::TieTupleAdd ( OutputTypes &...  Outputs)

Ties n objects with an Add function, usually containers, into one object with an Add function accepting an n-tuple that forwards the Add calls.

This is useful for algorithms such as Algo::Transform and Algo::Copy.

Example: TArray<int32> Out1; TArray<FString> Out2; TieTupleAdd(Out1, Out2).Add(MakeTuple(42, TEXT("42"))); // Out1 = { 42 }, Out2 = { "42" }

Parameters
OutputsObjects with an Add() function
Returns
An object with an Add function that will call Add on the tied elements

◆ TopologicalSort()

UE_REWRITE bool Algo::TopologicalSort ( RangeType &&  UniqueRange,
GetElementDependenciesType  GetElementDependencies,
ETopologicalSort  Flags = ETopologicalSort::None 
)

Sorts the given range in leaf to root order: For every pair of elements (A,B) where SortedIndex(A) < SortedIndex(B), either B is not reachable from A, or A and B are mutually reachable.

Parameters
UniqueRangeA range with element type T Type T must support GetTypeHash and copy+move constructors; T being pointertype is recommended. In/Out Variable, is sorted in place. Will be unmodified if function returns false.
GetElementDependenciesA callable with prototype that is one of RangeType<T> GetElementDependencies(const T& Element) const RangeType<T>& GetElementDependencies(const T& Element) It should return the leaf-ward vertices of directed edges from the root-wards Element.
FlagsETopologicalSort::AllowCycles: If present, cycles will be allowed, with the caveat that the sorted ordering of MutuallyReachable vertices in the sorted range is arbitrary. If not present, the presence of a cycle will cause a failure to sort.
Returns
True if succeeded, false if failed due to cycles.

◆ Transform()

void Algo::Transform ( const InT Input,
OutT &&  Output,
TransformT  Trans 
)

Applies a transform to a range and stores the results into a container

Parameters
InputAny iterable type
OutputContainer to hold the output
TransTransformation operation

◆ TransformAccumulate() [1/2]

template<typename T , typename A , typename MapT >
UE_REWRITE T Algo::TransformAccumulate ( const A Input,
MapT  MapOp,
Init 
)

Sums a range by applying MapOp to each element, and then summing the results.

Parameters
InputAny iterable type
MapOpMapping Operation
InitInitial value for the summation
Returns
the result of mapping and then summing all the elements of Input

◆ TransformAccumulate() [2/2]

template<typename T , typename A , typename MapT , typename OpT >
T Algo::TransformAccumulate ( const A Input,
MapT  MapOp,
Init,
OpT  Op 
)

Sums a range by applying MapOp to each element, and then summing the results.

Parameters
InputAny iterable type
MapOpMapping Operation
InitInitial value for the summation
OpSumming Operation (the default is TPlus<>)
Returns
the result of mapping and then summing all the elements of Input

◆ TransformIf()

void Algo::TransformIf ( const InT Input,
OutT &&  Output,
PredicateT  Predicate,
TransformT  Trans 
)

Conditionally applies a transform to a range and stores the results into a container

Parameters
InputAny iterable type
OutputContainer to hold the output
PredicateCondition which returns true for elements that should be transformed and false for elements that should be skipped
TransTransformation operation

◆ UpperBound() [1/2]

template<typename RangeType , typename ValueType >
UE_REWRITE auto Algo::UpperBound ( const RangeType &  Range,
const ValueType &  Value 
) -> decltype(GetNum(Range))

◆ UpperBound() [2/2]

template<typename RangeType , typename ValueType , typename SortPredicateType >
UE_REWRITE auto Algo::UpperBound ( const RangeType &  Range,
const ValueType &  Value,
SortPredicateType  SortPredicate 
) -> decltype(GetNum(Range))

Performs binary search, resulting in position of the first element > Value using predicate

Parameters
RangeRange to search through, must be already sorted by SortPredicate
ValueValue to look for
SortPredicatePredicate for sort comparison, defaults to <
Returns
Position of the first element > Value, may be past end of range

◆ UpperBoundBy() [1/2]

template<typename RangeType , typename ValueType , typename ProjectionType >
UE_REWRITE auto Algo::UpperBoundBy ( const RangeType &  Range,
const ValueType &  Value,
ProjectionType  Projection 
) -> decltype(GetNum(Range))

◆ UpperBoundBy() [2/2]

template<typename RangeType , typename ValueType , typename ProjectionType , typename SortPredicateType >
UE_REWRITE auto Algo::UpperBoundBy ( const RangeType &  Range,
const ValueType &  Value,
ProjectionType  Projection,
SortPredicateType  SortPredicate 
) -> decltype(GetNum(Range))

Performs binary search, resulting in position of the first element with projected value > Value using predicate

Parameters
RangeRange to search through, must be already sorted by SortPredicate
ValueValue to look for
ProjectionFunctor or data member pointer, called via Invoke to compare to Value
SortPredicatePredicate for sort comparison, defaults to <
Returns
Position of the first element > Value, may be past end of range