Remove array size from QSort template

This commit is contained in:
Dale Whinham committed 2021-12-05 22:58:43 +00:00
1 parent 510059adfe
commit 2601c58590
1 file changed
+4 -4
+4 -4
View File
@@ -139,8 +139,8 @@ namespace Utility
namespace
{
// Quicksort partition function (private)
template<class T, size_t N>
size_t Partition(T(&Items)[N], Comparator::TComparator<T> Comparator, size_t nLow, size_t nHigh)
template<class T>
size_t Partition(T* Items, Comparator::TComparator<T> Comparator, size_t nLow, size_t nHigh)
{
const size_t nPivotIndex = (nHigh + nLow) / 2;
T* Pivot = &Items[nPivotIndex];
@@ -171,8 +171,8 @@ namespace Utility
}
// Sorts an array in-place using the Tony Hoare Quicksort algorithm
template <class T, size_t N>
void QSort(T(&Items)[N], Comparator::TComparator<T> Comparator = Comparator::LessThan<T>, size_t nLow = 0, size_t nHigh = N - 1)
template <class T>
void QSort(T* Items, Comparator::TComparator<T> Comparator, size_t nLow, size_t nHigh)
{
if (nLow < nHigh)
{