aboutsummaryrefslogtreecommitdiff
path: root/src/list/operation/basic.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/list/operation/basic.h')
-rw-r--r--src/list/operation/basic.h21
1 files changed, 14 insertions, 7 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;
+
+};
}