diff --git a/deps/ox/src/ox/std/vector.hpp b/deps/ox/src/ox/std/vector.hpp index 734996e4..dd48a17c 100644 --- a/deps/ox/src/ox/std/vector.hpp +++ b/deps/ox/src/ox/std/vector.hpp @@ -32,9 +32,9 @@ struct SmallVector { protected: constexpr void initItems(T **items, std::size_t cap) noexcept { if (cap <= Size) { - *items = bit_cast(m_data); + *items = std::bit_cast(m_data); } else { - *items = bit_cast(new AllocAlias[cap]); + *items = std::bit_cast(new AllocAlias[cap]); } } @@ -51,12 +51,12 @@ struct SmallVector { constexpr void moveItemsFrom(T **items, SmallVector &src, const std::size_t count, const std::size_t cap) noexcept { if (cap <= Size) { - const auto dstItems = bit_cast(m_data); - const auto srcItems = bit_cast(src.m_data); + const auto dstItems = std::bit_cast(m_data); + const auto srcItems = std::bit_cast(src.m_data); for (auto i = 0u; i < count; ++i) { dstItems[i] = move(srcItems[i]); } - *items = bit_cast(m_data); + *items = std::bit_cast(m_data); } } @@ -76,7 +76,7 @@ struct SmallVector { SmallVector(SmallVector&&) noexcept = default; protected: constexpr void initItems(T **items, std::size_t cap) noexcept { - *items = bit_cast(new AllocAlias[cap]); + *items = std::bit_cast(new AllocAlias[cap]); } [[maybe_unused]] @@ -382,7 +382,7 @@ Vector::Vector(Vector &&other) noexcept { template Vector::~Vector() { clear(); - this->clearItems(bit_cast*>(m_items)); + this->clearItems(std::bit_cast*>(m_items)); m_items = nullptr; } @@ -403,7 +403,7 @@ template constexpr Vector &Vector::operator=(const Vector &other) { if (this != &other) { clear(); - this->clearItems(bit_cast*>(m_items)); + this->clearItems(std::bit_cast*>(m_items)); m_items = nullptr; m_size = other.m_size; m_cap = other.m_cap; @@ -419,7 +419,7 @@ template constexpr Vector &Vector::operator=(Vector &&other) noexcept { if (this != &other) { clear(); - this->clearItems(bit_cast*>(m_items)); + this->clearItems(std::bit_cast*>(m_items)); m_size = other.m_size; m_cap = other.m_cap; m_items = other.m_items; @@ -445,7 +445,7 @@ template Result Vector::front() noexcept { if (!m_size) { AllocAlias v; - return {*bit_cast(&v), OxError(1)}; + return {*std::bit_cast(&v), OxError(1)}; } return m_items[0]; } @@ -454,7 +454,7 @@ template Result Vector::front() const noexcept { if (!m_size) { AllocAlias v; - return {*bit_cast(&v), OxError(1)}; + return {*std::bit_cast(&v), OxError(1)}; } return m_items[0]; } @@ -463,7 +463,7 @@ template Result Vector::back() noexcept { if (!m_size) { AllocAlias v; - return {*bit_cast(&v), OxError(1)}; + return {*std::bit_cast(&v), OxError(1)}; } return m_items[m_size - 1]; } @@ -472,7 +472,7 @@ template Result Vector::back() const noexcept { if (!m_size) { AllocAlias v; - return {*bit_cast(&v), OxError(1)}; + return {*std::bit_cast(&v), OxError(1)}; } return m_items[m_size - 1]; } @@ -601,7 +601,10 @@ void Vector::expandCap(std::size_t cap) { for (std::size_t i = 0; i < itRange; i++) { new (&m_items[i]) T(move(oldItems[i])); } - this->clearItems(bit_cast*>(oldItems)); + for (std::size_t i = itRange; i < m_cap; i++) { + new (&m_items[i]) T; + } + this->clearItems(std::bit_cast*>(oldItems)); } }