diff options
author | Adrian Kummerlaender | 2015-02-18 22:37:39 +0100 |
---|---|---|
committer | Adrian Kummerlaender | 2015-02-18 22:37:39 +0100 |
commit | 9bb66d9c1d8a7bf5bf02f5a7c400894e928d2a95 (patch) | |
tree | 04aea86c016401047d5ea134fdf878b83f2ad0d6 /src | |
parent | a3cfc224111c324324e29a9a7a61b511053ec14c (diff) | |
download | TypeAsValue-9bb66d9c1d8a7bf5bf02f5a7c400894e928d2a95.tar TypeAsValue-9bb66d9c1d8a7bf5bf02f5a7c400894e928d2a95.tar.gz TypeAsValue-9bb66d9c1d8a7bf5bf02f5a7c400894e928d2a95.tar.bz2 TypeAsValue-9bb66d9c1d8a7bf5bf02f5a7c400894e928d2a95.tar.lz TypeAsValue-9bb66d9c1d8a7bf5bf02f5a7c400894e928d2a95.tar.xz TypeAsValue-9bb66d9c1d8a7bf5bf02f5a7c400894e928d2a95.tar.zst TypeAsValue-9bb66d9c1d8a7bf5bf02f5a7c400894e928d2a95.zip |
Changed `ListIndex` to return false if no index is found
* analogously to `list-index` and `find` in SRFI-1
Diffstat (limited to 'src')
-rw-r--r-- | src/list/operation/higher/drop_while.h | 2 | ||||
-rw-r--r-- | src/list/operation/higher/list_index.h | 2 | ||||
-rw-r--r-- | src/list/operation/higher/take_while.h | 2 | ||||
-rw-r--r-- | src/type.h | 6 |
4 files changed, 9 insertions, 3 deletions
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<std::is_void>::template function, + IsSize, Length<List> >::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<Predicate, void, Index> { - typedef void type; + typedef Boolean<false> 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<std::is_void>::template function, + IsSize, Length<List> >::template assure< ListIndex< @@ -38,6 +38,12 @@ using IsEqualValue = Boolean<X::value == Y::value>; template <typename X> using IsTrue = IsEqualValue<X, Boolean<true>>; +template <typename X> +using IsBoolean = Eval<std::is_same<typename X::value_type, bool>>; + +template <typename X> +using IsSize = Eval<std::is_same<typename X::value_type, std::size_t>>; + } #endif // TYPEASVALUE_SRC_TYPE_H_ |