diff options
author | Steven Le Rouzic <steven.lerouzic@gmail.com> | 2025-03-14 18:53:39 +0100 |
---|---|---|
committer | Steven Le Rouzic <steven.lerouzic@gmail.com> | 2025-03-14 18:56:58 +0100 |
commit | d1bb5a83f6dc697ff0f506374b42ba32f6db89a1 (patch) | |
tree | 07d0138926dd950ab5452275079d9c53ae00c173 /asl/containers/buffer.hpp | |
parent | 4630cb5237aea7749ac9938c738146c798e305cb (diff) |
Use inheritance for string implementation
Diffstat (limited to 'asl/containers/buffer.hpp')
-rw-r--r-- | asl/containers/buffer.hpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/asl/containers/buffer.hpp b/asl/containers/buffer.hpp index bb32f89..c3d865f 100644 --- a/asl/containers/buffer.hpp +++ b/asl/containers/buffer.hpp @@ -390,14 +390,18 @@ public: auto data(this auto&& self) { using return_type = un_ref_t<copy_cref_t<decltype(self), T>>*; + // NOLINTNEXTLINE(*-reinterpret-cast) + auto&& buffer = reinterpret_cast<copy_cref_t<decltype(self), class buffer>>(self); if constexpr (kInlineCapacity == 0) { - return return_type{ self.m_data }; + return return_type{ buffer.m_data }; } else { - // NOLINTNEXTLINE(*-reinterpret-cast) - return self.is_on_heap() ? return_type{ self.m_data } : reinterpret_cast<return_type>(&self); + return buffer.is_on_heap() + ? return_type{ buffer.m_data } + // NOLINTNEXTLINE(*-reinterpret-cast) + : reinterpret_cast<return_type>(&buffer); } } |