diff options
author | Adrian Kummerlaender | 2015-02-05 14:07:32 +0100 |
---|---|---|
committer | Adrian Kummerlaender | 2015-02-05 14:07:32 +0100 |
commit | 868f7d2c46302f3f993ff8f7943823243a5d1a6d (patch) | |
tree | 681688f7718683f49482719c8469ef933a06da4a | |
parent | d546e0d1172ee138971ced523a97121b495a7ba1 (diff) | |
download | TypeAsValue-868f7d2c46302f3f993ff8f7943823243a5d1a6d.tar TypeAsValue-868f7d2c46302f3f993ff8f7943823243a5d1a6d.tar.gz TypeAsValue-868f7d2c46302f3f993ff8f7943823243a5d1a6d.tar.bz2 TypeAsValue-868f7d2c46302f3f993ff8f7943823243a5d1a6d.tar.lz TypeAsValue-868f7d2c46302f3f993ff8f7943823243a5d1a6d.tar.xz TypeAsValue-868f7d2c46302f3f993ff8f7943823243a5d1a6d.tar.zst TypeAsValue-868f7d2c46302f3f993ff8f7943823243a5d1a6d.zip |
Reimplemented `Contains` and `Delete` in terms of `Apply`
* both depict the very usecase partial function application via `Apply` is suited for
-rw-r--r-- | src/list/operation/contains.h | 14 | ||||
-rw-r--r-- | src/list/operation/delete.h | 14 |
2 files changed, 10 insertions, 18 deletions
diff --git a/src/list/operation/contains.h b/src/list/operation/contains.h index d3f95fa..51d7d9f 100644 --- a/src/list/operation/contains.h +++ b/src/list/operation/contains.h @@ -3,6 +3,7 @@ #include "type.h" #include "higher/query.h" +#include "function/apply.h" namespace tav { @@ -10,15 +11,10 @@ template < typename Element, typename List > -class Contains { - private: - template <typename Current> - using comparator = EqualValue<Current, Element>; - - public: - typedef typename Any<comparator, List>::type type; - -}; +using Contains = Any< + Apply<EqualValue, tav::_0, Element>::template single_type, + List +>; } diff --git a/src/list/operation/delete.h b/src/list/operation/delete.h index ad0a4cf..2ff674c 100644 --- a/src/list/operation/delete.h +++ b/src/list/operation/delete.h @@ -3,6 +3,7 @@ #include "type.h" #include "higher/filter.h" +#include "function/apply.h" namespace tav { @@ -10,15 +11,10 @@ template < typename Element, typename List > -class Delete { - private: - template <typename Current> - using comparator = EqualValue<Current, Element>; - - public: - typedef typename Remove<comparator, List>::type type; - -}; +using Delete = Remove< + Apply<EqualValue, tav::_0, Element>::template single_type, + List +>; } |