blob: b185759155b345b39e6e62e381da18cf4227a200 (
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
47
48
49
|
#ifndef TYPEASVALUE_SRC_UTILITY_PREDICATE_H_
#define TYPEASVALUE_SRC_UTILITY_PREDICATE_H_
#include "conditional/if.h"
#include "operation/logic.h"
#include "function/apply.h"
namespace tav {
namespace utility {
template <
template<typename> class Predicate,
typename Surrogate
>
struct predicate_assurance {
template <typename Value>
using assure = If<
Eval<Predicate<Value>>,
Value,
Surrogate
>;
};
template <
template<typename> class Predicate,
template<typename> class Charge,
typename Surrogate
>
struct predicate_guard {
template <typename Value>
using check = Eval<If<
Eval<Predicate<Value>>,
Apply<Charge, Value>,
Surrogate
>>;
};
template <template<typename> class Predicate>
struct predicate_negator {
template <typename Element>
using function = Not<Predicate<Element>>;
};
}
}
#endif // TYPEASVALUE_SRC_UTILITY_PREDICATE_H_
|