From d1bb5a83f6dc697ff0f506374b42ba32f6db89a1 Mon Sep 17 00:00:00 2001 From: Steven Le Rouzic Date: Fri, 14 Mar 2025 18:53:39 +0100 Subject: Use inheritance for string implementation --- asl/containers/buffer.hpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'asl/containers/buffer.hpp') 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>*; + // NOLINTNEXTLINE(*-reinterpret-cast) + auto&& buffer = reinterpret_cast>(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(&self); + return buffer.is_on_heap() + ? return_type{ buffer.m_data } + // NOLINTNEXTLINE(*-reinterpret-cast) + : reinterpret_cast(&buffer); } } -- cgit