From 4850e2454fc7fae52815b559f540e5b2fbec956e Mon Sep 17 00:00:00 2001 From: q66 Date: Sat, 18 Apr 2015 22:40:38 +0100 Subject: [PATCH] don't use lambda --- octa/algorithm.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/octa/algorithm.h b/octa/algorithm.h index 406ba48..71bba2c 100644 --- a/octa/algorithm.h +++ b/octa/algorithm.h @@ -40,6 +40,15 @@ namespace octa { insertion_sort(range, Less::value>()); } + namespace internal { + template + struct UnaryCompare { + T val; + U comp; + bool operator()(const T &v) const { return comp(v, val); } + }; + } + template void quicksort(R range, C compare) { if (range.length() <= 10) { @@ -48,8 +57,8 @@ namespace octa { } typename RangeTraits::reference p = range[range.length() / 2]; swap(p, range.last()); - R r = partition(range, [p, compare](decltype(p) v) { - return compare(v, p); + R r = partition(range, internal::UnaryCompare{ + p, compare }); R l = range.slice(0, range.length() - r.length()); swap(r.first(), r.last());