diff options
author | bungeman <bungeman@google.com> | 2016-10-26 12:11:28 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-10-26 12:11:28 -0700 |
commit | 6f4293af6906721f09a12818ff3adc767badb3c7 (patch) | |
tree | 5f20f97f3ec6d9fee47584da76347392f4151591 /src | |
parent | a5fb6157e5908c1db9a1e55785dec20dde3eaf69 (diff) |
Move when swapping, if possible.
This change was avoided in the past because vc++ 2013 (12.0)
did not properly create default move constructors and
move assignment operators.
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2454763002
TBR=reed
Verbal lgtm
Review-Url: https://codereview.chromium.org/2454763002
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkTSort.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/core/SkTSort.h b/src/core/SkTSort.h index 7101bab9ba..893af8703a 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); } } |