summaryrefslogtreecommitdiff
path: root/AK/StringView.h
diff options
context:
space:
mode:
authorasynts <asynts@gmail.com>2020-08-19 11:43:41 +0200
committerAndreas Kling <kling@serenityos.org>2020-08-20 16:28:31 +0200
commitebce4ead401de12dcb4c11d8818721d82b03afbe (patch)
tree705e8eef3e84fa84371a315b12ba4cea3aed34dd /AK/StringView.h
parentb1fc8d2b38cef5510da2506508c4f09a819ccf6f (diff)
downloadserenity-ebce4ead401de12dcb4c11d8818721d82b03afbe.zip
AK: Add StringView(ReadonlyBytes) constructor.
Diffstat (limited to 'AK/StringView.h')
-rw-r--r--AK/StringView.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/AK/StringView.h b/AK/StringView.h
index 4e8a652dec..a1d4de9cbb 100644
--- a/AK/StringView.h
+++ b/AK/StringView.h
@@ -57,6 +57,11 @@ public:
, m_length(cstring ? __builtin_strlen(cstring) : 0)
{
}
+ ALWAYS_INLINE StringView(ReadonlyBytes bytes)
+ : m_characters(reinterpret_cast<const char*>(bytes.data()))
+ , m_length(bytes.size())
+ {
+ }
StringView(const ByteBuffer&);
StringView(const String&);