diff options
Diffstat (limited to 'include/fud_vector.hpp')
-rw-r--r-- | include/fud_vector.hpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/include/fud_vector.hpp b/include/fud_vector.hpp index 9808a7d..1ba2abf 100644 --- a/include/fud_vector.hpp +++ b/include/fud_vector.hpp @@ -124,8 +124,7 @@ class Vector { } output.m_allocator = allocator; - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast) - output.m_data = reinterpret_cast<T*>(dataPtrResult.getOkay()); + output.m_data = std::bit_cast<T*>(dataPtrResult.getOkay()); output.m_length = 0; output.m_capacity = capacity; return FudStatus::Success; @@ -365,8 +364,7 @@ class Vector { return dataPtrResult.takeError(); } - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast) - auto* dataPtr = reinterpret_cast<T*>(dataPtrResult.takeOkay()); + auto* dataPtr = std::bit_cast<T*>(dataPtrResult.takeOkay()); for (size_t index = 0; index < m_length; ++index) { const auto* ptr = new (dataPtr + index) T(std::move(m_data[index])); fudAssert(ptr != nullptr); @@ -375,8 +373,7 @@ class Vector { auto status = FudStatus::Success; if (m_capacity > 0) { - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast) - m_allocator->deallocate(reinterpret_cast<std::byte*>(m_data), m_capacity * ElementSize); + m_allocator->deallocate(std::bit_cast<std::byte*>(m_data), m_capacity * ElementSize); } m_data = dataPtr; @@ -748,8 +745,7 @@ class Vector { auto status = clear(); if (m_data != nullptr && m_allocator != nullptr) { - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast) - m_allocator->deallocate(reinterpret_cast<std::byte*>(m_data), m_capacity * ElementSize); + m_allocator->deallocate(std::bit_cast<std::byte*>(m_data), m_capacity * ElementSize); } m_allocator = nullptr; |