[vector] Save a couple hb_iter() invocations

This commit is contained in:
Behdad Esfahbod 2022-11-18 16:46:01 -07:00
parent 3ead9863d2
commit afd9a58bd7
1 changed files with 4 additions and 3 deletions

View File

@ -53,9 +53,10 @@ struct hb_vector_t
hb_requires (hb_is_iterable (Iterable))>
hb_vector_t (const Iterable &o) : hb_vector_t ()
{
if (hb_iter (o).is_random_access_iterator)
alloc (hb_len (hb_iter (o)));
hb_copy (o, *this);
auto iter = hb_iter (o);
if (iter.is_random_access_iterator)
alloc (hb_len (iter));
hb_copy (iter, *this);
}
hb_vector_t (const hb_vector_t &o) : hb_vector_t ()
{