From 8e4e3466694e5bef43f1308296a76086a7db453d Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Tue, 17 Feb 2015 18:55:08 +0100 Subject: Expressed `Take` and `Drop` in terms of new `Section` operation * unifies the common functionality between `Take` and `Drop` * renamed `basic.h` to `length.h` as it only contains the `Length` implementation --- src/list/operation/take.h | 43 +++++++------------------------------------ 1 file changed, 7 insertions(+), 36 deletions(-) (limited to 'src/list/operation/take.h') diff --git a/src/list/operation/take.h b/src/list/operation/take.h index effba33..f9aa4b0 100644 --- a/src/list/operation/take.h +++ b/src/list/operation/take.h @@ -1,48 +1,19 @@ #ifndef TYPEASVALUE_SRC_LIST_OPERATION_TAKE_H_ #define TYPEASVALUE_SRC_LIST_OPERATION_TAKE_H_ -#include "operation/math.h" +#include "section.h" namespace tav { -namespace detail { - -template < - typename Count, - typename Current -> -struct Take { - typedef Cons< - Head, - Eval>, - Tail - >> - > type; -}; - -template -struct Take, Current> { - typedef void type; -}; - -template -struct Take { - typedef void type; -}; - -template <> -struct Take, void> { - typedef void type; -}; - -} - template < typename Count, - typename Current + typename List > -using Take = Eval>; +using Take = Section< + Size<0>, + Substract>, + List +>; } -- cgit v1.2.3