AK: Make StringView::hash() constexpr

This required moving string_hash() to its own header so that everyone
can see it.
This commit is contained in:
Andreas Kling 2021-05-14 15:21:50 +02:00
commit 3e603b2f32
Notes: sideshowbarker 2024-07-18 18:09:53 +09:00
5 changed files with 36 additions and 25 deletions

View file

@ -214,13 +214,6 @@ template Optional<u64> StringView::to_uint() const;
template Optional<long> StringView::to_uint() const;
template Optional<long long> StringView::to_uint() const;
unsigned StringView::hash() const
{
if (is_empty())
return 0;
return string_hash(characters_without_null_termination(), length());
}
bool StringView::operator==(const String& string) const
{
if (string.is_null())