mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 00:19:53 +01:00
AK: Ensure Utf16FlyString is hash-compatible with Utf16View/Utf16String
This commit is contained in:
parent
274f8ee462
commit
1b611fba67
|
|
@ -165,6 +165,22 @@ struct Formatter<Utf16FlyString> : Formatter<Utf16String> {
|
|||
}
|
||||
};
|
||||
|
||||
namespace Detail {
|
||||
|
||||
template<>
|
||||
inline constexpr bool IsHashCompatible<Utf16View, Utf16FlyString> = true;
|
||||
|
||||
template<>
|
||||
inline constexpr bool IsHashCompatible<Utf16FlyString, Utf16View> = true;
|
||||
|
||||
template<>
|
||||
inline constexpr bool IsHashCompatible<Utf16String, Utf16FlyString> = true;
|
||||
|
||||
template<>
|
||||
inline constexpr bool IsHashCompatible<Utf16FlyString, Utf16String> = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[[nodiscard]] ALWAYS_INLINE AK::Utf16FlyString operator""_utf16_fly_string(char const* string, size_t length)
|
||||
|
|
|
|||
|
|
@ -8,6 +8,12 @@
|
|||
|
||||
#include <AK/Utf16FlyString.h>
|
||||
|
||||
static_assert(AK::Concepts::HashCompatible<Utf16String, Utf16FlyString>);
|
||||
static_assert(AK::Concepts::HashCompatible<Utf16FlyString, Utf16String>);
|
||||
|
||||
static_assert(AK::Concepts::HashCompatible<Utf16View, Utf16FlyString>);
|
||||
static_assert(AK::Concepts::HashCompatible<Utf16FlyString, Utf16View>);
|
||||
|
||||
TEST_CASE(empty_string)
|
||||
{
|
||||
Utf16FlyString fly {};
|
||||
|
|
|
|||
|
|
@ -14,6 +14,9 @@
|
|||
#include <AK/Utf16String.h>
|
||||
#include <AK/Utf32View.h>
|
||||
|
||||
static_assert(AK::Concepts::HashCompatible<Utf16String, Utf16View>);
|
||||
static_assert(AK::Concepts::HashCompatible<Utf16View, Utf16String>);
|
||||
|
||||
static Utf16String make_copy(Utf16String const& string)
|
||||
{
|
||||
return string.has_ascii_storage()
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user