From 06712ba8a3e923074072285fbd8e1d8c36fa59b0 Mon Sep 17 00:00:00 2001 From: owent Date: Fri, 11 Oct 2024 14:02:45 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=A7=E7=BB=AD=E4=BC=98=E5=8C=96=20string?= =?UTF-8?q?=5Fview=20=E7=9A=84=E6=A3=80=E6=9F=A5=E5=92=8C=E5=85=BC?= =?UTF-8?q?=E5=AE=B9=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/nostd/string_view.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/nostd/string_view.h b/include/nostd/string_view.h index 0f42116..05af971 100644 --- a/include/nostd/string_view.h +++ b/include/nostd/string_view.h @@ -132,6 +132,16 @@ class LIBATFRAME_UTILS_API_HEAD_ONLY basic_string_view { // constexpr basic_string_view(const basic_string_view&) noexcept = default; // basic_string_view& operator=(const basic_string_view&) noexcept = default; + constexpr basic_string_view(const basic_string_view&) noexcept = default; + constexpr basic_string_view& operator=(const basic_string_view&) noexcept = default; + + constexpr basic_string_view& operator=(nostd::nonnull str) noexcept { + basic_string_view{str}.swap(*this); + return *this; + } + + constexpr basic_string_view& operator=(std::nullptr_t) noexcept = delete; + template constexpr basic_string_view& operator=(::std::basic_string&& str) noexcept { basic_string_view(str.data(), str.size()).swap(*this);