From e241c70aad3d45d53aecd85f40c6145c95b28f37 Mon Sep 17 00:00:00 2001 From: apio Date: Sat, 1 Apr 2023 08:56:21 +0000 Subject: [PATCH] Vector: Call destructors on deallocation I hate the Gitea web editor on a phone. --- libluna/include/luna/Vector.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libluna/include/luna/Vector.h b/libluna/include/luna/Vector.h index 29b288bf..edee5bbc 100644 --- a/libluna/include/luna/Vector.h +++ b/libluna/include/luna/Vector.h @@ -65,7 +65,13 @@ template class Vector ~Vector() { - if (m_data) free_impl(m_data); + if (m_data) { + for(const T& item : *this) + { + item.~T(); + } + free_impl(m_data); + } } Result try_reserve(usize capacity)