aboutsummaryrefslogtreecommitdiff
path: root/src/list/operation/higher/take_while.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/list/operation/higher/take_while.h')
-rw-r--r--src/list/operation/higher/take_while.h18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/list/operation/higher/take_while.h b/src/list/operation/higher/take_while.h
index 8e61c45..dec5551 100644
--- a/src/list/operation/higher/take_while.h
+++ b/src/list/operation/higher/take_while.h
@@ -5,19 +5,21 @@
namespace tav {
+namespace detail {
+
template <
template<typename> class Predicate,
typename Current
>
struct TakeWhile {
- typedef Eval<If<
+ typedef If<
Eval<Predicate<Head<Current>>>,
- Eval<Cons<
+ Cons<
Head<Current>,
Eval<TakeWhile<Predicate, Tail<Current>>>
- >>,
+ >,
void
- >> type;
+ > type;
};
template <
@@ -29,4 +31,12 @@ struct TakeWhile<Predicate, void> {
}
+template <
+ template<typename> class Predicate,
+ typename Current
+>
+using TakeWhile = Eval<detail::TakeWhile<Predicate, Current>>;
+
+}
+
#endif // TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_TAKE_WHILE_H_