aboutsummaryrefslogtreecommitdiff
path: root/src/utility/predicate.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/utility/predicate.h')
-rw-r--r--src/utility/predicate.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/utility/predicate.h b/src/utility/predicate.h
new file mode 100644
index 0000000..f06fcee
--- /dev/null
+++ b/src/utility/predicate.h
@@ -0,0 +1,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_