aboutsummaryrefslogtreecommitdiff
path: root/src/conditional
diff options
context:
space:
mode:
Diffstat (limited to 'src/conditional')
-rw-r--r--src/conditional/cond.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/conditional/cond.h b/src/conditional/cond.h
new file mode 100644
index 0000000..0c2b1a8
--- /dev/null
+++ b/src/conditional/cond.h
@@ -0,0 +1,29 @@
+#ifndef TYPEASVALUE_SRC_CONDITIONAL_COND_H_
+#define TYPEASVALUE_SRC_CONDITIONAL_COND_H_
+
+#include <type_traits>
+
+#include "list/list.h"
+#include "list/operation/higher/find.h"
+
+namespace tav {
+
+template <typename... Branches>
+class Cond {
+ private:
+ template <typename Pair>
+ using predicate = IsTrue<typename Car<Pair>::type::type>;
+
+ public:
+ typedef typename Cdr<
+ typename Find<
+ predicate,
+ typename List<Branches...>::type
+ >::type
+ >::type type;
+
+};
+
+}
+
+#endif // TYPEASVALUE_SRC_CONDITIONAL_COND_H_