aboutsummaryrefslogtreecommitdiff
path: root/src/list/operation/higher/find.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/list/operation/higher/find.h')
-rw-r--r--src/list/operation/higher/find.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/list/operation/higher/find.h b/src/list/operation/higher/find.h
new file mode 100644
index 0000000..47b88ad
--- /dev/null
+++ b/src/list/operation/higher/find.h
@@ -0,0 +1,30 @@
+#ifndef TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_FIND_H_
+#define TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_FIND_H_
+
+#include "type.h"
+#include "conditional/if.h"
+
+namespace tav {
+
+template <
+ template<typename> class Predicate,
+ typename Current
+>
+struct Find {
+ typedef If<
+ Predicate<Head<Current>>::type::value,
+ Head<Current>,
+ typename Find<Predicate, Tail<Current>>::type
+ > type;
+};
+
+template <
+ template<typename> class Predicate
+>
+struct Find<Predicate, void> {
+ typedef Boolean<false> type;
+};
+
+}
+
+#endif // TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_FIND_H_