aboutsummaryrefslogtreecommitdiff
path: root/src/list
diff options
context:
space:
mode:
Diffstat (limited to 'src/list')
-rw-r--r--src/list/operation/basic.h21
-rw-r--r--src/list/operation/contains.h2
-rw-r--r--src/list/operation/delete.h2
-rw-r--r--src/list/operation/higher/sort.h2
4 files changed, 17 insertions, 10 deletions
diff --git a/src/list/operation/basic.h b/src/list/operation/basic.h
index cbbe22c..b4aa35a 100644
--- a/src/list/operation/basic.h
+++ b/src/list/operation/basic.h
@@ -2,17 +2,24 @@
#define TYPEASVALUE_SRC_LIST_OPERATION_BASIC_H_
#include "higher/fold.h"
-#include "function/apply.h"
#include "operation/math.h"
namespace tav {
-template <typename Pair>
-using Length = Fold<
- Apply<Add, Size<1>, _1>::pair_type,
- Size<0>,
- Pair
->;
+template <typename Cons>
+class Length {
+ private:
+ template <typename, typename Accumulated>
+ using accumulate = Add<Size<1>, Accumulated>;
+
+ public:
+ typedef typename Fold<
+ accumulate,
+ Size<0>,
+ Cons
+ >::type type;
+
+};
}
diff --git a/src/list/operation/contains.h b/src/list/operation/contains.h
index 51d7d9f..458acc0 100644
--- a/src/list/operation/contains.h
+++ b/src/list/operation/contains.h
@@ -12,7 +12,7 @@ template <
typename List
>
using Contains = Any<
- Apply<EqualValue, tav::_0, Element>::template single_type,
+ Apply<EqualValue, _0, Element>::template type,
List
>;
diff --git a/src/list/operation/delete.h b/src/list/operation/delete.h
index 2ff674c..a524667 100644
--- a/src/list/operation/delete.h
+++ b/src/list/operation/delete.h
@@ -12,7 +12,7 @@ template <
typename List
>
using Delete = Remove<
- Apply<EqualValue, tav::_0, Element>::template single_type,
+ Apply<EqualValue, _0, Element>::template type,
List
>;
diff --git a/src/list/operation/higher/sort.h b/src/list/operation/higher/sort.h
index f9146d6..5bc30c6 100644
--- a/src/list/operation/higher/sort.h
+++ b/src/list/operation/higher/sort.h
@@ -18,7 +18,7 @@ class Sort {
using pivot = typename Nth<index, Sequence>::type;
using partitions = typename Partition<
- Apply<Comparator, pivot, tav::_0>::template single_type,
+ Apply<Comparator, pivot, _0>::template type,
typename DeleteNth<index, Sequence>::type
>::type;