diff --git a/deps/ox/src/ox/std/vector.hpp b/deps/ox/src/ox/std/vector.hpp index 9ccd9aba..364f6c86 100644 --- a/deps/ox/src/ox/std/vector.hpp +++ b/deps/ox/src/ox/std/vector.hpp @@ -52,13 +52,15 @@ struct VectorAllocator { const std::size_t cap) noexcept { // this totally idiotic redundant check (&& count <= Size) is required to address a bug in devkitARM, // try removing it later - if (cap <= m_data.size() && count <= m_data.size()) { - for (auto i = 0u; i < count; ++i) { - const auto dstItem = reinterpret_cast(&m_data[i]); - const auto srcItem = reinterpret_cast(&src->m_data[i]); - std::construct_at(dstItem, std::move(*srcItem)); + if (!std::is_constant_evaluated()) { + if (cap <= m_data.size() && count <= m_data.size()) { + for (auto i = 0u; i < count; ++i) { + const auto dstItem = reinterpret_cast(&m_data[i]); + const auto srcItem = reinterpret_cast(&src->m_data[i]); + std::construct_at(dstItem, std::move(*srcItem)); + } + *items = reinterpret_cast(m_data.data()); } - *items = reinterpret_cast(m_data.data()); } } @@ -69,20 +71,24 @@ struct VectorAllocator { const std::size_t cap) noexcept { // this totally idiotic redundant check (&& count <= Size) is required to address a bug in devkitARM, // try removing it later - if (cap <= m_data.size() && count <= m_data.size()) { - for (std::size_t i = 0; i < count; ++i) { - const auto dstItem = reinterpret_cast(&m_data[i]); - const auto srcItem = reinterpret_cast(&src->m_data[i]); - *dstItem = std::move(*srcItem); + if (!std::is_constant_evaluated()) { + if (cap <= m_data.size() && count <= m_data.size()) { + for (std::size_t i = 0; i < count; ++i) { + const auto dstItem = reinterpret_cast(&m_data[i]); + const auto srcItem = reinterpret_cast(&src->m_data[i]); + *dstItem = std::move(*srcItem); + } + *items = reinterpret_cast(m_data.data()); } - *items = reinterpret_cast(m_data.data()); } } constexpr void deallocate(T *items, std::size_t cap) noexcept { // small vector optimization cannot be done it constexpr, but it doesn't really matter in constexpr - if (std::is_constant_evaluated() || (items && static_cast(items) != static_cast(m_data.data()))) { - m_allocator.deallocate(items, cap); + if (std::is_constant_evaluated()) { + if (items && static_cast(items) != static_cast(m_data.data())) { + m_allocator.deallocate(items, cap); + } } }