aboutsummaryrefslogtreecommitdiff
path: root/src/list/operation/reverse.h
diff options
context:
space:
mode:
authorAdrian Kummerlaender2015-01-21 16:31:14 +0100
committerAdrian Kummerlaender2015-01-21 16:31:14 +0100
commit611150b033340ed7433d6ba2482f86aa5655bd15 (patch)
treeaf3c8662e5fffae57652f2ffb6900c7b6256d4ca /src/list/operation/reverse.h
parent4158a6c517329301a5d98ad1c5bde060b3ebf09a (diff)
downloadTypeAsValue-611150b033340ed7433d6ba2482f86aa5655bd15.tar
TypeAsValue-611150b033340ed7433d6ba2482f86aa5655bd15.tar.gz
TypeAsValue-611150b033340ed7433d6ba2482f86aa5655bd15.tar.bz2
TypeAsValue-611150b033340ed7433d6ba2482f86aa5655bd15.tar.lz
TypeAsValue-611150b033340ed7433d6ba2482f86aa5655bd15.tar.xz
TypeAsValue-611150b033340ed7433d6ba2482f86aa5655bd15.tar.zst
TypeAsValue-611150b033340ed7433d6ba2482f86aa5655bd15.zip
Moved `Reverse` into separate header
* it is not in itself a higher order function but only based on one
Diffstat (limited to 'src/list/operation/reverse.h')
-rw-r--r--src/list/operation/reverse.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/list/operation/reverse.h b/src/list/operation/reverse.h
new file mode 100644
index 0000000..7a0305c
--- /dev/null
+++ b/src/list/operation/reverse.h
@@ -0,0 +1,30 @@
+#ifndef TYPEASVALUE_SRC_LIST_OPERATION_REVERSE_H_
+#define TYPEASVALUE_SRC_LIST_OPERATION_REVERSE_H_
+
+#include "concatenate.h"
+#include "higher/fold.h"
+
+namespace tav {
+
+template <typename List>
+class Reverse {
+ private:
+ template <
+ typename Current,
+ typename Previous
+ >
+ struct reversed_concatenate {
+ typedef typename Concatenate<
+ Previous,
+ Cons<Current, void>
+ >::type type;
+ };
+
+ public:
+ typedef typename Fold<reversed_concatenate, void, List>::type type;
+
+};
+
+}
+
+#endif // TYPEASVALUE_SRC_LIST_OPERATION_REVERSE_H_