aboutsummaryrefslogtreecommitdiff
path: root/src/list/operation/basic.h
diff options
context:
space:
mode:
authorAdrian Kummerlaender2015-02-16 14:03:53 +0100
committerAdrian Kummerlaender2015-02-16 14:03:53 +0100
commit324988569183e38e9c5e42318571693a6fcd9569 (patch)
treeca47de290dc9b6ee1d1f771fb473c1f604e67189 /src/list/operation/basic.h
parenta59df7e8c4fd1f88bc1078ebcfde944502b0c309 (diff)
downloadTypeAsValue-324988569183e38e9c5e42318571693a6fcd9569.tar
TypeAsValue-324988569183e38e9c5e42318571693a6fcd9569.tar.gz
TypeAsValue-324988569183e38e9c5e42318571693a6fcd9569.tar.bz2
TypeAsValue-324988569183e38e9c5e42318571693a6fcd9569.tar.lz
TypeAsValue-324988569183e38e9c5e42318571693a6fcd9569.tar.xz
TypeAsValue-324988569183e38e9c5e42318571693a6fcd9569.tar.zst
TypeAsValue-324988569183e38e9c5e42318571693a6fcd9569.zip
Simplified `List`, `Length` and `Reverse` implementations
* continuation of 8e49cc6 * list constructor was generalized to a _variadic fold_
Diffstat (limited to 'src/list/operation/basic.h')
-rw-r--r--src/list/operation/basic.h14
1 files changed, 3 insertions, 11 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>;
}