diff --git a/BAN/include/BAN/Sort.h b/BAN/include/BAN/Sort.h index 46b2f9f8..bf438a8a 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) {