From bc8eded2963376901be02f9d0f563c980b0a67b0 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 18 Nov 2022 16:51:24 -0700 Subject: [PATCH] [vector] Remove a for loop --- src/hb-vector.hh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hb-vector.hh b/src/hb-vector.hh index 27eca0480..31a63513d 100644 --- a/src/hb-vector.hh +++ b/src/hb-vector.hh @@ -232,9 +232,10 @@ struct hb_vector_t if (likely (new_array)) { for (unsigned i = 0; i < length; i++) + { new (std::addressof (new_array[i])) Type (); - for (unsigned i = 0; i < (unsigned) length; i++) new_array[i] = std::move (arrayZ[i]); + } unsigned old_length = length; shrink_vector (0); length = old_length;