AK: Implement a flyweight string for Utf16String

Utf16FlyString more or less works exactly the same as FlyString. It will
store the raw encoded data of the string instance. If the string is a
short ASCII string, Utf16FlyString holds the ShortString bytes; else,
Utf16FlyString holds a pointer to the Utf16StringData.
This commit is contained in:
Timothy Flynn 2025-06-20 11:52:35 -04:00 committed by Tim Flynn
commit 7f069efbc4
Notes: github-actions[bot] 2025-07-18 16:47:19 +00:00
9 changed files with 423 additions and 4 deletions

View file

@ -70,15 +70,15 @@ public:
static Utf16String from_utf32(Utf32View const&);
template<typename T>
requires(IsOneOf<RemoveCVReference<T>, Utf16String>)
requires(IsOneOf<RemoveCVReference<T>, Utf16String, Utf16FlyString>)
static Utf16String from_utf16(T&&) = delete;
template<typename T>
requires(IsOneOf<RemoveCVReference<T>, Utf16String>)
requires(IsOneOf<RemoveCVReference<T>, Utf16String, Utf16FlyString>)
static ErrorOr<Utf16String> try_from_utf16(T&&) = delete;
template<typename T>
requires(IsOneOf<RemoveCVReference<T>, Utf16String>)
requires(IsOneOf<RemoveCVReference<T>, Utf16String, Utf16FlyString>)
static Utf16String from_utf16_without_validation(T&&) = delete;
template<typename... Parameters>