From d86aac04e5225e705af0dd7749fdc1c0454088a8 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Mon, 2 Feb 2015 18:58:36 +0100 Subject: Implemented `Delete` in terms of `Remove` * analogously to how `Contains` is implemented as a wrapper around `Any` * added appropriate test case and lessened restrictions on `Contains`'s comparator --- src/list/operation/contains.h | 5 ++--- src/list/operation/delete.h | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 src/list/operation/delete.h (limited to 'src') diff --git a/src/list/operation/contains.h b/src/list/operation/contains.h index 9e752ed..d3f95fa 100644 --- a/src/list/operation/contains.h +++ b/src/list/operation/contains.h @@ -1,6 +1,7 @@ #ifndef TYPEASVALUE_SRC_LIST_OPERATION_CONTAINS_H_ #define TYPEASVALUE_SRC_LIST_OPERATION_CONTAINS_H_ +#include "type.h" #include "higher/query.h" namespace tav { @@ -12,9 +13,7 @@ template < class Contains { private: template - struct comparator { - typedef std::is_same type; - }; + using comparator = EqualValue; public: typedef typename Any::type type; diff --git a/src/list/operation/delete.h b/src/list/operation/delete.h new file mode 100644 index 0000000..ad0a4cf --- /dev/null +++ b/src/list/operation/delete.h @@ -0,0 +1,25 @@ +#ifndef TYPEASVALUE_SRC_LIST_OPERATION_DELETE_H_ +#define TYPEASVALUE_SRC_LIST_OPERATION_DELETE_H_ + +#include "type.h" +#include "higher/filter.h" + +namespace tav { + +template < + typename Element, + typename List +> +class Delete { + private: + template + using comparator = EqualValue; + + public: + typedef typename Remove::type type; + +}; + +} + +#endif // TYPEASVALUE_SRC_LIST_OPERATION_DELETE_H_ -- cgit v1.2.3