diff options
Added `DropWhile` analogously to `TakeWhile`
Diffstat (limited to 'src/list/operation/higher/drop_while.h')
-rw-r--r-- | src/list/operation/higher/drop_while.h | 29 |
1 files changed, 29 insertions, 0 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_ |