diff options
author | Adrian Kummerlaender | 2015-02-17 18:55:08 +0100 |
---|---|---|
committer | Adrian Kummerlaender | 2015-02-17 18:55:08 +0100 |
commit | 8e4e3466694e5bef43f1308296a76086a7db453d (patch) | |
tree | 84049e2604341a0326e99d31cbed898fe5448d2d /src/list/operation/drop.h | |
parent | f81cd736e00c28cf24412a4099bae08ff2e6c493 (diff) | |
download | TypeAsValue-8e4e3466694e5bef43f1308296a76086a7db453d.tar TypeAsValue-8e4e3466694e5bef43f1308296a76086a7db453d.tar.gz TypeAsValue-8e4e3466694e5bef43f1308296a76086a7db453d.tar.bz2 TypeAsValue-8e4e3466694e5bef43f1308296a76086a7db453d.tar.lz TypeAsValue-8e4e3466694e5bef43f1308296a76086a7db453d.tar.xz TypeAsValue-8e4e3466694e5bef43f1308296a76086a7db453d.tar.zst TypeAsValue-8e4e3466694e5bef43f1308296a76086a7db453d.zip |
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
Diffstat (limited to 'src/list/operation/drop.h')
-rw-r--r-- | src/list/operation/drop.h | 41 |
1 files changed, 8 insertions, 33 deletions
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<Drop< - Substract<Count, Size<1>>, - Tail<Current> - >> type; -}; - -template <typename Current> -struct Drop<Size<0>, Current> { - typedef Current type; -}; - -template <typename Count> -struct Drop<Count, void> { - typedef void type; -}; - -template <> -struct Drop<Size<0>, void> { - typedef void type; -}; - -} - template < typename Count, - typename Current + typename List > -using Drop = Eval<detail::Drop<Count, Current>>; +using Drop = Section< + Count, + Substract<Length<List>, Size<1>>, + List +>; } |