mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-06 03:21:49 +00:00
optimize it even more
This commit is contained in:
parent
a21d87717e
commit
fc3d5c5484
3 changed files with 33 additions and 21 deletions
|
|
@ -5,6 +5,15 @@
|
|||
#include <vector>
|
||||
|
||||
namespace util {
|
||||
template<typename Iter>
|
||||
inline void insertion_sort(Iter first, Iter last) {
|
||||
for (Iter it = first; it != last; ++it) {
|
||||
std::rotate(
|
||||
std::upper_bound(first, it, *it), it, std::next(it)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename Iter, typename Compare>
|
||||
inline void insertion_sort(Iter first, Iter last, Compare compare) {
|
||||
for (Iter it = first; it != last; ++it) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue