From 46c3da71b628af57e71e0b3377dad463712f384e Mon Sep 17 00:00:00 2001 From: Bananymous Date: Thu, 7 Dec 2023 22:26:58 +0200 Subject: [PATCH] BAN: Cleanup sorting code --- BAN/include/BAN/Sort.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/BAN/include/BAN/Sort.h b/BAN/include/BAN/Sort.h index 46b2f9f876..bf438a8ad6 100644 --- a/BAN/include/BAN/Sort.h +++ b/BAN/include/BAN/Sort.h @@ -15,11 +15,11 @@ namespace BAN swap(*lhs, *rhs); } - namespace detail + namespace detail::sort { template - It sort_quick_partition(It begin, It end, Comp comp) + It partition(It begin, It end, Comp comp) { It pivot = prev(end, 1); @@ -45,7 +45,7 @@ namespace BAN { if (begin == end || next(begin, 1) == end) return; - It mid = detail::sort_quick_partition(begin, end, comp); + It mid = detail::sort::partition(begin, end, comp); sort_quick(begin, mid, comp); sort_quick(++mid, end, comp); } @@ -53,7 +53,7 @@ namespace BAN template> void sort_insertion(It begin, It end, Comp comp = {}) { - if (begin == end) + if (begin == end || next(begin, 1) == end) return; for (It it1 = next(begin, 1); it1 != end; ++it1) {