blob: 35884004d98673e6b0ad396f562e80514ac1830c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
#ifndef TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_FILTER_H_
#define TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_FILTER_H_
#include "fold.h"
#include "conditional/if.h"
namespace tav {
template <
template<typename> class Predicate,
typename List
>
class Filter {
private:
template <
typename Current,
typename Previous
>
using predicate_wrapper = If<
Eval<Predicate<Current>>,
Eval<Cons<Current, Previous>>,
Previous
>;
public:
typedef Eval<Fold<predicate_wrapper, void, List>> type;
};
template <
template<typename> class Predicate,
typename List
>
class Remove {
private:
template <typename Element>
using predicate_negator = Not<Predicate<Element>>;
public:
typedef Eval<Filter<predicate_negator, List>> type;
};
}
#endif // TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_FILTER_H_
|