Skip to content

Commit

Permalink
继续优化 string_view 的检查和兼容性
Browse files Browse the repository at this point in the history
  • Loading branch information
owent committed Oct 11, 2024
1 parent 2a0aea1 commit 06712ba
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions include/nostd/string_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<const_pointer> str) noexcept {
basic_string_view{str}.swap(*this);
return *this;
}

constexpr basic_string_view& operator=(std::nullptr_t) noexcept = delete;

template <class Allocator>
constexpr basic_string_view& operator=(::std::basic_string<CharT, Traits, Allocator>&& str) noexcept {
basic_string_view(str.data(), str.size()).swap(*this);
Expand Down

0 comments on commit 06712ba

Please sign in to comment.