blob: e84b18f9795e46133056a06c9395008741e63342 (
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
50
51
52
53
54
55
56
|
#ifndef TYPEASVALUE_SRC_UTILITY_PREDICATE_H_
#define TYPEASVALUE_SRC_UTILITY_PREDICATE_H_
#include "conditional/if.h"
#include "operation/logic.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 Function,
typename... Arguments
>
struct defer_eval {
typedef Function<Arguments...> type;
};
template <
template<typename> class Predicate,
template<typename> class Charge,
typename Surrogate
>
struct predicate_guard {
template <typename Value>
using check = Eval<If<
Eval<Predicate<Value>>,
defer_eval<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_
|