Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
Algo Namespace Reference

Namespaces

namespace  Private
 

Enumerations

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

Functions

template<typename RangeType >
FORCEINLINE void Heapify (RangeType &Range)
 
template<typename RangeType , typename PredicateType >
FORCEINLINE void Heapify (RangeType &Range, PredicateType Predicate)
 
template<typename RangeType , typename ProjectionType , typename PredicateType >
FORCEINLINE void HeapifyBy (RangeType &Range, ProjectionType Projection)
 
template<typename RangeType , typename ProjectionType , typename PredicateType >
FORCEINLINE void HeapifyBy (RangeType &Range, ProjectionType Projection, PredicateType Predicate)
 
template<typename RangeType >
FORCEINLINE void HeapSort (RangeType &&Range)
 
template<typename RangeType , typename PredicateType >
FORCEINLINE void HeapSort (RangeType &&Range, PredicateType Predicate)
 
template<typename RangeType , typename ProjectionType >
FORCEINLINE void HeapSortBy (RangeType &&Range, ProjectionType Projection)
 
template<typename RangeType , typename ProjectionType , typename PredicateType >
FORCEINLINE void HeapSortBy (RangeType &&Range, ProjectionType Projection, PredicateType Predicate)
 
template<typename RangeType >
FORCEINLINE bool IsHeap (RangeType &Range)
 
template<typename RangeType , typename PredicateType >
FORCEINLINE bool IsHeap (RangeType &Range, PredicateType Predicate)
 
template<typename RangeType , typename ProjectionType >
FORCEINLINE bool IsHeapBy (RangeType &Range, ProjectionType Projection)
 
template<typename RangeType , typename ProjectionType , typename PredicateType >
FORCEINLINE bool IsHeapBy (RangeType &Range, ProjectionType Projection, PredicateType Predicate)
 
template<typename T , int32 ArraySize>
FORCEINLINE void Reverse (T(&Array)[ArraySize])
 
template<typename T >
FORCEINLINE void Reverse (T *Array, int32 ArraySize)
 
template<typename ContainerType >
FORCEINLINE void Reverse (ContainerType &Container)
 
template<typename RangeType , typename ValueType , typename SortPredicateType >
FORCEINLINE auto LowerBound (RangeType &Range, const ValueType &Value, SortPredicateType SortPredicate) -> decltype(GetNum(Range))
 
template<typename RangeType , typename ValueType >
FORCEINLINE auto LowerBound (RangeType &Range, const ValueType &Value) -> decltype(GetNum(Range))
 
template<typename RangeType , typename ValueType , typename ProjectionType , typename SortPredicateType >
FORCEINLINE auto LowerBoundBy (RangeType &Range, const ValueType &Value, ProjectionType Projection, SortPredicateType SortPredicate) -> decltype(GetNum(Range))
 
template<typename RangeType , typename ValueType , typename ProjectionType >
FORCEINLINE auto LowerBoundBy (RangeType &Range, const ValueType &Value, ProjectionType Projection) -> decltype(GetNum(Range))
 
template<typename RangeType , typename ValueType , typename SortPredicateType >
FORCEINLINE auto UpperBound (RangeType &Range, const ValueType &Value, SortPredicateType SortPredicate) -> decltype(GetNum(Range))
 
template<typename RangeType , typename ValueType >
FORCEINLINE auto UpperBound (RangeType &Range, const ValueType &Value) -> decltype(GetNum(Range))
 
template<typename RangeType , typename ValueType , typename ProjectionType , typename SortPredicateType >
FORCEINLINE auto UpperBoundBy (RangeType &Range, const ValueType &Value, ProjectionType Projection, SortPredicateType SortPredicate) -> decltype(GetNum(Range))
 
template<typename RangeType , typename ValueType , typename ProjectionType >
FORCEINLINE auto UpperBoundBy (RangeType &Range, const ValueType &Value, ProjectionType Projection) -> decltype(GetNum(Range))
 
template<typename RangeType , typename ValueType , typename SortPredicateType >
FORCEINLINE auto BinarySearch (RangeType &Range, const ValueType &Value, SortPredicateType SortPredicate) -> decltype(GetNum(Range))
 
template<typename RangeType , typename ValueType >
FORCEINLINE auto BinarySearch (RangeType &Range, const ValueType &Value)
 
template<typename RangeType , typename ValueType , typename ProjectionType , typename SortPredicateType >
FORCEINLINE auto BinarySearchBy (RangeType &Range, const ValueType &Value, ProjectionType Projection, SortPredicateType SortPredicate) -> decltype(GetNum(Range))
 
template<typename RangeType , typename ValueType , typename ProjectionType >
FORCEINLINE auto BinarySearchBy (RangeType &Range, const ValueType &Value, ProjectionType Projection)
 
template<typename RangeType >
FORCEINLINE void Sort (RangeType &&Range)
 
template<typename RangeType , typename PredicateType >
FORCEINLINE void Sort (RangeType &&Range, PredicateType Pred)
 
template<typename RangeType , typename ProjectionType >
FORCEINLINE void SortBy (RangeType &&Range, ProjectionType Proj)
 
template<typename RangeType , typename ProjectionType , typename PredicateType >
FORCEINLINE void SortBy (RangeType &&Range, ProjectionType Proj, PredicateType Pred)
 
template<typename RangeType >
FORCEINLINE void IntroSort (RangeType &&Range)
 
template<typename RangeType , typename PredicateType >
FORCEINLINE void IntroSort (RangeType &&Range, PredicateType Predicate)
 
template<typename RangeType , typename ProjectionType >
FORCEINLINE void IntroSortBy (RangeType &&Range, ProjectionType Projection)
 
template<typename RangeType , typename ProjectionType , typename PredicateType >
FORCEINLINE void IntroSortBy (RangeType &&Range, ProjectionType Projection, PredicateType Predicate)
 
template<typename T , typename A , typename OpT >
FORCEINLINE T Accumulate (const A &Input, T Init, OpT Op)
 
template<typename T , typename A >
FORCEINLINE T Accumulate (const A &Input, T Init)
 
template<typename T , typename A , typename MapT , typename OpT >
FORCEINLINE T TransformAccumulate (const A &Input, MapT MapOp, T Init, OpT Op)
 
template<typename T , typename A , typename MapT >
FORCEINLINE T TransformAccumulate (const A &Input, MapT MapOp, T Init)
 
template<typename RangeType >
FORCEINLINE bool AllOf (const RangeType &Range)
 
template<typename RangeType , typename ProjectionType >
FORCEINLINE bool AllOf (const RangeType &Range, ProjectionType Projection)
 
template<typename RangeType >
FORCEINLINE bool AnyOf (const RangeType &Range)
 
template<typename RangeType , typename ProjectionType >
FORCEINLINE bool AnyOf (const RangeType &Range, ProjectionType Projection)
 
template<typename RangeType , typename ProjectionType >
FORCEINLINE bool AnyOf (const RangeType &Range, ProjectionType Projection, ENoRef NoRef)
 
template<typename InAT , typename InBT >
constexpr bool Compare (InAT &&InputA, InBT &&InputB)
 
template<typename InAT , typename InBT , typename PredicateT >
constexpr bool Compare (InAT &&InputA, InBT &&InputB, PredicateT Predicate)
 
template<typename InAT , typename InBT , typename PredicateT >
constexpr bool CompareByPredicate (InAT &&InputA, InBT &&InputB, PredicateT Predicate)
 
template<typename InAT , typename InBT , typename ProjectionT >
constexpr bool CompareBy (InAT &&InputA, InBT &&InputB, ProjectionT Projection)
 
template<typename InAT , typename InBT , typename ProjectionT , typename PredicateT >
constexpr bool CompareBy (InAT &&InputA, InBT &&InputB, ProjectionT Projection, PredicateT Predicate)
 
template<typename InT , typename OutT , typename PredicateT >
FORCEINLINE void CopyIf (const InT &Input, OutT &Output, PredicateT Predicate)
 
template<typename InT , typename OutT >
FORCEINLINE void Copy (const InT &Input, OutT &Output)
 
template<typename InT , typename OutT >
FORCEINLINE void Copy (const InT &Input, OutT &Output, ENoRef NoRef)
 
template<typename InT , typename ValueT >
FORCEINLINE SIZE_T Count (const InT &Input, const ValueT &InValue)
 
template<typename InT , typename PredicateT >
FORCEINLINE SIZE_T CountIf (const InT &Input, PredicateT Predicate)
 
template<typename InT , typename ValueT , typename ProjectionT >
FORCEINLINE SIZE_T CountBy (const InT &Input, const ValueT &InValue, ProjectionT Proj)
 
template<typename RangeType , typename ValueType >
FORCEINLINE auto Find (RangeType &&Range, const ValueType &Value) -> decltype(AlgoImpl::FindBy(Forward< RangeType >(Range), Value, FIdentityFunctor()))
 
template<typename RangeType , typename ValueType , typename ProjectionType >
FORCEINLINE auto FindBy (RangeType &&Range, const ValueType &Value, ProjectionType Proj) -> decltype(AlgoImpl::FindBy(Forward< RangeType >(Range), Value, MoveTemp(Proj)))
 
template<typename RangeType , typename PredicateType >
FORCEINLINE auto FindByPredicate (RangeType &&Range, PredicateType Pred) -> decltype(AlgoImpl::FindByPredicate(Forward< RangeType >(Range), MoveTemp(Pred)))
 
template<typename RangeType , typename ValueType >
FORCEINLINE auto FindLast (RangeType &&Range, const ValueType &Value) -> decltype(AlgoImpl::FindLastBy(GetData(Range), GetNum(Range), Value, FIdentityFunctor()))
 
template<typename RangeType , typename ValueType , typename ProjectionType >
FORCEINLINE auto FindLastBy (RangeType &&Range, const ValueType &Value, ProjectionType Proj) -> decltype(AlgoImpl::FindLastBy(GetData(Range), GetNum(Range), Value, MoveTemp(Proj)))
 
template<typename RangeType , typename PredicateType >
FORCEINLINE auto FindLastByPredicate (RangeType &&Range, PredicateType Pred) -> decltype(AlgoImpl::FindLastByPredicate(GetData(Range), GetNum(Range), MoveTemp(Pred)))
 
template<typename RangeWhereType , typename RangeWhatType >
FORCEINLINE auto FindSequence (const RangeWhereType &Where, const RangeWhatType &What) -> decltype(AlgoImpl::FindSequence(GetData(Where), GetData(Where)+GetNum(Where), GetData(What), GetData(What)+GetNum(What)))
 
int32 FindSortedStringCaseInsensitive (const TCHAR *Str, const TCHAR *const *SortedArray, int32 ArrayCount)
 
template<int32 ArraySize>
FORCEINLINE int32 FindSortedStringCaseInsensitive (const TCHAR *Str, const TCHAR *const (&SortedArray)[ArraySize])
 
template<typename InT , typename PredicateT , typename CallableT >
FORCEINLINE void ForEachIf (InT &Input, PredicateT Predicate, CallableT Callable)
 
template<typename InT , typename CallableT >
FORCEINLINE void ForEach (InT &Input, CallableT Callable)
 
template<typename RangeType , typename ValueType >
FORCEINLINE auto IndexOf (RangeType &&Range, const ValueType &Value)
 
template<typename RangeType , typename ValueType , typename ProjectionType >
FORCEINLINE auto IndexOfBy (RangeType &&Range, const ValueType &Value, ProjectionType Proj)
 
template<typename RangeType , typename PredicateType >
FORCEINLINE auto IndexOfByPredicate (RangeType &&Range, PredicateType Pred)
 
template<typename RangeType >
FORCEINLINE bool IsSorted (const RangeType &Range)
 
template<typename RangeType , typename PredType >
FORCEINLINE bool IsSorted (const RangeType &Range, PredType Pred)
 
template<typename RangeType , typename ProjectionType >
FORCEINLINE bool IsSortedBy (const RangeType &Range, ProjectionType Projection)
 
template<typename RangeType , typename ProjectionType , typename PredType >
FORCEINLINE 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 >
FORCEINLINE void LegacySort (RangeType &&Range)
 
template<typename RangeType , typename PredicateType >
FORCEINLINE void LegacySort (RangeType &&Range, PredicateType Pred)
 
template<typename RangeType , typename ProjectionType >
FORCEINLINE void LegacySortBy (RangeType &&Range, ProjectionType Proj)
 
template<typename RangeType , typename ProjectionType , typename PredicateType >
FORCEINLINE void LegacySortBy (RangeType &&Range, ProjectionType Proj, PredicateType Pred)
 
template<typename RangeAType , typename RangeBType >
int32 LevenshteinDistance (const RangeAType &RangeA, const RangeBType &RangeB)
 
template<typename RangeType >
FORCEINLINE auto MaxElement (RangeType &Range) -> decltype(AlgoImpl::MaxElementBy(Range, FIdentityFunctor(), TLess<>()))
 
template<typename RangeType , typename ComparatorType >
FORCEINLINE auto MaxElement (RangeType &Range, ComparatorType Comp) -> decltype(AlgoImpl::MaxElementBy(Range, FIdentityFunctor(), MoveTemp(Comp)))
 
template<typename RangeType , typename ProjectionType >
FORCEINLINE auto MaxElementBy (RangeType &Range, ProjectionType Proj) -> decltype(AlgoImpl::MaxElementBy(Range, MoveTemp(Proj), TLess<>()))
 
template<typename RangeType , typename ProjectionType , typename ComparatorType >
FORCEINLINE auto MaxElementBy (RangeType &Range, ProjectionType Proj, ComparatorType Comp) -> decltype(AlgoImpl::MaxElementBy(Range, MoveTemp(Proj), MoveTemp(Comp)))
 
template<typename RangeType >
FORCEINLINE auto MinElement (RangeType &Range) -> decltype(AlgoImpl::MinElementBy(Range, FIdentityFunctor(), TLess<>()))
 
template<typename RangeType , typename ComparatorType >
FORCEINLINE auto MinElement (RangeType &Range, ComparatorType Comp) -> decltype(AlgoImpl::MinElementBy(Range, FIdentityFunctor(), MoveTemp(Comp)))
 
template<typename RangeType , typename ProjectionType >
FORCEINLINE auto MinElementBy (RangeType &Range, ProjectionType Proj) -> decltype(AlgoImpl::MinElementBy(Range, MoveTemp(Proj), TLess<>()))
 
template<typename RangeType , typename ProjectionType , typename ComparatorType >
FORCEINLINE auto MinElementBy (RangeType &Range, ProjectionType Proj, ComparatorType Comp) -> decltype(AlgoImpl::MinElementBy(Range, MoveTemp(Proj), MoveTemp(Comp)))
 
template<typename RangeType >
FORCEINLINE bool NoneOf (const RangeType &Range)
 
template<typename RangeType , typename ProjectionType >
FORCEINLINE bool NoneOf (const RangeType &Range, ProjectionType Projection)
 
template<typename RangeType , typename ProjectionType >
FORCEINLINE bool NoneOf (const RangeType &Range, ProjectionType Projection, ENoRef NoRef)
 
template<class T , typename IndexType , class UnaryPredicate >
IndexType Partition (T *Elements, const IndexType Num, const UnaryPredicate &Predicate)
 
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 >
FORCEINLINE void Replace (RangeType &&Range, const ValueType &InOld, const ValueType &InNew)
 
template<typename RangeType , typename ValueType , typename PredicateType >
FORCEINLINE void ReplaceIf (RangeType &&Range, PredicateType InPred, const ValueType &InNew)
 
template<typename RangeType >
FORCEINLINE int32 Rotate (RangeType &Range, int32 Count)
 
template<typename RangeType , typename ProjectionType >
FORCEINLINE auto SelectRandomWeightedBy (RangeType &&Range, ProjectionType Proj) -> decltype(AlgoImpl::SelectRandomWeightedBy(Forward< RangeType >(Range), MoveTemp(Proj)))
 
template<typename RangeType >
FORCEINLINE void StableSort (RangeType &&Range)
 
template<typename RangeType , typename PredicateType >
FORCEINLINE void StableSort (RangeType &&Range, PredicateType Pred)
 
template<typename RangeType , typename ProjectionType >
FORCEINLINE void StableSortBy (RangeType &&Range, ProjectionType Proj)
 
template<typename RangeType , typename ProjectionType , typename PredicateType >
FORCEINLINE void StableSortBy (RangeType &&Range, ProjectionType Proj, PredicateType Pred)
 
template<typename... OutputTypes>
Private::TTiedTupleAdder< OutputTypes... > TieTupleAdd (OutputTypes &... Outputs)
 
template<typename RangeType , typename GetElementDependenciesType >
FORCEINLINE bool TopologicalSort (RangeType &UniqueRange, GetElementDependenciesType GetElementDependencies, ETopologicalSort Flags=ETopologicalSort::None)
 
template<typename InT , typename OutT , typename PredicateT , typename TransformT >
FORCEINLINE void TransformIf (const InT &Input, OutT &&Output, PredicateT Predicate, TransformT Trans)
 
template<typename InT , typename OutT , typename TransformT >
FORCEINLINE void Transform (const InT &Input, OutT &&Output, TransformT Trans)
 

Enumeration Type Documentation

◆ ENoRef

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

Enumerator
NoRef 

Definition at line 10 of file Common.h.

◆ ETopologicalSort

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

Enumerator
None 
AllowCycles 

Definition at line 54 of file KahnTopologicalSort.h.

Function Documentation

◆ Accumulate() [1/2]

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

Sums a range.

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

Definition at line 54 of file Accumulate.h.

◆ Accumulate() [2/2]

template<typename T , typename A , typename OpT >
FORCEINLINE T Algo::Accumulate ( const A & Input,
T 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

Definition at line 35 of file Accumulate.h.

◆ AllOf() [1/2]

template<typename RangeType >
FORCEINLINE 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.

Definition at line 19 of file AllOf.h.

◆ AllOf() [2/2]

template<typename RangeType , typename ProjectionType >
FORCEINLINE 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.

Definition at line 41 of file AllOf.h.

◆ AnyOf() [1/3]

template<typename RangeType >
FORCEINLINE 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.

Definition at line 20 of file AnyOf.h.

◆ AnyOf() [2/3]

template<typename RangeType , typename ProjectionType >
FORCEINLINE 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.

Definition at line 34 of file AnyOf.h.

◆ AnyOf() [3/3]

template<typename RangeType , typename ProjectionType >
FORCEINLINE 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.

Definition at line 49 of file AnyOf.h.

◆ BinarySearch() [1/2]

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

Definition at line 188 of file BinarySearch.h.

◆ BinarySearch() [2/2]

template<typename RangeType , typename ValueType , typename SortPredicateType >
FORCEINLINE auto Algo::BinarySearch ( 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

Definition at line 173 of file BinarySearch.h.

◆ BinarySearchBy() [1/2]

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

Definition at line 218 of file BinarySearch.h.

◆ BinarySearchBy() [2/2]

template<typename RangeType , typename ValueType , typename ProjectionType , typename SortPredicateType >
FORCEINLINE auto Algo::BinarySearchBy ( 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

Definition at line 203 of file BinarySearch.h.

◆ Compare() [1/2]

template<typename InAT , typename InBT >
constexpr bool Algo::Compare ( InAT && InputA,
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.

Definition at line 50 of file Compare.h.

◆ Compare() [2/2]

constexpr bool Algo::Compare ( InAT && InputA,
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.

Definition at line 65 of file Compare.h.

◆ CompareBy() [1/2]

constexpr bool Algo::CompareBy ( InAT && InputA,
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.

Definition at line 87 of file Compare.h.

◆ CompareBy() [2/2]

constexpr bool Algo::CompareBy ( InAT && InputA,
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.

Definition at line 103 of file Compare.h.

◆ CompareByPredicate()

constexpr bool Algo::CompareByPredicate ( InAT && InputA,
InBT && InputB,
PredicateT Predicate )
constexpr

Definition at line 72 of file Compare.h.

◆ Copy() [1/2]

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

Copies a range into a container

Parameters
InputAny iterable type
OutputContainer to hold the output

Definition at line 36 of file Copy.h.

◆ Copy() [2/2]

template<typename InT , typename OutT >
FORCEINLINE 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

Definition at line 52 of file Copy.h.

◆ CopyIf()

FORCEINLINE 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

Definition at line 18 of file Copy.h.

◆ Count()

template<typename InT , typename ValueT >
FORCEINLINE 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

Definition at line 16 of file Count.h.

◆ CountBy()

FORCEINLINE 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

Definition at line 57 of file Count.h.

◆ CountIf()

FORCEINLINE 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

Definition at line 36 of file Count.h.

◆ ENUM_CLASS_FLAGS()

Algo::ENUM_CLASS_FLAGS ( ETopologicalSort )

◆ Find()

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

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.

Definition at line 52 of file Find.h.

◆ FindBy()

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

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.

Definition at line 68 of file Find.h.

◆ FindByPredicate()

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

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.

Definition at line 83 of file Find.h.

◆ FindLast()

template<typename RangeType , typename ValueType >
FORCEINLINE 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.

Definition at line 51 of file FindLast.h.

◆ FindLastBy()

template<typename RangeType , typename ValueType , typename ProjectionType >
FORCEINLINE 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.

Definition at line 67 of file FindLast.h.

◆ FindLastByPredicate()

template<typename RangeType , typename PredicateType >
FORCEINLINE 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.

Definition at line 82 of file FindLast.h.

◆ FindSequence()

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

Definition at line 46 of file FindSequence.h.

◆ FindSortedStringCaseInsensitive() [1/2]

template<int32 ArraySize>
FORCEINLINE 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.

Definition at line 29 of file FindSortedStringCaseInsensitive.h.

◆ FindSortedStringCaseInsensitive() [2/2]

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

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

Invokes a callable to each element in a range

Parameters
InputAny iterable type
CallableCallable object

Definition at line 36 of file ForEach.h.

◆ ForEachIf()

FORCEINLINE 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

Definition at line 18 of file ForEach.h.

◆ Heapify() [1/2]

template<typename RangeType >
FORCEINLINE 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.

Definition at line 20 of file Heapify.h.

◆ Heapify() [2/2]

template<typename RangeType , typename PredicateType >
FORCEINLINE 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.

Definition at line 32 of file Heapify.h.

◆ HeapifyBy() [1/2]

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

Definition at line 45 of file Heapify.h.

◆ HeapifyBy() [2/2]

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

Definition at line 58 of file Heapify.h.

◆ HeapSort() [1/2]

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

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

Parameters
RangeThe range to sort.

Definition at line 18 of file HeapSort.h.

◆ HeapSort() [2/2]

template<typename RangeType , typename PredicateType >
FORCEINLINE 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.

Definition at line 30 of file HeapSort.h.

◆ HeapSortBy() [1/2]

template<typename RangeType , typename ProjectionType >
FORCEINLINE 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.

Definition at line 42 of file HeapSort.h.

◆ HeapSortBy() [2/2]

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

Definition at line 55 of file HeapSort.h.

◆ IndexOf()

template<typename RangeType , typename ValueType >
FORCEINLINE auto Algo::IndexOf ( 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)))

Definition at line 59 of file IndexOf.h.

◆ IndexOfBy()

template<typename RangeType , typename ValueType , typename ProjectionType >
FORCEINLINE auto Algo::IndexOfBy ( 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)))

Definition at line 75 of file IndexOf.h.

◆ IndexOfByPredicate()

template<typename RangeType , typename PredicateType >
FORCEINLINE auto Algo::IndexOfByPredicate ( 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)))

Definition at line 90 of file IndexOf.h.

◆ IntroSort() [1/2]

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

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

Parameters
RangeThe range to sort.

Definition at line 137 of file IntroSort.h.

◆ IntroSort() [2/2]

template<typename RangeType , typename PredicateType >
FORCEINLINE 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.

Definition at line 149 of file IntroSort.h.

◆ IntroSortBy() [1/2]

template<typename RangeType , typename ProjectionType >
FORCEINLINE void Algo::IntroSortBy ( RangeType && Range,
ProjectionType Projection )

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

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

Definition at line 161 of file IntroSort.h.

◆ IntroSortBy() [2/2]

FORCEINLINE void Algo::IntroSortBy ( RangeType && Range,
ProjectionType Projection,
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.
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.

Definition at line 174 of file IntroSort.h.

◆ IsHeap() [1/2]

template<typename RangeType >
FORCEINLINE bool Algo::IsHeap ( 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

Definition at line 50 of file IsHeap.h.

◆ IsHeap() [2/2]

template<typename RangeType , typename PredicateType >
FORCEINLINE bool Algo::IsHeap ( 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

Definition at line 64 of file IsHeap.h.

◆ IsHeapBy() [1/2]

template<typename RangeType , typename ProjectionType >
FORCEINLINE bool Algo::IsHeapBy ( 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

Definition at line 78 of file IsHeap.h.

◆ IsHeapBy() [2/2]

FORCEINLINE bool Algo::IsHeapBy ( 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

Definition at line 93 of file IsHeap.h.

◆ IsSorted() [1/2]

template<typename RangeType >
FORCEINLINE 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.

Definition at line 66 of file IsSorted.h.

◆ IsSorted() [2/2]

template<typename RangeType , typename PredType >
FORCEINLINE 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.

Definition at line 80 of file IsSorted.h.

◆ IsSortedBy() [1/2]

template<typename RangeType , typename ProjectionType >
FORCEINLINE 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.

Definition at line 93 of file IsSorted.h.

◆ IsSortedBy() [2/2]

template<typename RangeType , typename ProjectionType , typename PredType >
FORCEINLINE 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.

Definition at line 107 of file IsSorted.h.

◆ KahnTopologicalSort()

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

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

Definition at line 63 of file KahnTopologicalSort.h.

◆ LegacySort() [1/2]

template<typename RangeType >
FORCEINLINE 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.

Definition at line 120 of file LegacySort.h.

◆ LegacySort() [2/2]

template<typename RangeType , typename PredicateType >
FORCEINLINE 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.

Definition at line 133 of file LegacySort.h.

◆ LegacySortBy() [1/2]

template<typename RangeType , typename ProjectionType >
FORCEINLINE 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.

Definition at line 146 of file LegacySort.h.

◆ LegacySortBy() [2/2]

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

Definition at line 160 of file LegacySort.h.

◆ 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

Definition at line 23 of file LevenshteinDistance.h.

◆ LowerBound() [1/2]

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

Definition at line 97 of file BinarySearch.h.

◆ LowerBound() [2/2]

template<typename RangeType , typename ValueType , typename SortPredicateType >
FORCEINLINE auto Algo::LowerBound ( 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

Definition at line 92 of file BinarySearch.h.

◆ LowerBoundBy() [1/2]

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

Definition at line 118 of file BinarySearch.h.

◆ LowerBoundBy() [2/2]

template<typename RangeType , typename ValueType , typename ProjectionType , typename SortPredicateType >
FORCEINLINE auto Algo::LowerBoundBy ( 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

Definition at line 113 of file BinarySearch.h.

◆ MaxElement() [1/2]

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

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.

Definition at line 40 of file MaxElement.h.

◆ MaxElement() [2/2]

template<typename RangeType , typename ComparatorType >
FORCEINLINE 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.

Definition at line 55 of file MaxElement.h.

◆ MaxElementBy() [1/2]

template<typename RangeType , typename ProjectionType >
FORCEINLINE 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.

Definition at line 70 of file MaxElement.h.

◆ MaxElementBy() [2/2]

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

Definition at line 86 of file MaxElement.h.

◆ MinElement() [1/2]

template<typename RangeType >
FORCEINLINE 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.

Definition at line 40 of file MinElement.h.

◆ MinElement() [2/2]

template<typename RangeType , typename ComparatorType >
FORCEINLINE 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.

Definition at line 55 of file MinElement.h.

◆ MinElementBy() [1/2]

template<typename RangeType , typename ProjectionType >
FORCEINLINE 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.

Definition at line 70 of file MinElement.h.

◆ MinElementBy() [2/2]

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

Definition at line 86 of file MinElement.h.

◆ NoneOf() [1/3]

template<typename RangeType >
FORCEINLINE 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.

Definition at line 20 of file NoneOf.h.

◆ NoneOf() [2/3]

template<typename RangeType , typename ProjectionType >
FORCEINLINE 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.

Definition at line 42 of file NoneOf.h.

◆ NoneOf() [3/3]

template<typename RangeType , typename ProjectionType >
FORCEINLINE 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.

Definition at line 65 of file NoneOf.h.

◆ Partition()

template<class T , typename IndexType , class UnaryPredicate >
IndexType Algo::Partition ( T * Elements,
const IndexType Num,
const 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

Definition at line 16 of file Partition.h.

◆ RandomShuffle()

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

Randomly shuffle a range of elements.

Parameters
RangeAny contiguous container.

Definition at line 16 of file RandomShuffle.h.

◆ 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 index of the first element after those which were not removed.

Definition at line 21 of file RemoveIf.h.

◆ Replace()

template<typename RangeType , typename ValueType >
FORCEINLINE 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.

Definition at line 18 of file Replace.h.

◆ ReplaceIf()

template<typename RangeType , typename ValueType , typename PredicateType >
FORCEINLINE 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.

Definition at line 37 of file Replace.h.

◆ Reverse() [1/3]

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

Reverses a range

Parameters
ContainerThe container to reverse

Definition at line 51 of file Reverse.h.

◆ Reverse() [2/3]

template<typename T >
FORCEINLINE 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.

Definition at line 40 of file Reverse.h.

◆ Reverse() [3/3]

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

Reverses a range

Parameters
ArrayThe array to reverse.

Definition at line 28 of file Reverse.h.

◆ Rotate()

template<typename RangeType >
FORCEINLINE 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.

Definition at line 59 of file Rotate.h.

◆ SelectRandomWeightedBy()

template<typename RangeType , typename ProjectionType >
FORCEINLINE 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.

Definition at line 61 of file SelectRandomWeighted.h.

◆ Sort() [1/2]

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

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

Parameters
RangeThe range to sort.

Definition at line 16 of file Sort.h.

◆ Sort() [2/2]

template<typename RangeType , typename PredicateType >
FORCEINLINE 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.

Definition at line 28 of file Sort.h.

◆ SortBy() [1/2]

template<typename RangeType , typename ProjectionType >
FORCEINLINE 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.

Definition at line 40 of file Sort.h.

◆ SortBy() [2/2]

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

Definition at line 53 of file Sort.h.

◆ 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 index of the first element after those which were not removed.

Definition at line 80 of file RemoveIf.h.

◆ StableSort() [1/2]

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

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

Parameters
RangeThe range to sort.

Definition at line 125 of file StableSort.h.

◆ StableSort() [2/2]

template<typename RangeType , typename PredicateType >
FORCEINLINE 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.

Definition at line 137 of file StableSort.h.

◆ StableSortBy() [1/2]

template<typename RangeType , typename ProjectionType >
FORCEINLINE 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.

Definition at line 149 of file StableSort.h.

◆ StableSortBy() [2/2]

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

Definition at line 162 of file StableSort.h.

◆ 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

Definition at line 52 of file TiedTupleOutput.h.

◆ TopologicalSort()

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

Definition at line 31 of file TopologicalSort.h.

◆ Transform()

FORCEINLINE 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

Definition at line 66 of file Transform.h.

◆ TransformAccumulate() [1/2]

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

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

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

Definition at line 90 of file Accumulate.h.

◆ TransformAccumulate() [2/2]

FORCEINLINE T Algo::TransformAccumulate ( const A & Input,
MapT MapOp,
T Init,
OpT Op )

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

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

Definition at line 70 of file Accumulate.h.

◆ TransformIf()

FORCEINLINE 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

Definition at line 47 of file Transform.h.

◆ UpperBound() [1/2]

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

Definition at line 138 of file BinarySearch.h.

◆ UpperBound() [2/2]

template<typename RangeType , typename ValueType , typename SortPredicateType >
FORCEINLINE auto Algo::UpperBound ( 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

Definition at line 133 of file BinarySearch.h.

◆ UpperBoundBy() [1/2]

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

Definition at line 159 of file BinarySearch.h.

◆ UpperBoundBy() [2/2]

template<typename RangeType , typename ValueType , typename ProjectionType , typename SortPredicateType >
FORCEINLINE auto Algo::UpperBoundBy ( 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

Definition at line 154 of file BinarySearch.h.