diff options
author | Adrian Kummerlaender | 2015-02-01 13:12:02 +0100 |
---|---|---|
committer | Adrian Kummerlaender | 2015-02-01 13:12:02 +0100 |
commit | 70429313c8d917255c35dabe14f64209dd6463db (patch) | |
tree | a6a26da84188a7ded7108ce4aa04015712493cb1 /src | |
parent | 858a079c338ff2607994a3b97c87c57fbac7ec6e (diff) | |
download | TypeAsValue-70429313c8d917255c35dabe14f64209dd6463db.tar TypeAsValue-70429313c8d917255c35dabe14f64209dd6463db.tar.gz TypeAsValue-70429313c8d917255c35dabe14f64209dd6463db.tar.bz2 TypeAsValue-70429313c8d917255c35dabe14f64209dd6463db.tar.lz TypeAsValue-70429313c8d917255c35dabe14f64209dd6463db.tar.xz TypeAsValue-70429313c8d917255c35dabe14f64209dd6463db.tar.zst TypeAsValue-70429313c8d917255c35dabe14f64209dd6463db.zip |
Added `DropWhile` analogously to `TakeWhile`
Diffstat (limited to 'src')
-rw-r--r-- | src/list/operation/higher/drop_while.h | 29 | ||||
-rw-r--r-- | src/list/operation/higher/take_while.h | 1 |
2 files changed, 29 insertions, 1 deletions
diff --git a/src/list/operation/higher/drop_while.h b/src/list/operation/higher/drop_while.h new file mode 100644 index 0000000..a6ab8c4 --- /dev/null +++ b/src/list/operation/higher/drop_while.h @@ -0,0 +1,29 @@ +#ifndef TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_DROP_WHILE_H_ +#define TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_DROP_WHILE_H_ + +#include "conditional/if.h" + +namespace tav { + +template < + template<typename> class Predicate, + typename Current +> +struct DropWhile { + typedef If< + Predicate<Head<Current>>::type::value, + typename DropWhile<Predicate, Tail<Current>>::type, + Current + > type; +}; + +template < + template<typename> class Predicate +> +struct DropWhile<Predicate, void> { + typedef void type; +}; + +} + +#endif // TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_DROP_WHILE_H_ diff --git a/src/list/operation/higher/take_while.h b/src/list/operation/higher/take_while.h index 01062f4..1ee6736 100644 --- a/src/list/operation/higher/take_while.h +++ b/src/list/operation/higher/take_while.h @@ -1,7 +1,6 @@ #ifndef TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_TAKE_WHILE_H_ #define TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_TAKE_WHILE_H_ -#include "type.h" #include "conditional/if.h" namespace tav { |