/usr/include/mapbox/geometry/wagyu/bubble_sort.hpp is in libmapbox-wagyu-dev 0.4.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | #pragma once
namespace mapbox {
namespace geometry {
namespace wagyu {
template <typename It, class Compare, class MethodOnSwap>
void bubble_sort(It begin, It end, Compare c, MethodOnSwap m) {
if (begin == end) {
return;
}
bool modified = false;
auto last = end - 1;
do {
modified = false;
for (auto itr = begin; itr != last; ++itr) {
auto next = std::next(itr);
if (!c(*itr, *next)) {
m(*itr, *next);
std::iter_swap(itr, next);
modified = true;
}
}
} while (modified);
}
}
}
}
|