aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdrian Kummerlaender2015-02-09 15:46:26 +0100
committerAdrian Kummerlaender2015-02-09 15:46:26 +0100
commit709274402ff0a83dfaacae880dfa6db478d29ab1 (patch)
tree9a7c791f7142663f2966f900ac7d1563ce2f1ac6 /src
parent262806540c6eaf0dc45794cdf8f5f0404df10c79 (diff)
downloadTypeAsValue-709274402ff0a83dfaacae880dfa6db478d29ab1.tar
TypeAsValue-709274402ff0a83dfaacae880dfa6db478d29ab1.tar.gz
TypeAsValue-709274402ff0a83dfaacae880dfa6db478d29ab1.tar.bz2
TypeAsValue-709274402ff0a83dfaacae880dfa6db478d29ab1.tar.lz
TypeAsValue-709274402ff0a83dfaacae880dfa6db478d29ab1.tar.xz
TypeAsValue-709274402ff0a83dfaacae880dfa6db478d29ab1.tar.zst
TypeAsValue-709274402ff0a83dfaacae880dfa6db478d29ab1.zip
Updated `Sort` to make use of `Partition` for splitting at pivot
* added further test cases for `Sort` as well as `Nth` aliae
Diffstat (limited to 'src')
-rw-r--r--src/list/operation/higher/sort.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/list/operation/higher/sort.h b/src/list/operation/higher/sort.h
index 0ff5c40..a707a15 100644
--- a/src/list/operation/higher/sort.h
+++ b/src/list/operation/higher/sort.h
@@ -1,8 +1,9 @@
#ifndef TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_SORT_H_
#define TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_SORT_H_
-#include "filter.h"
#include "list/operation/concatenate.h"
+#include "list/operation/higher/partition.h"
+#include "function/apply.h"
namespace tav {
@@ -20,11 +21,13 @@ class Sort {
typename Drop<Add<index, Size<1>>, Sequence>::type
>::type;
- template <typename X>
- using comparator_wrapper = Comparator<pivot, X>;
+ using partitions = typename Partition<
+ Apply<Comparator, pivot, tav::_0>::template single_type,
+ sequence_sans_pivot
+ >::type;
- using lhs = typename Filter<comparator_wrapper, sequence_sans_pivot>::type;
- using rhs = typename Remove<comparator_wrapper, sequence_sans_pivot>::type;
+ using lhs = typename Car<partitions>::type;
+ using rhs = typename Cdr<partitions>::type;
public:
typedef typename Concatenate<