From 9bb66d9c1d8a7bf5bf02f5a7c400894e928d2a95 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Wed, 18 Feb 2015 22:37:39 +0100 Subject: Changed `ListIndex` to return false if no index is found * analogously to `list-index` and `find` in SRFI-1 --- src/list/operation/higher/drop_while.h | 2 +- src/list/operation/higher/list_index.h | 2 +- src/list/operation/higher/take_while.h | 2 +- src/type.h | 6 ++++++ 4 files changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/list/operation/higher/drop_while.h b/src/list/operation/higher/drop_while.h index 1207020..8d013f9 100644 --- a/src/list/operation/higher/drop_while.h +++ b/src/list/operation/higher/drop_while.h @@ -13,7 +13,7 @@ template < > using DropWhile = Drop< typename utility::predicate_assurance< - utility::predicate_negator::template function, + IsSize, Length >::template assure< ListIndex< diff --git a/src/list/operation/higher/list_index.h b/src/list/operation/higher/list_index.h index bbf43ee..d665b82 100644 --- a/src/list/operation/higher/list_index.h +++ b/src/list/operation/higher/list_index.h @@ -29,7 +29,7 @@ template < typename Index > struct index_of_first { - typedef void type; + typedef Boolean type; }; } diff --git a/src/list/operation/higher/take_while.h b/src/list/operation/higher/take_while.h index f9fc3aa..105e83c 100644 --- a/src/list/operation/higher/take_while.h +++ b/src/list/operation/higher/take_while.h @@ -13,7 +13,7 @@ template < > using TakeWhile = Take< typename utility::predicate_assurance< - utility::predicate_negator::template function, + IsSize, Length >::template assure< ListIndex< diff --git a/src/type.h b/src/type.h index 508e22f..c2ad2d8 100644 --- a/src/type.h +++ b/src/type.h @@ -38,6 +38,12 @@ using IsEqualValue = Boolean; template using IsTrue = IsEqualValue>; +template +using IsBoolean = Eval>; + +template +using IsSize = Eval>; + } #endif // TYPEASVALUE_SRC_TYPE_H_ -- cgit v1.2.3