diff --git a/src/hb-iter.hh b/src/hb-iter.hh index 192347dc0..6954d431b 100644 --- a/src/hb-iter.hh +++ b/src/hb-iter.hh @@ -649,15 +649,15 @@ HB_FUNCOBJ (hb_unzip); struct { template 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 (f), *it) == v)) + if (!hb_match (hb_forward (p), hb_get (hb_forward (f), *it))) return false; return true; } @@ -666,15 +666,15 @@ HB_FUNCOBJ (hb_all); struct { template 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 (f), *it) == v)) + if (hb_match (hb_forward (p), hb_get (hb_forward (f), *it))) return true; return false; } @@ -683,15 +683,15 @@ HB_FUNCOBJ (hb_any); struct { template 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 (f), *it) == v)) + if (hb_match (hb_forward (p), hb_get (hb_forward (f), *it))) return false; return true; } diff --git a/src/test-iter.cc b/src/test-iter.cc index 70952f3e2..17a1972b3 100644 --- a/src/test-iter.cc +++ b/src/test-iter.cc @@ -166,11 +166,13 @@ main (int argc, char **argv) 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> pa; pa->as_array ();