From 449910d43118b6f935fa1231531cc16c072cd455 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 1 Jan 2023 19:27:10 -0700 Subject: [PATCH] [vector] Allocate exact size in constructor --- src/hb-vector.hh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hb-vector.hh b/src/hb-vector.hh index 46efb9705..708fd48f9 100644 --- a/src/hb-vector.hh +++ b/src/hb-vector.hh @@ -45,7 +45,7 @@ struct hb_vector_t hb_vector_t () = default; hb_vector_t (std::initializer_list lst) : hb_vector_t () { - alloc (lst.size ()); + alloc (lst.size (), true); for (auto&& item : lst) push (item); } @@ -55,12 +55,12 @@ struct hb_vector_t { auto iter = hb_iter (o); if (iter.is_random_access_iterator) - alloc (hb_len (iter)); + alloc (hb_len (iter), true); hb_copy (iter, *this); } hb_vector_t (const hb_vector_t &o) : hb_vector_t () { - alloc (o.length); + alloc (o.length, true); if (unlikely (in_error ())) return; copy_vector (o); }