Use implicit lambda return type

This commit is contained in:
Behdad Esfahbod 2019-05-15 00:32:41 -07:00
parent 57f65ae935
commit d0df996cdc
7 changed files with 22 additions and 23 deletions

View File

@ -319,7 +319,7 @@ bool hb_array_t<T>::operator == (const hb_array_t<T> &o) const
{
return length == o.length &&
+ hb_zip (*this, o)
| hb_map ([] (hb_pair_t<T&, T&> &&_) -> bool { return _.first == _.second; })
| hb_map ([] (hb_pair_t<T&, T&> &&_) { return _.first == _.second; })
| hb_all
;
}
@ -329,7 +329,7 @@ uint32_t hb_array_t<T>::hash () const
return
+ hb_iter (*this)
| hb_map (hb_hash)
| hb_reduce ([] (uint32_t a, uint32_t b) -> uint32_t { return a * 31 + b; }, 0)
| hb_reduce ([] (uint32_t a, uint32_t b) { return a * 31 + b; }, 0)
;
}

View File

@ -48,7 +48,7 @@ struct SingleSubstFormat1
{
+ hb_iter (this+coverage)
| hb_filter (*c->glyphs)
| hb_map ([&] (hb_codepoint_t g) -> hb_codepoint_t { return (g + deltaGlyphID) & 0xFFFFu; })
| hb_map ([&] (hb_codepoint_t g) { return (g + deltaGlyphID) & 0xFFFFu; })
| hb_sink (c->output)
;
}
@ -58,7 +58,7 @@ struct SingleSubstFormat1
if (unlikely (!(this+coverage).add_coverage (c->input))) return;
+ hb_iter (this+coverage)
| hb_map ([&] (hb_codepoint_t g) -> hb_codepoint_t { return (g + deltaGlyphID) & 0xFFFFu; })
| hb_map ([&] (hb_codepoint_t g) { return (g + deltaGlyphID) & 0xFFFFu; })
| hb_sink (c->output)
;
}
@ -741,7 +741,7 @@ struct LigatureSet
{
return
+ hb_iter (ligature)
| hb_map ([&] (const OffsetTo<Ligature> &_) -> bool { return (this+_).intersects (glyphs); })
| hb_map ([&] (const OffsetTo<Ligature> &_) { return (this+_).intersects (glyphs); })
| hb_any
;
}
@ -764,7 +764,7 @@ struct LigatureSet
{
return
+ hb_iter (ligature)
| hb_map ([&] (const OffsetTo<Ligature> &_) -> bool { return (this+_).would_apply (c); })
| hb_map ([&] (const OffsetTo<Ligature> &_) { return (this+_).would_apply (c); })
| hb_any
;
}

View File

@ -708,7 +708,7 @@ static inline bool intersects_array (const hb_set_t *glyphs,
{
return
+ hb_iter (values, count)
| hb_map ([&] (const HBUINT16 &_) -> bool { return intersects_func (glyphs, _, intersects_data); })
| hb_map ([&] (const HBUINT16 &_) { return intersects_func (glyphs, _, intersects_data); })
| hb_any
;
}
@ -1371,7 +1371,7 @@ struct RuleSet
{
return
+ hb_iter (rule)
| hb_map ([&] (const OffsetTo<Rule> &_) -> bool { return (this+_).intersects (glyphs, lookup_context); })
| hb_map ([&] (const OffsetTo<Rule> &_) { return (this+_).intersects (glyphs, lookup_context); })
| hb_any
;
}
@ -1399,7 +1399,7 @@ struct RuleSet
{
return
+ hb_iter (rule)
| hb_map ([&] (const OffsetTo<Rule> &_) -> bool { return (this+_).would_apply (c, lookup_context); })
| hb_map ([&] (const OffsetTo<Rule> &_) { return (this+_).would_apply (c, lookup_context); })
| hb_any
;
}
@ -1410,7 +1410,7 @@ struct RuleSet
TRACE_APPLY (this);
return_trace (
+ hb_iter (rule)
| hb_map ([&] (const OffsetTo<Rule> &_) -> bool { return (this+_).apply (c, lookup_context); })
| hb_map ([&] (const OffsetTo<Rule> &_) { return (this+_).apply (c, lookup_context); })
| hb_any
)
;
@ -1444,7 +1444,7 @@ struct ContextFormat1
+ hb_zip (this+coverage, ruleSet)
| hb_filter (*glyphs, hb_first)
| hb_map (hb_second)
| hb_map ([&] (const OffsetTo<RuleSet> &_) -> bool { return (this+_).intersects (glyphs, lookup_context); })
| hb_map ([&] (const OffsetTo<RuleSet> &_) { return (this+_).intersects (glyphs, lookup_context); })
| hb_any
;
}
@ -2022,7 +2022,7 @@ struct ChainRuleSet
{
return
+ hb_iter (rule)
| hb_map ([&] (const OffsetTo<ChainRule> &_) -> bool { return (this+_).intersects (glyphs, lookup_context); })
| hb_map ([&] (const OffsetTo<ChainRule> &_) { return (this+_).intersects (glyphs, lookup_context); })
| hb_any
;
}
@ -2046,7 +2046,7 @@ struct ChainRuleSet
{
return
+ hb_iter (rule)
| hb_map ([&] (const OffsetTo<ChainRule> &_) -> bool { return (this+_).would_apply (c, lookup_context); })
| hb_map ([&] (const OffsetTo<ChainRule> &_) { return (this+_).would_apply (c, lookup_context); })
| hb_any
;
}
@ -2056,7 +2056,7 @@ struct ChainRuleSet
TRACE_APPLY (this);
return_trace (
+ hb_iter (rule)
| hb_map ([&] (const OffsetTo<ChainRule> &_) -> bool { return (this+_).apply (c, lookup_context); })
| hb_map ([&] (const OffsetTo<ChainRule> &_) { return (this+_).apply (c, lookup_context); })
| hb_any
)
;
@ -2089,7 +2089,7 @@ struct ChainContextFormat1
+ hb_zip (this+coverage, ruleSet)
| hb_filter (*glyphs, hb_first)
| hb_map (hb_second)
| hb_map ([&] (const OffsetTo<ChainRuleSet> &_) -> bool { return (this+_).intersects (glyphs, lookup_context); })
| hb_map ([&] (const OffsetTo<ChainRuleSet> &_) { return (this+_).intersects (glyphs, lookup_context); })
| hb_any
;
}

View File

@ -289,7 +289,7 @@ struct STAT
;
+ get_axis_value_offsets ()
| hb_map ([&] (const OffsetTo<AxisValue>& _) -> const AxisValue* { return hb_addressof (this + _); })
| hb_map ([&] (const OffsetTo<AxisValue>& _) { return hb_addressof (this + _); })
| hb_map (&AxisValue::get_value_name_id)
| hb_sink (nameids_to_retain)
;

View File

@ -290,12 +290,12 @@ struct fvar
;
+ hb_range ((unsigned) instanceCount)
| hb_map ([&] (const unsigned _) -> unsigned { return get_instance_subfamily_name_id (_); })
| hb_map ([&] (const unsigned _) { return get_instance_subfamily_name_id (_); })
| hb_sink (nameids)
;
+ hb_range ((unsigned) instanceCount)
| hb_map ([&] (const unsigned _) -> unsigned { return get_instance_postscript_name_id (_); })
| hb_map ([&] (const unsigned _) { return get_instance_postscript_name_id (_); })
| hb_sink (nameids)
;
}

View File

@ -203,8 +203,8 @@ main (int argc, char **argv)
;
+ hb_iter (src)
| hb_map ([&] (int i) -> int { return 1; })
| hb_reduce ([&] (int acc, int value) -> int { return acc; }, 2)
| hb_map ([&] (int i) { return 1; })
| hb_reduce ([&] (int acc, int value) { return acc; }, 2)
;
using map_pair_t = hb_item_type<hb_map_t>;
@ -251,8 +251,8 @@ main (int argc, char **argv)
unsigned int temp3 = 0;
+ hb_iter(src)
| hb_map([&] (int i) -> int { return ++temp3; })
| hb_reduce([&] (float acc, int value) -> float { return acc + value; }, 0)
| hb_map([&] (int i) { return ++temp3; })
| hb_reduce([&] (float acc, int value) { return acc + value; }, 0)
;
hb_map_destroy (result);

View File

@ -32,7 +32,6 @@
int
main (int argc, char **argv)
{
static_assert (hb_is_convertible (void, void), "");
static_assert (hb_is_convertible (void, const void), "");
static_assert (hb_is_convertible (const void, void), "");