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.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/utility/predicate.h b/src/utility/predicate.h
index f06fcee..e84b18f 100644
--- a/src/utility/predicate.h
+++ b/src/utility/predicate.h
@@ -21,6 +21,28 @@ struct predicate_assurance {
>;
};
+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>