diff --git a/AK/StringView.cpp b/AK/StringView.cpp index f6b6c3648d3..f299ab707bf 100644 --- a/AK/StringView.cpp +++ b/AK/StringView.cpp @@ -16,11 +16,18 @@ #ifndef KERNEL # include # include +# include #endif namespace AK { #ifndef KERNEL +StringView::StringView(String const& string) + : m_characters(reinterpret_cast(string.bytes().data())) + , m_length(string.bytes().size()) +{ +} + StringView::StringView(DeprecatedString const& string) : m_characters(string.characters()) , m_length(string.length()) diff --git a/AK/StringView.h b/AK/StringView.h index d846e2eb084..f238601ae07 100644 --- a/AK/StringView.h +++ b/AK/StringView.h @@ -42,12 +42,14 @@ public: StringView(ByteBuffer const&); #ifndef KERNEL + StringView(String const&); StringView(DeprecatedString const&); StringView(FlyString const&); #endif explicit StringView(ByteBuffer&&) = delete; #ifndef KERNEL + explicit StringView(String&&) = delete; explicit StringView(DeprecatedString&&) = delete; explicit StringView(FlyString&&) = delete; #endif