aboutsummaryrefslogtreecommitdiff
path: root/src/utility/predicate.h
blob: f06fcee5d6b1c29d5d6deeab263f1b0c792461cf (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
#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 Predicate>
struct predicate_negator {
	template <typename Element>
	using function = Not<Predicate<Element>>;
};

}

}

#endif  // TYPEASVALUE_SRC_UTILITY_PREDICATE_H_