WIP: concepts rework
This commit is contained in:
parent
fa431d5be7
commit
a436935d89
@ -244,7 +244,7 @@ namespace meta {
|
||||
//! @{
|
||||
namespace front_impl {
|
||||
template <typename L>
|
||||
struct front_ { };
|
||||
struct front_ { using type = nil_; };
|
||||
|
||||
template <typename Head, typename... Tail>
|
||||
struct front_<typelist<Head, Tail...>> {
|
||||
@ -636,7 +636,7 @@ namespace meta {
|
||||
|
||||
/*!
|
||||
* Search for the first \c Item on the \c List for which the predicate \c Pred
|
||||
* returns true_ when `eval<invoke<Pred, Item>>`
|
||||
* yields to \c true_ when `eval<invoke<Pred, Item>>`
|
||||
*
|
||||
* Complexity \f$ O(N) \f$
|
||||
*
|
||||
@ -684,7 +684,7 @@ namespace meta {
|
||||
|
||||
/*!
|
||||
* Search for the first \c Item on the \c List for which the predicate \c Pred
|
||||
* returns true_ when `eval<invoke<Pred, Item>>` and return the rest of the \c List
|
||||
* yields to \c true_ when `eval<invoke<Pred, Item>>` and return the rest of the \c List
|
||||
* starting from that position as new typelist
|
||||
*
|
||||
* Complexity \f$ O(N) \f$
|
||||
@ -705,8 +705,21 @@ namespace meta {
|
||||
using seek = seek_if <List, same_as<T>>;
|
||||
//! @}
|
||||
|
||||
//! \name first_if
|
||||
//! @{
|
||||
/*!
|
||||
* Search and returns the first \c Item on the \c List for which the predicate \c Pred
|
||||
* yields to true_ when \code eval<invoke<Pred, Item>> \endcode
|
||||
*
|
||||
* Complexity \f$ O(N) \f$
|
||||
*
|
||||
* \tparam List A typelist
|
||||
* \tparam Pred A Unary invocable predicate
|
||||
* \return On success the item, otherwise utl::meta::nil_
|
||||
*/
|
||||
template <typename List, typename Pred>
|
||||
using first_if = front<seek_if<List, Pred>>;
|
||||
//! @}
|
||||
|
||||
//! \name count_if
|
||||
//! @{
|
||||
@ -783,8 +796,8 @@ namespace meta {
|
||||
}
|
||||
|
||||
/*!
|
||||
* Return a new typelist with elements, the elements of \c List that satisfy the
|
||||
* invocable \c Pred such that `eval<invoke<Pred, Item>>` is \c true_
|
||||
* Returns a new typelist with elements, the elements of \c List that satisfy the
|
||||
* invocable \c Pred such that `eval<invoke<Pred, Item>>` yields to \c true_
|
||||
*
|
||||
* Complexity \f$ O(N) \f$
|
||||
*
|
||||
|
@ -174,7 +174,9 @@ namespace TmetaTypelist {
|
||||
EXPECT_EQ (true, (std::is_same<long, at<l, int_<3>>>()));
|
||||
|
||||
EXPECT_EQ (true, (std::is_same<char*, front<l>>()));
|
||||
EXPECT_EQ (true, (std::is_same<nil_, front<typelist<>>>()));
|
||||
EXPECT_EQ (true, (std::is_same<short, back<l>>()));
|
||||
EXPECT_EQ (true, (std::is_same<nil_, back<typelist<>>>()));
|
||||
}
|
||||
|
||||
TEST(TmetaTypelist, Concat) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user