aboutsummaryrefslogtreecommitdiff
path: root/src/list/operation/higher/sort.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/list/operation/higher/sort.h')
-rw-r--r--src/list/operation/higher/sort.h34
1 files changed, 22 insertions, 12 deletions
diff --git a/src/list/operation/higher/sort.h b/src/list/operation/higher/sort.h
index cf86e9b..2976e06 100644
--- a/src/list/operation/higher/sort.h
+++ b/src/list/operation/higher/sort.h
@@ -8,31 +8,33 @@
namespace tav {
+namespace detail {
+
template <
template<typename, typename> class Comparator,
typename Sequence
>
class Sort {
private:
- using index = Divide<Eval<Length<Sequence>>, Size<2>>;
- using pivot = Eval<Nth<index, Sequence>>;
+ using index = Divide<tav::Length<Sequence>, Size<2>>;
+ using pivot = tav::Nth<index, Sequence>;
- using partitions = Eval<Partition<
+ using partitions = Partition<
Apply<Comparator, pivot, _0>::template function,
- Eval<DeleteNth<index, Sequence>>
- >>;
+ DeleteNth<index, Sequence>
+ >;
- using lhs = Eval<Car<partitions>>;
- using rhs = Eval<Cdr<partitions>>;
+ using lhs = tav::Car<partitions>;
+ using rhs = tav::Cdr<partitions>;
public:
- typedef Eval<Concatenate<
- Eval<List<
+ using type = Concatenate<
+ tav::List<
Eval<Sort<Comparator, lhs>>,
- Eval<List<pivot>>,
+ tav::List<pivot>,
Eval<Sort<Comparator, rhs>>
- >>
- >> type;
+ >
+ >;
};
template <template<typename, typename> class Comparator>
@@ -42,4 +44,12 @@ struct Sort<Comparator, void> {
}
+template <
+ template<typename, typename> class Comparator,
+ typename Sequence
+>
+using Sort = Eval<detail::Sort<Comparator, Sequence>>;
+
+}
+
#endif // TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_SORT_H_