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/drop.h | 41 ++++++++--------------------------------- 1 file changed, 8 insertions(+), 33 deletions(-) (limited to 'src/list/operation/drop.h') diff --git a/src/list/operation/drop.h b/src/list/operation/drop.h index c7745d7..aef88d3 100644 --- a/src/list/operation/drop.h +++ b/src/list/operation/drop.h @@ -1,45 +1,20 @@ #ifndef TYPEASVALUE_SRC_LIST_OPERATION_DROP_H_ #define TYPEASVALUE_SRC_LIST_OPERATION_DROP_H_ -#include "operation/math.h" +#include "length.h" +#include "section.h" namespace tav { -namespace detail { - -template < - typename Count, - typename Current -> -struct Drop { - typedef Eval>, - Tail - >> type; -}; - -template -struct Drop, Current> { - typedef Current type; -}; - -template -struct Drop { - typedef void type; -}; - -template <> -struct Drop, void> { - typedef void type; -}; - -} - template < typename Count, - typename Current + typename List > -using Drop = Eval>; +using Drop = Section< + Count, + Substract, Size<1>>, + List +>; } -- cgit v1.2.3