From a8bec66b05eece7b8a39102fb1b0ba8f778eb9fe Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Thu, 19 Feb 2015 13:45:07 +0100 Subject: Reimplemented `Find` in terms of `ListIndex` * `ListIndex` already implements the necessary partial template specializations for finding elements matching a predicate * reimplemented `Cond` using `detail::find_variadic` as `Find` depends on `Apply` which in turn depends on `Cond` ** it is useful if core functionality such as the branched conditional `Cond` do not require higher order functionality such as `Find` *** otherwise one can not use core functionality in the implementation of higher order functionality * introduced `utility::predicate_guard` helper template ** checks a given value using a predicate and only forwards the value to the guarded function if this check is successful ** if check is unsuccessful it returns a surrogate value simmilar to `utility::predicate_assurance` --- src/conditional/cond.h | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'src/conditional') diff --git a/src/conditional/cond.h b/src/conditional/cond.h index eeb31b6..8a34f79 100644 --- a/src/conditional/cond.h +++ b/src/conditional/cond.h @@ -1,10 +1,7 @@ #ifndef TYPEASVALUE_SRC_CONDITIONAL_COND_H_ #define TYPEASVALUE_SRC_CONDITIONAL_COND_H_ -#include - -#include "list/list.h" -#include "list/operation/higher/find.h" +#include "list/detail/find_variadic.h" namespace tav { @@ -16,12 +13,9 @@ using cond_predicate = IsTrue>; } template -using Cond = Cdr< - Find< - detail::cond_predicate, - List - > ->; +using Cond = Cdr +>>; } -- cgit v1.2.3