aboutsummaryrefslogtreecommitdiff
path: root/src/list/operation
diff options
context:
space:
mode:
Diffstat (limited to 'src/list/operation')
-rw-r--r--src/list/operation/basic.h14
-rw-r--r--src/list/operation/higher/sort.h4
-rw-r--r--src/list/operation/reverse.h23
3 files changed, 11 insertions, 30 deletions
diff --git a/src/list/operation/basic.h b/src/list/operation/basic.h
index a299938..d0f6212 100644
--- a/src/list/operation/basic.h
+++ b/src/list/operation/basic.h
@@ -8,21 +8,13 @@ namespace tav {
namespace detail {
-template <typename List>
-class Length {
- private:
- template <typename, typename Accumulated>
- using accumulate = Add<Size<1>, Accumulated>;
-
- public:
- typedef tav::Fold<accumulate, Size<0>, List> type;
-
-};
+template <typename, typename Accumulated>
+using length_accumulate = Add<Size<1>, Accumulated>;
}
template <typename List>
-using Length = Eval<detail::Length<List>>;
+using Length = Fold<detail::length_accumulate, Size<0>, List>;
}
diff --git a/src/list/operation/higher/sort.h b/src/list/operation/higher/sort.h
index 2976e06..26d99e6 100644
--- a/src/list/operation/higher/sort.h
+++ b/src/list/operation/higher/sort.h
@@ -29,9 +29,9 @@ class Sort {
public:
using type = Concatenate<
- tav::List<
+ List<
Eval<Sort<Comparator, lhs>>,
- tav::List<pivot>,
+ List<pivot>,
Eval<Sort<Comparator, rhs>>
>
>;
diff --git a/src/list/operation/reverse.h b/src/list/operation/reverse.h
index aabba92..6d9237d 100644
--- a/src/list/operation/reverse.h
+++ b/src/list/operation/reverse.h
@@ -8,27 +8,16 @@ namespace tav {
namespace detail {
-template <typename Sequence>
-class Reverse {
- private:
- template <
- typename Current,
- typename Previous
- >
- using reversed_append = tav::Append<
- Previous,
- tav::List<Current>
- >;
-
- public:
- typedef tav::Fold<reversed_append, void, Sequence> type;
-
-};
+template <
+ typename Current,
+ typename Previous
+>
+using reversed_append = tav::Append<Previous, List<Current>>;
}
template <typename Sequence>
-using Reverse = Eval<detail::Reverse<Sequence>>;
+using Reverse = Fold<detail::reversed_append, void, Sequence>;
}