AK: Add a comparison operator for Utf32View

(cherry picked from commit 0703ba118b56aaa924346ae36c8826764dadd409)
This commit is contained in:
Timothy Flynn authored and Nico Weber committed 2024-11-17 11:03:57 -05:00
1 parent d0f3347017
commit 814f13db04
2 files changed
+10

No files matched your search

+8
View File
@@ -27,6 +27,14 @@ Optional<u32> Utf32CodePointIterator::peek(size_t offset) const
return *new_iterator;
}
bool Utf32View::operator==(Utf32View const& other) const
{
ReadonlySpan<u32> code_points { m_code_points, m_length };
ReadonlySpan<u32> other_code_points { other.m_code_points, other.m_length };
return code_points == other_code_points;
}
ErrorOr<void> Formatter<Utf32View>::format(FormatBuilder& builder, Utf32View const& string)
{
return builder.builder().try_append(string);
+2
View File
@@ -119,6 +119,8 @@ public:
return substring_view(offset, length() - offset);
}
bool operator==(Utf32View const& other) const;
private:
u32 const* begin_ptr() const
{