[iter] Default predicates to hb_identity instead of hb_bool

The bool conversion happens after predicate is called automatically.
This commit is contained in:
Behdad Esfahbod 2019-05-08 09:33:09 -07:00
parent fe14a4000a
commit 710d459aca
1 changed files with 8 additions and 8 deletions

View File

@ -405,10 +405,10 @@ struct hb_filter_iter_factory_t
}; };
struct struct
{ {
template <typename Pred = decltype ((hb_bool)), template <typename Pred = decltype ((hb_identity)),
typename Proj = decltype ((hb_identity))> typename Proj = decltype ((hb_identity))>
hb_filter_iter_factory_t<Pred, Proj> hb_filter_iter_factory_t<Pred, Proj>
operator () (Pred&& p = hb_bool, Proj&& f = hb_identity) const operator () (Pred&& p = hb_identity, Proj&& f = hb_identity) const
{ return hb_filter_iter_factory_t<Pred, Proj> (p, f); } { return hb_filter_iter_factory_t<Pred, Proj> (p, f); }
} }
HB_FUNCOBJ (hb_filter); HB_FUNCOBJ (hb_filter);
@ -649,11 +649,11 @@ HB_FUNCOBJ (hb_unzip);
struct struct
{ {
template <typename Iterable, template <typename Iterable,
typename Pred = decltype ((hb_bool)), typename Pred = decltype ((hb_identity)),
typename Proj = decltype ((hb_identity)), typename Proj = decltype ((hb_identity)),
hb_requires (hb_is_iterable (Iterable))> hb_requires (hb_is_iterable (Iterable))>
bool operator () (Iterable&& c, bool operator () (Iterable&& c,
Pred&& p = hb_bool, Pred&& p = hb_identity,
Proj&& f = hb_identity) const Proj&& f = hb_identity) const
{ {
for (auto it = hb_iter (c); it; ++it) for (auto it = hb_iter (c); it; ++it)
@ -666,11 +666,11 @@ HB_FUNCOBJ (hb_all);
struct struct
{ {
template <typename Iterable, template <typename Iterable,
typename Pred = decltype ((hb_bool)), typename Pred = decltype ((hb_identity)),
typename Proj = decltype ((hb_identity)), typename Proj = decltype ((hb_identity)),
hb_requires (hb_is_iterable (Iterable))> hb_requires (hb_is_iterable (Iterable))>
bool operator () (Iterable&& c, bool operator () (Iterable&& c,
Pred&& p = hb_bool, Pred&& p = hb_identity,
Proj&& f = hb_identity) const Proj&& f = hb_identity) const
{ {
for (auto it = hb_iter (c); it; ++it) for (auto it = hb_iter (c); it; ++it)
@ -683,11 +683,11 @@ HB_FUNCOBJ (hb_any);
struct struct
{ {
template <typename Iterable, template <typename Iterable,
typename Pred = decltype ((hb_bool)), typename Pred = decltype ((hb_identity)),
typename Proj = decltype ((hb_identity)), typename Proj = decltype ((hb_identity)),
hb_requires (hb_is_iterable (Iterable))> hb_requires (hb_is_iterable (Iterable))>
bool operator () (Iterable&& c, bool operator () (Iterable&& c,
Pred&& p = hb_bool, Pred&& p = hb_identity,
Proj&& f = hb_identity) const Proj&& f = hb_identity) const
{ {
for (auto it = hb_iter (c); it; ++it) for (auto it = hb_iter (c); it; ++it)