From 6291f3ce10aa8ebffa895f21c4ccb91b7349c66a Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Fri, 30 Jan 2015 19:31:30 +0100 Subject: Implemented `Remove` and `Partition` higher order list functions * `Remove` is a basic `Filter` alias that negates its predicate * `Partition` builds on both `Remove` and `Filter` to return both the elements satisfying a predicate and those which don't --- src/list/operation/higher/partition.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/list/operation/higher/partition.h (limited to 'src/list/operation/higher/partition.h') diff --git a/src/list/operation/higher/partition.h b/src/list/operation/higher/partition.h new file mode 100644 index 0000000..e42b971 --- /dev/null +++ b/src/list/operation/higher/partition.h @@ -0,0 +1,21 @@ +#ifndef TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_PARTITION_H_ +#define TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_PARTITION_H_ + +#include "filter.h" + +namespace tav { + +template < + template class Predicate, + typename List +> +struct Partition { + typedef Cons< + typename Filter::type, + typename Remove::type + > type; +}; + +} + +#endif // TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_PARTITION_H_ -- cgit v1.2.3