Cleanun string_view

This commit is contained in:
Victor Zverovich
2025-04-27 09:34:38 -07:00
parent 8978ab09b2
commit 2680831231

View File

@ -527,13 +527,13 @@ template <typename Char> class basic_string_view {
constexpr basic_string_view() noexcept : data_(nullptr), size_(0) {} constexpr basic_string_view() noexcept : data_(nullptr), size_(0) {}
/// Constructs a string reference object from a C string and a size. /// Constructs a string view object from a C string and a size.
constexpr basic_string_view(const Char* s, size_t count) noexcept constexpr basic_string_view(const Char* s, size_t count) noexcept
: data_(s), size_(count) {} : data_(s), size_(count) {}
constexpr basic_string_view(nullptr_t) = delete; constexpr basic_string_view(nullptr_t) = delete;
/// Constructs a string reference object from a C string. /// Constructs a string view object from a C string.
#if FMT_GCC_VERSION #if FMT_GCC_VERSION
FMT_ALWAYS_INLINE FMT_ALWAYS_INLINE
#endif #endif
@ -549,7 +549,7 @@ template <typename Char> class basic_string_view {
size_ = len; size_ = len;
} }
/// Constructs a string reference from a `std::basic_string` or a /// Constructs a string view from a `std::basic_string` or a
/// `std::basic_string_view` object. /// `std::basic_string_view` object.
template <typename S, template <typename S,
FMT_ENABLE_IF(detail::is_std_string_like<S>::value&& std::is_same< FMT_ENABLE_IF(detail::is_std_string_like<S>::value&& std::is_same<
@ -586,7 +586,6 @@ template <typename Char> class basic_string_view {
return starts_with(basic_string_view<Char>(s)); return starts_with(basic_string_view<Char>(s));
} }
// Lexicographically compare this string reference to other.
FMT_CONSTEXPR auto compare(basic_string_view other) const -> int { FMT_CONSTEXPR auto compare(basic_string_view other) const -> int {
int result = int result =
detail::compare(data_, other.data_, min_of(size_, other.size_)); detail::compare(data_, other.data_, min_of(size_, other.size_));