aboutsummaryrefslogtreecommitdiff
path: root/src/list/operation/higher/take_while.h
diff options
context:
space:
mode:
authorAdrian Kummerlaender2015-02-15 14:07:50 +0100
committerAdrian Kummerlaender2015-02-15 14:07:50 +0100
commit46e174935b122c0da4b51532a7f683a512eeaf65 (patch)
tree88bed0d869ce40c460e6370b4954ff159fe3c575 /src/list/operation/higher/take_while.h
parente24f25ada7e8f48dc35cb235e045a4324bccb4f2 (diff)
downloadTypeAsValue-46e174935b122c0da4b51532a7f683a512eeaf65.tar
TypeAsValue-46e174935b122c0da4b51532a7f683a512eeaf65.tar.gz
TypeAsValue-46e174935b122c0da4b51532a7f683a512eeaf65.tar.bz2
TypeAsValue-46e174935b122c0da4b51532a7f683a512eeaf65.tar.lz
TypeAsValue-46e174935b122c0da4b51532a7f683a512eeaf65.tar.xz
TypeAsValue-46e174935b122c0da4b51532a7f683a512eeaf65.tar.zst
TypeAsValue-46e174935b122c0da4b51532a7f683a512eeaf65.zip
Moved class-based implementations into `detail` namespace
* while class templates enable e.g. hiding implementation details they also require evaluation via `Eval` ** this clutters up the actual logic and is now hidden behind aliae that perform the evaluation
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_