diff --git a/deps/ox/src/ox/std/vector.hpp b/deps/ox/src/ox/std/vector.hpp index 6ab8005ec..a9317889f 100644 --- a/deps/ox/src/ox/std/vector.hpp +++ b/deps/ox/src/ox/std/vector.hpp @@ -633,7 +633,8 @@ constexpr Error Vector::unordered_erase(std::size_t pos) { template constexpr void Vector::expandCap(std::size_t cap) { - auto oldItems = m_items; + const auto oldItems = m_items; + const auto oldCap = m_cap; m_cap = cap; this->allocate(&m_items, cap); if (oldItems) { // move over old items @@ -641,7 +642,7 @@ constexpr void Vector::expandCap(std::size_t cap) { for (std::size_t i = 0; i < itRange; ++i) { new (&m_items[i]) T(std::move(oldItems[i])); } - this->deallocate(oldItems, m_cap); + this->deallocate(oldItems, oldCap); } }