aboutsummaryrefslogtreecommitdiff
path: root/src/list/list.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/list.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/list.h')
-rw-r--r--src/list/list.h38
1 files changed, 2 insertions, 36 deletions
diff --git a/src/list/list.h b/src/list/list.h
index c9e6a9e..1a4c260 100644
--- a/src/list/list.h
+++ b/src/list/list.h
@@ -2,46 +2,12 @@
#define TYPEASVALUE_SRC_LIST_LIST_H_
#include "cons.h"
+#include "detail/fold_variadic.h"
namespace tav {
-namespace detail {
-
-template <
- typename Head,
- typename... Tail
->
-struct List {
- typedef Eval<Cons<
- Head,
- Eval<List<Tail...>>
- >> type;
-};
-
-template <typename Head>
-struct List<Head> {
- typedef Eval<Cons<Head, void>> type;
-};
-
-template <typename Head>
-struct List<Head, void> {
- typedef Eval<List<Head>> type;
-};
-
-template <typename... Tail>
-struct List<void, Tail...> {
- typedef Eval<List<Tail...>> type;
-};
-
-template <>
-struct List<void, void> {
- typedef void type;
-};
-
-}
-
template <typename... Elements>
-using List = Eval<detail::List<Elements...>>;
+using List = Eval<detail::fold_variadic<Pair, Elements...>>;
template <
typename Type,