summaryrefslogtreecommitdiff
path: root/include/fud_string_view.hpp
diff options
context:
space:
mode:
authorDominick Allen <djallen@librehumanitas.org>2025-01-04 09:56:12 -0600
committerDominick Allen <djallen@librehumanitas.org>2025-01-04 09:56:12 -0600
commit0b400af9519444deef4cc6ad2c43c30e2092ab4f (patch)
treee6b0d78a2c292a7df5724f150e123b55d7871819 /include/fud_string_view.hpp
parent253385f4bca5ccd2fee22fea8333dfe435c0df0a (diff)
Fix bug related to string copying.
Diffstat (limited to 'include/fud_string_view.hpp')
-rw-r--r--include/fud_string_view.hpp11
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