diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh index 41c624f78..0df6e545b 100644 --- a/src/hb-ot-layout-gsubgpos.hh +++ b/src/hb-ot-layout-gsubgpos.hh @@ -706,10 +706,11 @@ static inline bool intersects_array (const hb_set_t *glyphs, intersects_func_t intersects_func, const void *intersects_data) { - for (auto it = hb_iter (values, count); it; ++it) - if (likely (!intersects_func (glyphs, *it, intersects_data))) - return false; - return true; + return + + hb_iter (values, count) + | hb_map ([&] (const HBUINT16 &_) -> bool { return intersects_func (glyphs, _, intersects_data); }) + | hb_any + ; } @@ -734,8 +735,10 @@ static inline void collect_array (hb_collect_glyphs_context_t *c HB_UNUSED, collect_glyphs_func_t collect_func, const void *collect_data) { - for (auto it = hb_iter (values, count); it; ++it) - collect_func (glyphs, *it, collect_data); + return + + hb_iter (values, count) + | hb_apply ([&] (const HBUINT16 &_) { collect_func (glyphs, _, collect_data); }) + ; } @@ -1366,43 +1369,51 @@ struct RuleSet bool intersects (const hb_set_t *glyphs, ContextClosureLookupContext &lookup_context) const { - for (auto it = hb_iter (rule); it; ++it) - if ((this+*it).intersects (glyphs, lookup_context)) - return true; - return false; + return + + hb_iter (rule) + | hb_map ([&] (const OffsetTo &_) -> bool { return (this+_).intersects (glyphs, lookup_context); }) + | hb_any + ; } void closure (hb_closure_context_t *c, ContextClosureLookupContext &lookup_context) const { - for (auto it = hb_iter (rule); it; ++it) - (this+*it).closure (c, lookup_context); + return + + hb_iter (rule) + | hb_apply ([&] (const OffsetTo &_) { (this+_).closure (c, lookup_context); }) + ; } void collect_glyphs (hb_collect_glyphs_context_t *c, ContextCollectGlyphsLookupContext &lookup_context) const { - for (auto it = hb_iter (rule); it; ++it) - (this+*it).collect_glyphs (c, lookup_context); + return + + hb_iter (rule) + | hb_apply ([&] (const OffsetTo &_) { (this+_).collect_glyphs (c, lookup_context); }) + ; } bool would_apply (hb_would_apply_context_t *c, ContextApplyLookupContext &lookup_context) const { - for (auto it = hb_iter (rule); it; ++it) - if ((this+*it).would_apply (c, lookup_context)) - return true; - return false; + return + + hb_iter (rule) + | hb_map ([&] (const OffsetTo &_) -> bool { return (this+_).would_apply (c, lookup_context); }) + | hb_any + ; } bool apply (hb_ot_apply_context_t *c, ContextApplyLookupContext &lookup_context) const { TRACE_APPLY (this); - for (auto it = hb_iter (rule); it; ++it) - if ((this+*it).apply (c, lookup_context)) - return_trace (true); - return_trace (false); + return_trace ( + + hb_iter (rule) + | hb_map ([&] (const OffsetTo &_) -> bool { return (this+_).apply (c, lookup_context); }) + | hb_any + ) + ; } bool sanitize (hb_sanitize_context_t *c) const