diff --git a/deps/ox/src/ox/std/vector.hpp b/deps/ox/src/ox/std/vector.hpp index b8d35326..d81776b6 100644 --- a/deps/ox/src/ox/std/vector.hpp +++ b/deps/ox/src/ox/std/vector.hpp @@ -450,7 +450,7 @@ constexpr Vector &Vector::operator=(cons m_cap = other.m_cap; this->allocate(&m_items, other.m_cap); for (std::size_t i = 0; i < m_size; i++) { - m_items[i] = other.m_items[i]; + new (&m_items[i]) T(other.m_items[i]); } } return *this; @@ -618,6 +618,7 @@ constexpr Result::template iterator<>> Vecto for (auto i = pos; i < m_size; ++i) { m_items[i] = std::move(m_items[i + 1]); } + m_items[m_size].~T(); return begin() + pos; } @@ -628,6 +629,7 @@ constexpr Error Vector::unordered_erase(std::size_t pos) { } --m_size; m_items[pos] = std::move(m_items[m_size]); + m_items[m_size].~T(); return OxError(0); } @@ -641,6 +643,7 @@ constexpr void Vector::expandCap(std::size_t cap) { const auto itRange = ox::min(cap, m_size); for (std::size_t i = 0; i < itRange; ++i) { new (&m_items[i]) T(std::move(oldItems[i])); + oldItems[i].~T(); } this->deallocate(oldItems, oldCap); }