struct
{
template <typename Iterable,
- typename Val = bool,
+ typename Pred = decltype ((hb_bool)),
typename Proj = decltype ((hb_identity)),
hb_requires (hb_is_iterable (Iterable))>
bool operator () (Iterable&& c,
- Val v = true,
+ Pred&& p = hb_bool,
Proj&& f = hb_identity) const
{
for (auto it = hb_iter (c); it; ++it)
- if (!((Val) hb_get (hb_forward<Proj> (f), *it) == v))
+ if (!hb_match (hb_forward<Pred> (p), hb_get (hb_forward<Proj> (f), *it)))
return false;
return true;
}
struct
{
template <typename Iterable,
- typename Val = bool,
+ typename Pred = decltype ((hb_bool)),
typename Proj = decltype ((hb_identity)),
hb_requires (hb_is_iterable (Iterable))>
bool operator () (Iterable&& c,
- Val v = true,
+ Pred&& p = hb_bool,
Proj&& f = hb_identity) const
{
for (auto it = hb_iter (c); it; ++it)
- if (((Val) hb_get (hb_forward<Proj> (f), *it) == v))
+ if (hb_match (hb_forward<Pred> (p), hb_get (hb_forward<Proj> (f), *it)))
return true;
return false;
}
struct
{
template <typename Iterable,
- typename Val = bool,
+ typename Pred = decltype ((hb_bool)),
typename Proj = decltype ((hb_identity)),
hb_requires (hb_is_iterable (Iterable))>
bool operator () (Iterable&& c,
- Val v = true,
+ Pred&& p = hb_bool,
Proj&& f = hb_identity) const
{
for (auto it = hb_iter (c); it; ++it)
- if (((Val) hb_get (hb_forward<Proj> (f), *it) == v))
+ if (hb_match (hb_forward<Pred> (p), hb_get (hb_forward<Proj> (f), *it)))
return false;
return true;
}
assert (true == hb_all (st));
assert (false == hb_all (st, 42u));
assert (true == hb_any (st));
- assert (false == hb_any (st, 14));
- assert (true == hb_any (st, 15));
+ assert (false == hb_any (st, 14u));
+ assert (true == hb_any (st, 14u, [] (unsigned _) { return _ - 1u; }));
+ assert (true == hb_any (st, [] (unsigned _) { return _ == 15u; }));
+ assert (true == hb_any (st, 15u));
assert (false == hb_none (st));
- assert (false == hb_none (st, 15));
- assert (true == hb_none (st, 17));
+ assert (false == hb_none (st, 15u));
+ assert (true == hb_none (st, 17u));
hb_array_t<hb_vector_t<int>> pa;
pa->as_array ();