aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdrian Kummerlaender2015-01-18 21:38:02 +0100
committerAdrian Kummerlaender2015-01-18 21:38:02 +0100
commit3c431f8a8eab25cdb1237f6a4e3ef6ac3f2b7479 (patch)
tree64d8d230331ee7c61a759e118c98f915fe565659 /src
parent02c6e34f9859047efe702cf5b866702f7b02d878 (diff)
downloadTypeAsValue-3c431f8a8eab25cdb1237f6a4e3ef6ac3f2b7479.tar
TypeAsValue-3c431f8a8eab25cdb1237f6a4e3ef6ac3f2b7479.tar.gz
TypeAsValue-3c431f8a8eab25cdb1237f6a4e3ef6ac3f2b7479.tar.bz2
TypeAsValue-3c431f8a8eab25cdb1237f6a4e3ef6ac3f2b7479.tar.lz
TypeAsValue-3c431f8a8eab25cdb1237f6a4e3ef6ac3f2b7479.tar.xz
TypeAsValue-3c431f8a8eab25cdb1237f6a4e3ef6ac3f2b7479.tar.zst
TypeAsValue-3c431f8a8eab25cdb1237f6a4e3ef6ac3f2b7479.zip
Implemented `Reverse` function in terms of `Fold`
Diffstat (limited to 'src')
-rw-r--r--src/list/operation/higher/misc.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/list/operation/higher/misc.h b/src/list/operation/higher/misc.h
index 708265a..280c0d5 100644
--- a/src/list/operation/higher/misc.h
+++ b/src/list/operation/higher/misc.h
@@ -2,6 +2,7 @@
#define TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_MISC_H_
#include "fold.h"
+#include "list/operation/concatenate.h"
namespace tav {
@@ -24,6 +25,25 @@ class Map {
};
+template <typename List>
+class Reverse {
+ private:
+ template <
+ typename Current,
+ typename Previous
+ >
+ struct ReversedConcatenate {
+ typedef typename Concatenate<
+ Previous,
+ Cons<Current, void>
+ >::type type;
+ };
+
+ public:
+ typedef typename Fold<ReversedConcatenate, void, List>::type type;
+
+};
+
}
#endif // TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_MISC_H_