Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(675)

Unified Diff: src/core/SkTSort.h

Issue 2454763002: Move when swapping, if possible. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkTypes.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkTSort.h
diff --git a/src/core/SkTSort.h b/src/core/SkTSort.h
index 7101bab9bab58aa7d4ab592464b1f3fb2bed57fe..893af8703a9d30a23d4126621cbad7c4ff8561a1 100644
--- a/src/core/SkTSort.h
+++ b/src/core/SkTSort.h
@@ -119,13 +119,13 @@ template <typename T> void SkTHeapSort(T array[], size_t count) {
/** Sorts the array of size count using comparator lessThan using an Insertion Sort algorithm. */
template <typename T, typename C> static void SkTInsertionSort(T* left, T* right, C lessThan) {
for (T* next = left + 1; next <= right; ++next) {
- T insert = *next;
+ T insert = std::move(*next);
T* hole = next;
while (left < hole && lessThan(insert, *(hole - 1))) {
- *hole = *(hole - 1);
+ *hole = std::move(*(hole - 1));
--hole;
}
- *hole = insert;
+ *hole = std::move(insert);
}
}
« no previous file with comments | « include/core/SkTypes.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698