[iter] Change operator[] operand to be signed

To fix older compilers again (this was the case in hb_array_t).

hb-ot-layout-common.hh:1353: note: candidate 2: operator[](T*, int) <built-in>
hb-ot-layout-common.hh:1354: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
hb-iter.hh:63: note: candidate 1: Item& hb_iter_t<Iter, Item>::operator[](unsigned int) const [with Iter = hb_array_t<const OT::IntType<short unsigned int, 2u> >, Item = const OT::IntType<short unsigned int, 2u>]
hb-ot-layout-common.hh:1354: note: candidate 2: operator[](T*, int) <built-in>
hb-ot-layout-common.hh: In member function 'bool OT::ClassDef::serialize(hb_serialize_context_t*, hb_array_t<const OT::IntType<short unsigned int, 2u> >, hb_array_t<const OT::IntType<short unsigned int, 2u> >)':
hb-ot-layout-common.hh:1490: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
hb-iter.hh:63: note: candidate 1: Item& hb_iter_t<Iter, Item>::operator[](unsigned int) const [with Iter = hb_array_t<const OT::IntType<short unsigned int, 2u> >, Item = const OT::IntType<short unsigned int, 2u>]
hb-ot-layout-common.hh:1490: note: candidate 2: operator[](T*, int) <built-in>
This commit is contained in:
Behdad Esfahbod 2018-12-21 19:48:21 -05:00
parent 25786f49c1
commit b205105c9e
1 changed files with 1 additions and 1 deletions

View File

@ -60,7 +60,7 @@ struct hb_iter_t
operator iter_t () { return iter(); }
explicit_operator bool () const { return more (); }
item_t& operator * () const { return item (); }
item_t& operator [] (unsigned i) const { return item_at (i); }
item_t& operator [] (signed i) const { return item_at ((unsigned) i); }
iter_t& operator += (unsigned count) { forward (count); return *thiz(); }
iter_t& operator ++ () { next (); return *thiz(); }
iter_t& operator -= (unsigned count) { rewind (count); return *thiz(); }