From 5946e945d515bed8579caaac7fb79ee540fb22e8 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 15 Jan 2022 18:00:18 -0700 Subject: [PATCH] [vector] Destruct in pop() --- src/hb-vector.hh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/hb-vector.hh b/src/hb-vector.hh index 636e125c5..11a9f5a41 100644 --- a/src/hb-vector.hh +++ b/src/hb-vector.hh @@ -325,8 +325,10 @@ struct hb_vector_t Type pop () { if (!length) return Null (Type); - return std::move (arrayZ[--length]); /* Does this move actually work? */ - // XXX Destruct? + Type v = std::move (arrayZ[length - 1]); + arrayZ[length - 1].~Type (); + length--; + return v; } void remove (unsigned int i)