diff --git a/Kernel/include_std/algorithm b/Kernel/include_std/algorithm index 33830c1a..f6028bc1 100644 --- a/Kernel/include_std/algorithm +++ b/Kernel/include_std/algorithm @@ -324,4 +324,42 @@ namespace std } return true; } + + template + constexpr void sort(RandomIt first, RandomIt last) + { + if (first == last) + return; + + for (RandomIt i = first; i != last; ++i) + { + for (RandomIt j = i + 1; j != last; ++j) + { + if (*j < *i) + std::swap(*i, *j); + } + } + } + + template + void sort(ExecutionPolicy &&policy, RandomIt first, RandomIt last); + + template + constexpr void sort(RandomIt first, RandomIt last, Compare comp) + { + if (first == last) + return; + + for (RandomIt i = first; i != last; ++i) + { + for (RandomIt j = i + 1; j != last; ++j) + { + if (comp(*j, *i)) + std::swap(*i, *j); + } + } + } + + template + void sort(ExecutionPolicy &&policy, RandomIt first, RandomIt last, Compare comp); }