mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-08 20:41:49 +00:00
optimize WorldRenderer chunks sort
This commit is contained in:
parent
b23d31a321
commit
a21d87717e
3 changed files with 35 additions and 12 deletions
|
|
@ -5,6 +5,15 @@
|
|||
#include <vector>
|
||||
|
||||
namespace util {
|
||||
template<typename Iter, typename Compare>
|
||||
inline void insertion_sort(Iter first, Iter last, Compare compare) {
|
||||
for (Iter it = first; it != last; ++it) {
|
||||
std::rotate(
|
||||
std::upper_bound(first, it, *it, compare), it, std::next(it)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline bool contains(const std::vector<T>& vec, const T& value) {
|
||||
return std::find(vec.begin(), vec.end(), value) != vec.end();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue