From afd9a58bd76032f98fa1daf579c780121ddcdfb6 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 18 Nov 2022 16:46:01 -0700 Subject: [PATCH] [vector] Save a couple hb_iter() invocations --- src/hb-vector.hh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/hb-vector.hh b/src/hb-vector.hh index 32adbf5cc..27eca0480 100644 --- a/src/hb-vector.hh +++ b/src/hb-vector.hh @@ -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 () {