Class Sorting
Helper utility used for sorting data collections.
Inheritance
Assembly: FlaxEngine.dll
File: Engine/Core/Collections/Sorting.h
Syntax
public class Sorting
Methods
MergeSort(Array<T, AllocationType>& data, Array<T, TempAllocationType>* tmp=nullptr)
Declaration
public static void MergeSort(Array<T, AllocationType>& data, Array<T, TempAllocationType>* tmp=nullptr)
Parameters
Array<T, AllocationType>
data
|
Array<T, TempAllocationType>
tmp
|
Returns
void
|
Type Parameters
typename T
|
typename AllocationType
|
typename TempAllocationType
|
MergeSort(T* data, int32 count, T* tmp=nullptr)
Sorts the linear data array using Merge Sort algorithm (recursive version, uses temporary memory).
Declaration
public static void MergeSort(T* data, int32 count, T* tmp=nullptr)
Parameters
T
data
The data pointer. |
int32
count
The elements count. |
T
tmp
The additional temporary memory buffer for sorting data. If null then will be automatically allocated within this function call. |
Type Parameters
typename T
|
QuickSort(Array<T, AllocationType>& data)
Sorts the linear data array using Quick Sort algorithm (non recursive version, uses temporary stack collection).
Declaration
public static void QuickSort(Array<T, AllocationType>& data)
Parameters
Array<T, AllocationType>
data
The data container. |
Returns
void
|
Type Parameters
typename T
|
typename AllocationType
|
QuickSort(T* data, int32 count)
Sorts the linear data array using Quick Sort algorithm (non recursive version, uses temporary stack collection).
Declaration
public static void QuickSort(T* data, int32 count)
Parameters
T
data
The data pointer. |
int32
count
The elements count. |
Type Parameters
typename T
|
QuickSort(T* data, int32 count, bool(*compare)(const T& a, const T& b))
Sorts the linear data array using Quick Sort algorithm (non recursive version, uses temporary stack collection).
Declaration
public static void QuickSort(T* data, int32 count, bool(*compare)(const T& a, const T& b))
Parameters
T
data
The data pointer. |
int32
count
The elements count. |
bool()(Ta, Tb)
compare
The custom comparision callback. |
Type Parameters
typename T
|
QuickSortObj(T* data, int32 count)
Sorts the linear data array using Quick Sort algorithm (non recursive version, uses temporary stack collection). Uses reference to values for sorting. Useful for sorting collection of pointers to objects that implement comparision operator.
Declaration
public static void QuickSortObj(T* data, int32 count)
Parameters
T
data
The data pointer. |
int32
count
The elements count. |
Type Parameters
typename T
|
RadixSort(T*& inputKeys, U*& inputValues, T* tmpKeys, U* tmpValues, int32 count)
Sorts the linear data array using Radix Sort algorithm (uses temporary keys collection).
Declaration
public static void RadixSort(T*& inputKeys, U*& inputValues, T* tmpKeys, U* tmpValues, int32 count)
Parameters
T
inputKeys
The data pointer to the input sorting keys array. When this method completes it contains a pointer to the original data or the temporary depending on the algorithm passes count. Use it as a results container. |
U
inputValues
The data pointer to the input values array. When this method completes it contains a pointer to the original data or the temporary depending on the algorithm passes count. Use it as a results container. |
T
tmpKeys
The data pointer to the temporary sorting keys array. |
U
tmpValues
The data pointer to the temporary values array. |
int32
count
The elements count. |
Type Parameters
typename T
|
typename U
|
SortArray(T* data, int32 count, bool(*compare)(const T& a, const T& b, U* userData), U* userData)
Declaration
public static void SortArray(T* data, int32 count, bool(*compare)(const T& a, const T& b, U* userData), U* userData)
Parameters
T
data
|
int32
count
|
bool()(Ta, Tb, U userData)
compare
|
U
userData
|
Type Parameters
typename T
|
typename U
|