diff --git a/libluna/include/luna/Vector.h b/libluna/include/luna/Vector.h index edee5bbc..27c12aac 100644 --- a/libluna/include/luna/Vector.h +++ b/libluna/include/luna/Vector.h @@ -65,13 +65,11 @@ template class Vector ~Vector() { - if (m_data) { - for(const T& item : *this) - { - item.~T(); - } + if (m_data) + { + for (const T& item : *this) { item.~T(); } free_impl(m_data); - } + } } Result try_reserve(usize capacity) @@ -115,10 +113,10 @@ template class Vector T item = move(m_data[0]); - memmove(m_data, m_data + 1, m_size - 1); - m_size--; + memmove(m_data, m_data + 1, m_size * sizeof(T)); + return move(item); }