From 0b400af9519444deef4cc6ad2c43c30e2092ab4f Mon Sep 17 00:00:00 2001 From: Dominick Allen Date: Sat, 4 Jan 2025 09:56:12 -0600 Subject: Fix bug related to string copying. --- include/fud_string_view.hpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'include/fud_string_view.hpp') diff --git a/include/fud_string_view.hpp b/include/fud_string_view.hpp index c3bc0a1..d8f67ba 100644 --- a/include/fud_string_view.hpp +++ b/include/fud_string_view.hpp @@ -84,6 +84,11 @@ struct StringView { return StringView{N - 1, reinterpret_cast(input)}; } + [[nodiscard]] std::string_view as_string_view() const { + // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast) + return std::string_view{reinterpret_cast(m_data), m_length}; + } + [[nodiscard]] constexpr Span asSpan() const { return Span{m_data, m_length}; @@ -144,7 +149,11 @@ struct StringView { const utf8* m_data{nullptr}; - auto operator<=>(const StringView& rhs) const noexcept = default; + // auto operator<=>(const StringView& rhs) const noexcept = default; + auto operator<=>(const StringView& rhs) const noexcept; + bool operator==(const StringView& rhs) const noexcept; + + Result compare(const StringView& rhs); }; } // namespace fud -- cgit v1.2.3