Skip to content

Commit 5c46b9e

Browse files
committed
Better implementation of copy_to_tmp
1 parent 1531857 commit 5c46b9e

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

include/gfx/timsort.hpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -621,10 +621,13 @@ template <typename RandomAccessIterator, typename Compare> class TimSort {
621621
}
622622
}
623623

624-
void copy_to_tmp(iter_t const begin, diff_t const len) {
625-
tmp_.clear();
626-
tmp_.reserve(len);
627-
GFX_TIMSORT_MOVE_RANGE(begin, begin + len, std::back_inserter(tmp_));
624+
void copy_to_tmp(iter_t const begin, diff_t len) {
625+
#if GFX_TIMSORT_USE_STD_MOVE
626+
tmp_.assign(std::make_move_iterator(begin),
627+
std::make_move_iterator(begin + len));
628+
#else
629+
tmp_.assign(begin, begin + len);
630+
#endif
628631
}
629632

630633
template <typename IterT, typename LessT>

0 commit comments

Comments
 (0)