diff --git a/src/hb-iter.hh b/src/hb-iter.hh index 61e05180b..04d09940a 100644 --- a/src/hb-iter.hh +++ b/src/hb-iter.hh @@ -324,6 +324,16 @@ struct hb_is_sink_of (hb_is_source_of(Iter, Item) && Iter::is_sorted_iterator) +struct +{ + template + unsigned operator () (const Iterable &_) const { return hb_len (hb_iter (_)); } + + unsigned operator () (unsigned _) const { return _; } +} +HB_FUNCOBJ (hb_len_of); + /* Range-based 'for' for iterables. */ template struct CFFIndex { - struct length_f_t - { - template - unsigned operator () (const Iterable &_) const { return hb_len (hb_iter (_)); } - - unsigned operator () (unsigned _) const { return _; } - } - HB_FUNCOBJ (length_f); - unsigned int offset_array_size () const { return offSize * (count + 1); } @@ -1325,7 +1315,7 @@ struct CFFIndex for (const auto &_ : +it) { set_offset_at (i++, offset); - offset += length_f (_); + offset += hb_len_of (_); } set_offset_at (i, offset); } @@ -1338,7 +1328,7 @@ struct CFFIndex for (const auto &_ : +it) { *p++ = offset; - offset += length_f (_); + offset += hb_len_of (_); } *p = offset; } @@ -1349,7 +1339,7 @@ struct CFFIndex for (const auto &_ : +it) { *p++ = offset; - offset += length_f (_); + offset += hb_len_of (_); } *p = offset; } @@ -1360,7 +1350,7 @@ struct CFFIndex for (const auto &_ : +it) { *p++ = offset; - offset += length_f (_); + offset += hb_len_of (_); } *p = offset; } @@ -1371,7 +1361,7 @@ struct CFFIndex for (const auto &_ : +it) { *p++ = offset; - offset += length_f (_); + offset += hb_len_of (_); } *p = offset; } @@ -1397,7 +1387,7 @@ struct CFFIndex unsigned total = 0; for (const auto &_ : +it) - total += length_f (_); + total += hb_len_of (_); if (data_size) *data_size = total;