aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkTSort.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/SkTSort.h')
-rw-r--r--src/core/SkTSort.h16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/core/SkTSort.h b/src/core/SkTSort.h
index a97baf9446..87d99d5eb9 100644
--- a/src/core/SkTSort.h
+++ b/src/core/SkTSort.h
@@ -12,6 +12,8 @@
#include "SkTo.h"
#include "SkTypes.h"
+#include <utility>
+
/* A comparison functor which performs the comparison 'a < b'. */
template <typename T> struct SkTCompareLT {
bool operator()(const T a, const T b) const { return a < b; }
@@ -92,7 +94,7 @@ void SkTHeapSort_SiftDown(T array[], size_t root, size_t bottom, C lessThan) {
}
/** Sorts the array of size count using comparator lessThan using a Heap Sort algorithm. Be sure to
- * specialize SkTSwap if T has an efficient swap operation.
+ * specialize swap if T has an efficient swap operation.
*
* @param array the array to be sorted.
* @param count the number of elements in the array.
@@ -104,7 +106,8 @@ template <typename T, typename C> void SkTHeapSort(T array[], size_t count, C le
}
for (size_t i = count - 1; i > 0; --i) {
- SkTSwap<T>(array[0], array[i]);
+ using std::swap;
+ swap(array[0], array[i]);
SkTHeapSort_SiftUp(array, 1, i, lessThan);
}
}
@@ -136,17 +139,18 @@ template <typename T, typename C> static void SkTInsertionSort(T* left, T* right
template <typename T, typename C>
static T* SkTQSort_Partition(T* left, T* right, T* pivot, C lessThan) {
+ using std::swap;
T pivotValue = *pivot;
- SkTSwap(*pivot, *right);
+ swap(*pivot, *right);
T* newPivot = left;
while (left < right) {
if (lessThan(*left, pivotValue)) {
- SkTSwap(*left, *newPivot);
+ swap(*left, *newPivot);
newPivot += 1;
}
left += 1;
}
- SkTSwap(*newPivot, *right);
+ swap(*newPivot, *right);
return newPivot;
}
@@ -184,7 +188,7 @@ template <typename T, typename C> void SkTIntroSort(int depth, T* left, T* right
}
/** Sorts the region from left to right using comparator lessThan using a Quick Sort algorithm. Be
- * sure to specialize SkTSwap if T has an efficient swap operation.
+ * sure to specialize swap if T has an efficient swap operation.
*
* @param left the beginning of the region to be sorted.
* @param right the end of the region to be sorted (inclusive).