diff options
Diffstat (limited to 'include/fud_string_view.hpp')
-rw-r--r-- | include/fud_string_view.hpp | 11 |
1 files changed, 10 insertions, 1 deletions
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<const utf8*>(input)}; } + [[nodiscard]] std::string_view as_string_view() const { + // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast) + return std::string_view{reinterpret_cast<const char*>(m_data), m_length}; + } + [[nodiscard]] constexpr Span<const utf8> asSpan() const { return Span<const utf8>{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<std::strong_ordering, FudStatus> compare(const StringView& rhs); }; } // namespace fud |