[subset] Take iterator in ArrayOf serialize

Still not satisfied with how I can enforce iterators only, but
seems to work for now.
This commit is contained in:
Behdad Esfahbod 2018-12-26 22:50:33 -05:00
parent e16884248f
commit 49161d411f
1 changed files with 7 additions and 5 deletions

View File

@ -556,13 +556,15 @@ struct ArrayOf
if (unlikely (!c->extend (*this))) return_trace (false);
return_trace (true);
}
template <typename T>
bool serialize (hb_serialize_context_t *c, hb_array_t<const T> items)
template <typename Iter>
bool serialize (hb_serialize_context_t *c, const hb_iter_t<Iter>& items)
{
TRACE_SERIALIZE (this);
if (unlikely (!serialize (c, items.length))) return_trace (false);
for (unsigned int i = 0; i < items.length; i++)
hb_assign (arrayZ[i], items[i]);
unsigned count = items.len ();
if (unlikely (!serialize (c, count))) return_trace (false);
auto iter = items.iter ();
for (unsigned i = 0; i < count; i++, iter++)
hb_assign (arrayZ[i], *iter);
return_trace (true);
}