From 611150b033340ed7433d6ba2482f86aa5655bd15 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Wed, 21 Jan 2015 16:31:14 +0100 Subject: Moved `Reverse` into separate header * it is not in itself a higher order function but only based on one --- src/list/operation/higher/misc.h | 20 -------------------- src/list/operation/reverse.h | 30 ++++++++++++++++++++++++++++++ test.cc | 1 + 3 files changed, 31 insertions(+), 20 deletions(-) create mode 100644 src/list/operation/reverse.h diff --git a/src/list/operation/higher/misc.h b/src/list/operation/higher/misc.h index 95a5f50..1eacaaa 100644 --- a/src/list/operation/higher/misc.h +++ b/src/list/operation/higher/misc.h @@ -2,7 +2,6 @@ #define TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_MISC_H_ #include "fold.h" -#include "list/operation/concatenate.h" #include "conditional/if.h" namespace tav { @@ -49,25 +48,6 @@ class Filter { }; -template -class Reverse { - private: - template < - typename Current, - typename Previous - > - struct reversed_concatenate { - typedef typename Concatenate< - Previous, - Cons - >::type type; - }; - - public: - typedef typename Fold::type type; - -}; - } #endif // TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_MISC_H_ 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 +class Reverse { + private: + template < + typename Current, + typename Previous + > + struct reversed_concatenate { + typedef typename Concatenate< + Previous, + Cons + >::type type; + }; + + public: + typedef typename Fold::type type; + +}; + +} + +#endif // TYPEASVALUE_SRC_LIST_OPERATION_REVERSE_H_ diff --git a/test.cc b/test.cc index f64e385..49b95cb 100644 --- a/test.cc +++ b/test.cc @@ -5,6 +5,7 @@ #include "list/cons.h" #include "list/list.h" +#include "list/operation/reverse.h" #include "list/operation/higher/fold.h" #include "list/operation/higher/misc.h" #include "list/operation/higher/query.h" -- cgit v1.2.3