From 3c431f8a8eab25cdb1237f6a4e3ef6ac3f2b7479 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Sun, 18 Jan 2015 21:38:02 +0100 Subject: Implemented `Reverse` function in terms of `Fold` --- src/list/operation/higher/misc.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/list') 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 +class Reverse { + private: + template < + typename Current, + typename Previous + > + struct ReversedConcatenate { + typedef typename Concatenate< + Previous, + Cons + >::type type; + }; + + public: + typedef typename Fold::type type; + +}; + } #endif // TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_MISC_H_ -- cgit v1.2.3