summaryrefslogtreecommitdiff
path: root/AK
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2021-09-04 17:53:43 +0300
committerAndreas Kling <kling@serenityos.org>2021-09-04 21:01:15 +0200
commite8f6840471eabee2f3c01006cb5a4e3815c6c4a9 (patch)
treedd545280f0d1cd41d4c2852b772dc53891d89c48 /AK
parente606ff3751e66f73dd7bf9c541609c848991795b (diff)
downloadserenity-e8f6840471eabee2f3c01006cb5a4e3815c6c4a9.zip
AK+LibRegex: Disable construction of views from temporary Strings
Diffstat (limited to 'AK')
-rw-r--r--AK/StringView.h2
-rw-r--r--AK/Utf8View.h2
2 files changed, 4 insertions, 0 deletions
diff --git a/AK/StringView.h b/AK/StringView.h
index f98b18ff55..f67bab6196 100644
--- a/AK/StringView.h
+++ b/AK/StringView.h
@@ -48,6 +48,8 @@ public:
StringView(const String&);
StringView(const FlyString&);
+ explicit StringView(String&&) = delete;
+
[[nodiscard]] constexpr bool is_null() const { return !m_characters; }
[[nodiscard]] constexpr bool is_empty() const { return m_length == 0; }
diff --git a/AK/Utf8View.h b/AK/Utf8View.h
index 306634de85..ed91e39b67 100644
--- a/AK/Utf8View.h
+++ b/AK/Utf8View.h
@@ -58,6 +58,8 @@ public:
explicit Utf8View(const char*);
~Utf8View() = default;
+ explicit Utf8View(String&&) = delete;
+
const StringView& as_string() const { return m_string; }
Utf8CodePointIterator begin() const;