aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdrian Kummerlaender2015-02-02 18:58:36 +0100
committerAdrian Kummerlaender2015-02-02 18:58:36 +0100
commitd86aac04e5225e705af0dd7749fdc1c0454088a8 (patch)
tree9d17e88d71fc64d0f94bdb02f76555ad79e058df /src
parent2e167e9772f36f5e2239800e2e76e10bbb940e60 (diff)
downloadTypeAsValue-d86aac04e5225e705af0dd7749fdc1c0454088a8.tar
TypeAsValue-d86aac04e5225e705af0dd7749fdc1c0454088a8.tar.gz
TypeAsValue-d86aac04e5225e705af0dd7749fdc1c0454088a8.tar.bz2
TypeAsValue-d86aac04e5225e705af0dd7749fdc1c0454088a8.tar.lz
TypeAsValue-d86aac04e5225e705af0dd7749fdc1c0454088a8.tar.xz
TypeAsValue-d86aac04e5225e705af0dd7749fdc1c0454088a8.tar.zst
TypeAsValue-d86aac04e5225e705af0dd7749fdc1c0454088a8.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/list/operation/contains.h5
-rw-r--r--src/list/operation/delete.h25
2 files changed, 27 insertions, 3 deletions
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 <typename Current>
- struct comparator {
- typedef std::is_same<Current, Element> type;
- };
+ using comparator = EqualValue<Current, Element>;
public:
typedef typename Any<comparator, List>::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 <typename Current>
+ using comparator = EqualValue<Current, Element>;
+
+ public:
+ typedef typename Remove<comparator, List>::type type;
+
+};
+
+}
+
+#endif // TYPEASVALUE_SRC_LIST_OPERATION_DELETE_H_