* Returns a read/write iterator that points to the first character in
* the %string.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
iterator
begin() _GLIBCXX_NOEXCEPT
{ return iterator(_M_data()); }
* Returns a read-only (constant) iterator that points to the first
* character in the %string.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
const_iterator
begin() const _GLIBCXX_NOEXCEPT
{ return const_iterator(_M_data()); }
* Returns a read/write iterator that points one past the last
* character in the %string.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
iterator
end() _GLIBCXX_NOEXCEPT
{ return iterator(_M_data() + this->size()); }
* Returns a read-only (constant) iterator that points one past the
* last character in the %string.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
const_iterator
end() const _GLIBCXX_NOEXCEPT
{ return const_iterator(_M_data() + this->size()); }
* character in the %string. Iteration is done in reverse element
* order.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
reverse_iterator
rbegin() _GLIBCXX_NOEXCEPT
{ return reverse_iterator(this->end()); }
* to the last character in the %string. Iteration is done in
* reverse element order.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
const_reverse_iterator
rbegin() const _GLIBCXX_NOEXCEPT
{ return const_reverse_iterator(this->end()); }
* first character in the %string. Iteration is done in reverse
* element order.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
reverse_iterator
rend() _GLIBCXX_NOEXCEPT
{ return reverse_iterator(this->begin()); }
* to one before the first character in the %string. Iteration
* is done in reverse element order.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
const_reverse_iterator
rend() const _GLIBCXX_NOEXCEPT
{ return const_reverse_iterator(this->begin()); }
* Returns a read-only (constant) iterator that points to the first
* character in the %string.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
const_iterator
cbegin() const noexcept
{ return const_iterator(this->_M_data()); }
* Returns a read-only (constant) iterator that points one past the
* last character in the %string.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
const_iterator
cend() const noexcept
{ return const_iterator(this->_M_data() + this->size()); }
* to the last character in the %string. Iteration is done in
* reverse element order.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
const_reverse_iterator
crbegin() const noexcept
{ return const_reverse_iterator(this->end()); }
* to one before the first character in the %string. Iteration
* is done in reverse element order.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
const_reverse_iterator
crend() const noexcept
{ return const_reverse_iterator(this->begin()); }
// Capacity:
/// Returns the number of characters in the string, not including any
/// null-termination.
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
size_type
size() const _GLIBCXX_NOEXCEPT
{ return _M_string_length; }
/// Returns the number of characters in the string, not including any
/// null-termination.
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
size_type
length() const _GLIBCXX_NOEXCEPT
{ return _M_string_length; }
/// Returns the size() of the largest possible %string.
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
size_type
max_size() const _GLIBCXX_NOEXCEPT
{ return (_Alloc_traits::max_size(_M_get_allocator()) - 1) / 2; }
* Returns the total number of characters that the %string can hold
* before needing to allocate more memory.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
size_type
capacity() const _GLIBCXX_NOEXCEPT
{
* out_of_range lookups are not defined. (For checked lookups
* see at().)
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
const_reference
operator[] (size_type __pos) const _GLIBCXX_NOEXCEPT
{
* out_of_range lookups are not defined. (For checked lookups
* see at().)
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
reference
operator[](size_type __pos)
{
* first checked that it is in the range of the string. The function
* throws out_of_range if the check fails.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
const_reference
at(size_type __n) const
{
* first checked that it is in the range of the string. The function
* throws out_of_range if the check fails.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
reference
at(size_type __n)
{
* Returns a read/write reference to the data at the first
* element of the %string.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
reference
front() noexcept
{
* Returns a read-only (constant) reference to the data at the first
* element of the %string.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
const_reference
front() const noexcept
{
* Returns a read/write reference to the data at the last
* element of the %string.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
reference
back() noexcept
{
* Returns a read-only (constant) reference to the data at the
* last element of the %string.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
const_reference
back() const noexcept
{
* This is a handle to internal data. Do not modify or dire things may
* happen.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
const _CharT*
c_str() const _GLIBCXX_NOEXCEPT
{ return _M_data(); }
* allows modifying the contents use @c &str[0] instead,
* (or in C++17 the non-const @c str.data() overload).
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
const _CharT*
data() const _GLIBCXX_NOEXCEPT
{ return _M_data(); }
* This is a pointer to the character sequence held by the string.
* Modifying the characters in the sequence is allowed.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
_CharT*
data() noexcept
{ return _M_data(); }
/**
* @brief Return copy of allocator used to construct this string.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
allocator_type
get_allocator() const _GLIBCXX_NOEXCEPT
{ return _M_get_allocator(); }
* returns the index where it begins. If not found, returns
* npos.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
size_type
find(const _CharT* __s, size_type __pos, size_type __n) const
_GLIBCXX_NOEXCEPT;
* this string. If found, returns the index where it begins. If not
* found, returns npos.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
size_type
find(const basic_string& __str, size_type __pos = 0) const
_GLIBCXX_NOEXCEPT
* @return Index of start of first occurrence.
*/
template<typename _Tp>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
_If_sv<_Tp, size_type>
find(const _Tp& __svt, size_type __pos = 0) const
noexcept(is_same<_Tp, __sv_type>::value)
* __s within this string. If found, returns the index where
* it begins. If not found, returns npos.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
size_type
find(const _CharT* __s, size_type __pos = 0) const _GLIBCXX_NOEXCEPT
{
* this string. If found, returns the index where it was
* found. If not found, returns npos.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
size_type
find(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT;
* __str within this string. If found, returns the index where
* it begins. If not found, returns npos.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
size_type
rfind(const basic_string& __str, size_type __pos = npos) const
_GLIBCXX_NOEXCEPT
* @return Index of start of last occurrence.
*/
template<typename _Tp>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
_If_sv<_Tp, size_type>
rfind(const _Tp& __svt, size_type __pos = npos) const
noexcept(is_same<_Tp, __sv_type>::value)
* returns the index where it begins. If not found, returns
* npos.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
size_type
rfind(const _CharT* __s, size_type __pos, size_type __n) const
_GLIBCXX_NOEXCEPT;
* @a __s within this string. If found, returns the index
* where it begins. If not found, returns npos.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
size_type
rfind(const _CharT* __s, size_type __pos = npos) const
{
* this string. If found, returns the index where it was
* found. If not found, returns npos.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
size_type
rfind(_CharT __c, size_type __pos = npos) const _GLIBCXX_NOEXCEPT;
* returns the index where it was found. If not found, returns
* npos.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
size_type
find_first_of(const basic_string& __str, size_type __pos = 0) const
_GLIBCXX_NOEXCEPT
* @return Index of first occurrence.
*/
template<typename _Tp>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
_If_sv<_Tp, size_type>
find_first_of(const _Tp& __svt, size_type __pos = 0) const
noexcept(is_same<_Tp, __sv_type>::value)
* found, returns the index where it was found. If not found,
* returns npos.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
size_type
find_first_of(const _CharT* __s, size_type __pos, size_type __n) const
_GLIBCXX_NOEXCEPT;
* characters of @a __s within this string. If found, returns
* the index where it was found. If not found, returns npos.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
size_type
find_first_of(const _CharT* __s, size_type __pos = 0) const
_GLIBCXX_NOEXCEPT
*
* Note: equivalent to find(__c, __pos).
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
size_type
find_first_of(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT
{ return this->find(__c, __pos); }
* returns the index where it was found. If not found, returns
* npos.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
size_type
find_last_of(const basic_string& __str, size_type __pos = npos) const
_GLIBCXX_NOEXCEPT
* @return Index of last occurrence.
*/
template<typename _Tp>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
_If_sv<_Tp, size_type>
find_last_of(const _Tp& __svt, size_type __pos = npos) const
noexcept(is_same<_Tp, __sv_type>::value)
* found, returns the index where it was found. If not found,
* returns npos.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
size_type
find_last_of(const _CharT* __s, size_type __pos, size_type __n) const
_GLIBCXX_NOEXCEPT;
* characters of @a __s within this string. If found, returns
* the index where it was found. If not found, returns npos.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
size_type
find_last_of(const _CharT* __s, size_type __pos = npos) const
_GLIBCXX_NOEXCEPT
*
* Note: equivalent to rfind(__c, __pos).
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
size_type
find_last_of(_CharT __c, size_type __pos = npos) const _GLIBCXX_NOEXCEPT
{ return this->rfind(__c, __pos); }
* in @a __str within this string. If found, returns the index where it
* was found. If not found, returns npos.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
size_type
find_first_not_of(const basic_string& __str, size_type __pos = 0) const
_GLIBCXX_NOEXCEPT
* @return Index of first occurrence.
*/
template<typename _Tp>
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
_If_sv<_Tp, size_type>
- _GLIBCXX20_CONSTEXPR
find_first_not_of(const _Tp& __svt, size_type __pos = 0) const
noexcept(is_same<_Tp, __sv_type>::value)
{
* this string. If found, returns the index where it was
* found. If not found, returns npos.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
size_type
find_first_not_of(const _CharT* __s, size_type __pos,
size_type __n) const _GLIBCXX_NOEXCEPT;
* contained in @a __s within this string. If found, returns
* the index where it was found. If not found, returns npos.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
size_type
find_first_not_of(const _CharT* __s, size_type __pos = 0) const
_GLIBCXX_NOEXCEPT
* other than @a __c within this string. If found, returns the
* index where it was found. If not found, returns npos.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
size_type
find_first_not_of(_CharT __c, size_type __pos = 0) const
_GLIBCXX_NOEXCEPT;
* returns the index where it was found. If not found, returns
* npos.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
size_type
find_last_not_of(const basic_string& __str, size_type __pos = npos) const
_GLIBCXX_NOEXCEPT
* @return Index of last occurrence.
*/
template<typename _Tp>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
_If_sv<_Tp, size_type>
find_last_not_of(const _Tp& __svt, size_type __pos = npos) const
noexcept(is_same<_Tp, __sv_type>::value)
* If found, returns the index where it was found. If not found,
* returns npos.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
size_type
find_last_not_of(const _CharT* __s, size_type __pos,
size_type __n) const _GLIBCXX_NOEXCEPT;
* returns the index where it was found. If not found, returns
* npos.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
size_type
find_last_not_of(const _CharT* __s, size_type __pos = npos) const
_GLIBCXX_NOEXCEPT
* @a __c within this string. If found, returns the index where it was
* found. If not found, returns npos.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
size_type
find_last_not_of(_CharT __c, size_type __pos = npos) const
_GLIBCXX_NOEXCEPT;
* short, use the remainder of the characters. If @a __pos is
* beyond the end of the string, out_of_range is thrown.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
basic_string
substr(size_type __pos = 0, size_type __n = npos) const
{ return basic_string(*this,
* If the result of the comparison is nonzero returns it,
* otherwise the shorter one is ordered first.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
int
compare(const basic_string& __str) const
{
* @return Integer < 0, 0, or > 0.
*/
template<typename _Tp>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
_If_sv<_Tp, int>
compare(const _Tp& __svt) const
noexcept(is_same<_Tp, __sv_type>::value)
* @return Integer < 0, 0, or > 0.
*/
template<typename _Tp>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
_If_sv<_Tp, int>
compare(size_type __pos, size_type __n, const _Tp& __svt) const
noexcept(is_same<_Tp, __sv_type>::value)
* @return Integer < 0, 0, or > 0.
*/
template<typename _Tp>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
_If_sv<_Tp, int>
compare(size_type __pos1, size_type __n1, const _Tp& __svt,
size_type __pos2, size_type __n2 = npos) const
* result of the comparison is nonzero returns it, otherwise
* the shorter one is ordered first.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
int
compare(size_type __pos, size_type __n, const basic_string& __str) const
{
* If the result of the comparison is nonzero returns it,
* otherwise the shorter one is ordered first.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
int
compare(size_type __pos1, size_type __n1, const basic_string& __str,
size_type __pos2, size_type __n2 = npos) const
* comparison is nonzero returns it, otherwise the shorter one is
* ordered first.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
int
compare(const _CharT* __s) const _GLIBCXX_NOEXCEPT
{
* the comparison is nonzero returns it, otherwise the shorter
* one is ordered first.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
int
compare(size_type __pos, size_type __n1, const _CharT* __s) const
{
* NB: s must have at least n2 characters, '\\0' has
* no special meaning.
*/
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
int
compare(size_type __pos, size_type __n1, const _CharT* __s,
size_type __n2) const
}
#if __cplusplus >= 202002L
+ [[nodiscard]]
constexpr bool
starts_with(basic_string_view<_CharT, _Traits> __x) const noexcept
{ return __sv_type(this->data(), this->size()).starts_with(__x); }
+ [[nodiscard]]
constexpr bool
starts_with(_CharT __x) const noexcept
{ return __sv_type(this->data(), this->size()).starts_with(__x); }
- [[__gnu__::__nonnull__]]
+ [[nodiscard, __gnu__::__nonnull__]]
constexpr bool
starts_with(const _CharT* __x) const noexcept
{ return __sv_type(this->data(), this->size()).starts_with(__x); }
+ [[nodiscard]]
constexpr bool
ends_with(basic_string_view<_CharT, _Traits> __x) const noexcept
{ return __sv_type(this->data(), this->size()).ends_with(__x); }
+ [[nodiscard]]
constexpr bool
ends_with(_CharT __x) const noexcept
{ return __sv_type(this->data(), this->size()).ends_with(__x); }
- [[__gnu__::__nonnull__]]
+ [[nodiscard, __gnu__::__nonnull__]]
constexpr bool
ends_with(const _CharT* __x) const noexcept
{ return __sv_type(this->data(), this->size()).ends_with(__x); }
#endif // C++20
#if __cplusplus > 202002L
+ [[nodiscard]]
constexpr bool
contains(basic_string_view<_CharT, _Traits> __x) const noexcept
{ return __sv_type(this->data(), this->size()).contains(__x); }
+ [[nodiscard]]
constexpr bool
contains(_CharT __x) const noexcept
{ return __sv_type(this->data(), this->size()).contains(__x); }
- [[__gnu__::__nonnull__]]
+ [[nodiscard, __gnu__::__nonnull__]]
constexpr bool
contains(const _CharT* __x) const noexcept
{ return __sv_type(this->data(), this->size()).contains(__x); }
* @return New string with value of @a __lhs followed by @a __rhs.
*/
template<typename _CharT, typename _Traits, typename _Alloc>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
basic_string<_CharT, _Traits, _Alloc>
operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
const basic_string<_CharT, _Traits, _Alloc>& __rhs)
* @return New string with value of @a __lhs followed by @a __rhs.
*/
template<typename _CharT, typename _Traits, typename _Alloc>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
basic_string<_CharT,_Traits,_Alloc>
operator+(const _CharT* __lhs,
const basic_string<_CharT,_Traits,_Alloc>& __rhs);
* @return New string with @a __lhs followed by @a __rhs.
*/
template<typename _CharT, typename _Traits, typename _Alloc>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
basic_string<_CharT,_Traits,_Alloc>
operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs);
* @return New string with @a __lhs followed by @a __rhs.
*/
template<typename _CharT, typename _Traits, typename _Alloc>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline basic_string<_CharT, _Traits, _Alloc>
operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
const _CharT* __rhs)
* @return New string with @a __lhs followed by @a __rhs.
*/
template<typename _CharT, typename _Traits, typename _Alloc>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline basic_string<_CharT, _Traits, _Alloc>
operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs)
{
#if __cplusplus >= 201103L
template<typename _CharT, typename _Traits, typename _Alloc>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline basic_string<_CharT, _Traits, _Alloc>
operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
const basic_string<_CharT, _Traits, _Alloc>& __rhs)
{ return std::move(__rhs.insert(0, __lhs)); }
template<typename _CharT, typename _Traits, typename _Alloc>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline basic_string<_CharT, _Traits, _Alloc>
operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
basic_string<_CharT, _Traits, _Alloc>&& __rhs)
}
template<typename _CharT, typename _Traits, typename _Alloc>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline basic_string<_CharT, _Traits, _Alloc>
operator+(const _CharT* __lhs,
basic_string<_CharT, _Traits, _Alloc>&& __rhs)
{ return std::move(__rhs.insert(0, __lhs)); }
template<typename _CharT, typename _Traits, typename _Alloc>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline basic_string<_CharT, _Traits, _Alloc>
operator+(_CharT __lhs,
basic_string<_CharT, _Traits, _Alloc>&& __rhs)
{ return std::move(__rhs.insert(0, 1, __lhs)); }
template<typename _CharT, typename _Traits, typename _Alloc>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline basic_string<_CharT, _Traits, _Alloc>
operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
const _CharT* __rhs)
{ return std::move(__lhs.append(__rhs)); }
template<typename _CharT, typename _Traits, typename _Alloc>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline basic_string<_CharT, _Traits, _Alloc>
operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
_CharT __rhs)
* @return True if @a __lhs.compare(@a __rhs) == 0. False otherwise.
*/
template<typename _CharT, typename _Traits, typename _Alloc>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline bool
operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
const basic_string<_CharT, _Traits, _Alloc>& __rhs)
* @return True if @a __lhs.compare(@a __rhs) == 0. False otherwise.
*/
template<typename _CharT, typename _Traits, typename _Alloc>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline bool
operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
const _CharT* __rhs)
* greater than, or incomparable with `__rhs`.
*/
template<typename _CharT, typename _Traits, typename _Alloc>
+ [[nodiscard]]
constexpr auto
operator<=>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
const basic_string<_CharT, _Traits, _Alloc>& __rhs) noexcept
* greater than, or incomparable with `__rhs`.
*/
template<typename _CharT, typename _Traits, typename _Alloc>
+ [[nodiscard]]
constexpr auto
operator<=>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
const _CharT* __rhs) noexcept
* @return True if @a __rhs.compare(@a __lhs) == 0. False otherwise.
*/
template<typename _CharT, typename _Traits, typename _Alloc>
+ _GLIBCXX_NODISCARD
inline bool
operator==(const _CharT* __lhs,
const basic_string<_CharT, _Traits, _Alloc>& __rhs)
* @return True if @a __lhs.compare(@a __rhs) != 0. False otherwise.
*/
template<typename _CharT, typename _Traits, typename _Alloc>
+ _GLIBCXX_NODISCARD
inline bool
operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
const basic_string<_CharT, _Traits, _Alloc>& __rhs)
* @return True if @a __rhs.compare(@a __lhs) != 0. False otherwise.
*/
template<typename _CharT, typename _Traits, typename _Alloc>
+ _GLIBCXX_NODISCARD
inline bool
operator!=(const _CharT* __lhs,
const basic_string<_CharT, _Traits, _Alloc>& __rhs)
* @return True if @a __lhs.compare(@a __rhs) != 0. False otherwise.
*/
template<typename _CharT, typename _Traits, typename _Alloc>
+ _GLIBCXX_NODISCARD
inline bool
operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
const _CharT* __rhs)
* @return True if @a __lhs precedes @a __rhs. False otherwise.
*/
template<typename _CharT, typename _Traits, typename _Alloc>
+ _GLIBCXX_NODISCARD
inline bool
operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
const basic_string<_CharT, _Traits, _Alloc>& __rhs)
* @return True if @a __lhs precedes @a __rhs. False otherwise.
*/
template<typename _CharT, typename _Traits, typename _Alloc>
+ _GLIBCXX_NODISCARD
inline bool
operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
const _CharT* __rhs)
* @return True if @a __lhs precedes @a __rhs. False otherwise.
*/
template<typename _CharT, typename _Traits, typename _Alloc>
+ _GLIBCXX_NODISCARD
inline bool
operator<(const _CharT* __lhs,
const basic_string<_CharT, _Traits, _Alloc>& __rhs)
* @return True if @a __lhs follows @a __rhs. False otherwise.
*/
template<typename _CharT, typename _Traits, typename _Alloc>
+ _GLIBCXX_NODISCARD
inline bool
operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
const basic_string<_CharT, _Traits, _Alloc>& __rhs)
* @return True if @a __lhs follows @a __rhs. False otherwise.
*/
template<typename _CharT, typename _Traits, typename _Alloc>
+ _GLIBCXX_NODISCARD
inline bool
operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
const _CharT* __rhs)
* @return True if @a __lhs follows @a __rhs. False otherwise.
*/
template<typename _CharT, typename _Traits, typename _Alloc>
+ _GLIBCXX_NODISCARD
inline bool
operator>(const _CharT* __lhs,
const basic_string<_CharT, _Traits, _Alloc>& __rhs)
* @return True if @a __lhs doesn't follow @a __rhs. False otherwise.
*/
template<typename _CharT, typename _Traits, typename _Alloc>
+ _GLIBCXX_NODISCARD
inline bool
operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
const basic_string<_CharT, _Traits, _Alloc>& __rhs)
* @return True if @a __lhs doesn't follow @a __rhs. False otherwise.
*/
template<typename _CharT, typename _Traits, typename _Alloc>
+ _GLIBCXX_NODISCARD
inline bool
operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
const _CharT* __rhs)
* @return True if @a __lhs doesn't follow @a __rhs. False otherwise.
*/
template<typename _CharT, typename _Traits, typename _Alloc>
+ _GLIBCXX_NODISCARD
inline bool
operator<=(const _CharT* __lhs,
const basic_string<_CharT, _Traits, _Alloc>& __rhs)
* @return True if @a __lhs doesn't precede @a __rhs. False otherwise.
*/
template<typename _CharT, typename _Traits, typename _Alloc>
+ _GLIBCXX_NODISCARD
inline bool
operator>=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
const basic_string<_CharT, _Traits, _Alloc>& __rhs)
* @return True if @a __lhs doesn't precede @a __rhs. False otherwise.
*/
template<typename _CharT, typename _Traits, typename _Alloc>
+ _GLIBCXX_NODISCARD
inline bool
operator>=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
const _CharT* __rhs)
* @return True if @a __lhs doesn't precede @a __rhs. False otherwise.
*/
template<typename _CharT, typename _Traits, typename _Alloc>
+ _GLIBCXX_NODISCARD
inline bool
operator>=(const _CharT* __lhs,
const basic_string<_CharT, _Traits, _Alloc>& __rhs)
// DR 1261. Insufficent overloads for to_string / to_wstring
+ _GLIBCXX_NODISCARD
inline string
to_string(int __val)
#if _GLIBCXX_USE_CXX11_ABI && (__CHAR_BIT__ * __SIZEOF_INT__) <= 32
return __str;
}
+ _GLIBCXX_NODISCARD
inline string
to_string(unsigned __val)
#if _GLIBCXX_USE_CXX11_ABI && (__CHAR_BIT__ * __SIZEOF_INT__) <= 32
return __str;
}
+ _GLIBCXX_NODISCARD
inline string
to_string(long __val)
#if _GLIBCXX_USE_CXX11_ABI && (__CHAR_BIT__ * __SIZEOF_LONG__) <= 32
return __str;
}
+ _GLIBCXX_NODISCARD
inline string
to_string(unsigned long __val)
#if _GLIBCXX_USE_CXX11_ABI && (__CHAR_BIT__ * __SIZEOF_LONG__) <= 32
return __str;
}
+ _GLIBCXX_NODISCARD
inline string
to_string(long long __val)
{
return __str;
}
+ _GLIBCXX_NODISCARD
inline string
to_string(unsigned long long __val)
{
#if _GLIBCXX_USE_C99_STDIO
// NB: (v)snprintf vs sprintf.
+ _GLIBCXX_NODISCARD
inline string
to_string(float __val)
{
"%f", __val);
}
+ _GLIBCXX_NODISCARD
inline string
to_string(double __val)
{
"%f", __val);
}
+ _GLIBCXX_NODISCARD
inline string
to_string(long double __val)
{
#ifndef _GLIBCXX_HAVE_BROKEN_VSWPRINTF
// DR 1261.
+ _GLIBCXX_NODISCARD
inline wstring
to_wstring(int __val)
{ return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, 4 * sizeof(int),
L"%d", __val); }
+ _GLIBCXX_NODISCARD
inline wstring
to_wstring(unsigned __val)
{ return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf,
4 * sizeof(unsigned),
L"%u", __val); }
+ _GLIBCXX_NODISCARD
inline wstring
to_wstring(long __val)
{ return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, 4 * sizeof(long),
L"%ld", __val); }
+ _GLIBCXX_NODISCARD
inline wstring
to_wstring(unsigned long __val)
{ return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf,
4 * sizeof(unsigned long),
L"%lu", __val); }
+ _GLIBCXX_NODISCARD
inline wstring
to_wstring(long long __val)
{ return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf,
4 * sizeof(long long),
L"%lld", __val); }
+ _GLIBCXX_NODISCARD
inline wstring
to_wstring(unsigned long long __val)
{ return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf,
4 * sizeof(unsigned long long),
L"%llu", __val); }
+ _GLIBCXX_NODISCARD
inline wstring
to_wstring(float __val)
{
L"%f", __val);
}
+ _GLIBCXX_NODISCARD
inline wstring
to_wstring(double __val)
{
L"%f", __val);
}
+ _GLIBCXX_NODISCARD
inline wstring
to_wstring(long double __val)
{
struct __str_hash_base
: public __hash_base<size_t, _StrT>
{
+ [[__nodiscard__]]
size_t
operator()(const _StrT& __s) const noexcept
{ return _Hash_impl::hash(__s.data(), __s.length() * sizeof(_CharT)); }
constexpr basic_string_view(const basic_string_view&) noexcept = default;
- __attribute__((__nonnull__)) constexpr
+ [[__gnu__::__nonnull__]]
+ constexpr
basic_string_view(const _CharT* __str) noexcept
: _M_len{traits_type::length(__str)},
_M_str{__str}
#endif // C++23
#endif // C++20
-
constexpr basic_string_view&
operator=(const basic_string_view&) noexcept = default;
// [string.view.iterators], iterator support
+ [[nodiscard]]
constexpr const_iterator
begin() const noexcept
{ return this->_M_str; }
+ [[nodiscard]]
constexpr const_iterator
end() const noexcept
{ return this->_M_str + this->_M_len; }
+ [[nodiscard]]
constexpr const_iterator
cbegin() const noexcept
{ return this->_M_str; }
+ [[nodiscard]]
constexpr const_iterator
cend() const noexcept
{ return this->_M_str + this->_M_len; }
+ [[nodiscard]]
constexpr const_reverse_iterator
rbegin() const noexcept
{ return const_reverse_iterator(this->end()); }
+ [[nodiscard]]
constexpr const_reverse_iterator
rend() const noexcept
{ return const_reverse_iterator(this->begin()); }
+ [[nodiscard]]
constexpr const_reverse_iterator
crbegin() const noexcept
{ return const_reverse_iterator(this->end()); }
+ [[nodiscard]]
constexpr const_reverse_iterator
crend() const noexcept
{ return const_reverse_iterator(this->begin()); }
// [string.view.capacity], capacity
+ [[nodiscard]]
constexpr size_type
size() const noexcept
{ return this->_M_len; }
+ [[nodiscard]]
constexpr size_type
length() const noexcept
{ return _M_len; }
+ [[nodiscard]]
constexpr size_type
max_size() const noexcept
{
/ sizeof(value_type) / 4;
}
- [[nodiscard]] constexpr bool
+ [[nodiscard]]
+ constexpr bool
empty() const noexcept
{ return this->_M_len == 0; }
// [string.view.access], element access
+ [[nodiscard]]
constexpr const_reference
operator[](size_type __pos) const noexcept
{
return *(this->_M_str + __pos);
}
+ [[nodiscard]]
constexpr const_reference
at(size_type __pos) const
{
return *(this->_M_str + __pos);
}
+ [[nodiscard]]
constexpr const_reference
front() const noexcept
{
return *this->_M_str;
}
+ [[nodiscard]]
constexpr const_reference
back() const noexcept
{
return *(this->_M_str + this->_M_len - 1);
}
+ [[nodiscard]]
constexpr const_pointer
data() const noexcept
{ return this->_M_str; }
return __rlen;
}
+ [[nodiscard]]
constexpr basic_string_view
substr(size_type __pos = 0, size_type __n = npos) const noexcept(false)
{
return basic_string_view{_M_str + __pos, __rlen};
}
+ [[nodiscard]]
constexpr int
compare(basic_string_view __str) const noexcept
{
return __ret;
}
+ [[nodiscard]]
constexpr int
compare(size_type __pos1, size_type __n1, basic_string_view __str) const
{ return this->substr(__pos1, __n1).compare(__str); }
+ [[nodiscard]]
constexpr int
compare(size_type __pos1, size_type __n1,
basic_string_view __str, size_type __pos2, size_type __n2) const
return this->substr(__pos1, __n1).compare(__str.substr(__pos2, __n2));
}
- __attribute__((__nonnull__)) constexpr int
+ [[nodiscard, __gnu__::__nonnull__]]
+ constexpr int
compare(const _CharT* __str) const noexcept
{ return this->compare(basic_string_view{__str}); }
- __attribute__((__nonnull__)) constexpr int
+ [[nodiscard, __gnu__::__nonnull__]]
+ constexpr int
compare(size_type __pos1, size_type __n1, const _CharT* __str) const
{ return this->substr(__pos1, __n1).compare(basic_string_view{__str}); }
+ [[nodiscard]]
constexpr int
compare(size_type __pos1, size_type __n1,
const _CharT* __str, size_type __n2) const noexcept(false)
#if __cplusplus > 201703L
#define __cpp_lib_starts_ends_with 201711L
+ [[nodiscard]]
constexpr bool
starts_with(basic_string_view __x) const noexcept
{ return this->substr(0, __x.size()) == __x; }
+ [[nodiscard]]
constexpr bool
starts_with(_CharT __x) const noexcept
{ return !this->empty() && traits_type::eq(this->front(), __x); }
- [[__gnu__::__nonnull__]]
+ [[nodiscard, __gnu__::__nonnull__]]
constexpr bool
starts_with(const _CharT* __x) const noexcept
{ return this->starts_with(basic_string_view(__x)); }
+ [[nodiscard]]
constexpr bool
ends_with(basic_string_view __x) const noexcept
{
&& traits_type::compare(end() - __xlen, __x.data(), __xlen) == 0;
}
+ [[nodiscard]]
constexpr bool
ends_with(_CharT __x) const noexcept
{ return !this->empty() && traits_type::eq(this->back(), __x); }
- [[__gnu__::__nonnull__]]
+ [[nodiscard, __gnu__::__nonnull__]]
constexpr bool
ends_with(const _CharT* __x) const noexcept
{ return this->ends_with(basic_string_view(__x)); }
#if __cplusplus > 202002L
#define __cpp_lib_string_contains 202011L
+ [[nodiscard]]
constexpr bool
contains(basic_string_view __x) const noexcept
{ return this->find(__x) != npos; }
+ [[nodiscard]]
constexpr bool
contains(_CharT __x) const noexcept
{ return this->find(__x) != npos; }
- [[__gnu__::__nonnull__]]
+ [[nodiscard, __gnu__::__nonnull__]]
constexpr bool
contains(const _CharT* __x) const noexcept
{ return this->find(__x) != npos; }
// [string.view.find], searching
+ [[nodiscard]]
constexpr size_type
find(basic_string_view __str, size_type __pos = 0) const noexcept
{ return this->find(__str._M_str, __pos, __str._M_len); }
+ [[nodiscard]]
constexpr size_type
find(_CharT __c, size_type __pos = 0) const noexcept;
+ [[nodiscard]]
constexpr size_type
find(const _CharT* __str, size_type __pos, size_type __n) const noexcept;
- __attribute__((__nonnull__)) constexpr size_type
+ [[nodiscard, __gnu__::__nonnull__]]
+ constexpr size_type
find(const _CharT* __str, size_type __pos = 0) const noexcept
{ return this->find(__str, __pos, traits_type::length(__str)); }
+ [[nodiscard]]
constexpr size_type
rfind(basic_string_view __str, size_type __pos = npos) const noexcept
{ return this->rfind(__str._M_str, __pos, __str._M_len); }
+ [[nodiscard]]
constexpr size_type
rfind(_CharT __c, size_type __pos = npos) const noexcept;
+ [[nodiscard]]
constexpr size_type
rfind(const _CharT* __str, size_type __pos, size_type __n) const noexcept;
- __attribute__((__nonnull__)) constexpr size_type
+ [[nodiscard, __gnu__::__nonnull__]]
+ constexpr size_type
rfind(const _CharT* __str, size_type __pos = npos) const noexcept
{ return this->rfind(__str, __pos, traits_type::length(__str)); }
+ [[nodiscard]]
constexpr size_type
find_first_of(basic_string_view __str, size_type __pos = 0) const noexcept
{ return this->find_first_of(__str._M_str, __pos, __str._M_len); }
+ [[nodiscard]]
constexpr size_type
find_first_of(_CharT __c, size_type __pos = 0) const noexcept
{ return this->find(__c, __pos); }
+ [[nodiscard]]
constexpr size_type
find_first_of(const _CharT* __str, size_type __pos,
size_type __n) const noexcept;
- __attribute__((__nonnull__)) constexpr size_type
+ [[nodiscard, __gnu__::__nonnull__]]
+ constexpr size_type
find_first_of(const _CharT* __str, size_type __pos = 0) const noexcept
{ return this->find_first_of(__str, __pos, traits_type::length(__str)); }
+ [[nodiscard]]
constexpr size_type
find_last_of(basic_string_view __str,
size_type __pos = npos) const noexcept
{ return this->find_last_of(__str._M_str, __pos, __str._M_len); }
+ [[nodiscard]]
constexpr size_type
find_last_of(_CharT __c, size_type __pos=npos) const noexcept
{ return this->rfind(__c, __pos); }
+ [[nodiscard]]
constexpr size_type
find_last_of(const _CharT* __str, size_type __pos,
size_type __n) const noexcept;
- __attribute__((__nonnull__)) constexpr size_type
+ [[nodiscard, __gnu__::__nonnull__]]
+ constexpr size_type
find_last_of(const _CharT* __str, size_type __pos = npos) const noexcept
{ return this->find_last_of(__str, __pos, traits_type::length(__str)); }
+ [[nodiscard]]
constexpr size_type
find_first_not_of(basic_string_view __str,
size_type __pos = 0) const noexcept
{ return this->find_first_not_of(__str._M_str, __pos, __str._M_len); }
+ [[nodiscard]]
constexpr size_type
find_first_not_of(_CharT __c, size_type __pos = 0) const noexcept;
+ [[nodiscard]]
constexpr size_type
find_first_not_of(const _CharT* __str,
size_type __pos, size_type __n) const noexcept;
- __attribute__((__nonnull__)) constexpr size_type
+ [[nodiscard, __gnu__::__nonnull__]]
+ constexpr size_type
find_first_not_of(const _CharT* __str, size_type __pos = 0) const noexcept
{
return this->find_first_not_of(__str, __pos,
traits_type::length(__str));
}
+ [[nodiscard]]
constexpr size_type
find_last_not_of(basic_string_view __str,
size_type __pos = npos) const noexcept
{ return this->find_last_not_of(__str._M_str, __pos, __str._M_len); }
+ [[nodiscard]]
constexpr size_type
find_last_not_of(_CharT __c, size_type __pos = npos) const noexcept;
+ [[nodiscard]]
constexpr size_type
find_last_not_of(const _CharT* __str,
size_type __pos, size_type __n) const noexcept;
- __attribute__((__nonnull__)) constexpr size_type
+ [[nodiscard, __gnu__::__nonnull__]]
+ constexpr size_type
find_last_not_of(const _CharT* __str,
size_type __pos = npos) const noexcept
{
// type (see N3766).
template<typename _CharT, typename _Traits>
+ [[nodiscard]]
constexpr bool
operator==(basic_string_view<_CharT, _Traits> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.size() == __y.size() && __x.compare(__y) == 0; }
template<typename _CharT, typename _Traits>
+ [[nodiscard]]
constexpr bool
operator==(basic_string_view<_CharT, _Traits> __x,
__type_identity_t<basic_string_view<_CharT, _Traits>> __y)
#if __cpp_lib_three_way_comparison
template<typename _CharT, typename _Traits>
+ [[nodiscard]]
constexpr auto
operator<=>(basic_string_view<_CharT, _Traits> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return __detail::__char_traits_cmp_cat<_Traits>(__x.compare(__y)); }
template<typename _CharT, typename _Traits>
+ [[nodiscard]]
constexpr auto
operator<=>(basic_string_view<_CharT, _Traits> __x,
__type_identity_t<basic_string_view<_CharT, _Traits>> __y)
{ return __detail::__char_traits_cmp_cat<_Traits>(__x.compare(__y)); }
#else
template<typename _CharT, typename _Traits>
+ [[nodiscard]]
constexpr bool
operator==(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.size() == __y.size() && __x.compare(__y) == 0; }
template<typename _CharT, typename _Traits>
+ [[nodiscard]]
constexpr bool
operator!=(basic_string_view<_CharT, _Traits> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return !(__x == __y); }
template<typename _CharT, typename _Traits>
+ [[nodiscard]]
constexpr bool
operator!=(basic_string_view<_CharT, _Traits> __x,
__type_identity_t<basic_string_view<_CharT, _Traits>> __y)
{ return !(__x == __y); }
template<typename _CharT, typename _Traits>
+ [[nodiscard]]
constexpr bool
operator!=(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return !(__x == __y); }
template<typename _CharT, typename _Traits>
+ [[nodiscard]]
constexpr bool
operator< (basic_string_view<_CharT, _Traits> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.compare(__y) < 0; }
template<typename _CharT, typename _Traits>
+ [[nodiscard]]
constexpr bool
operator< (basic_string_view<_CharT, _Traits> __x,
__type_identity_t<basic_string_view<_CharT, _Traits>> __y)
{ return __x.compare(__y) < 0; }
template<typename _CharT, typename _Traits>
+ [[nodiscard]]
constexpr bool
operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.compare(__y) < 0; }
template<typename _CharT, typename _Traits>
+ [[nodiscard]]
constexpr bool
operator> (basic_string_view<_CharT, _Traits> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.compare(__y) > 0; }
template<typename _CharT, typename _Traits>
+ [[nodiscard]]
constexpr bool
operator> (basic_string_view<_CharT, _Traits> __x,
__type_identity_t<basic_string_view<_CharT, _Traits>> __y)
{ return __x.compare(__y) > 0; }
template<typename _CharT, typename _Traits>
+ [[nodiscard]]
constexpr bool
operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.compare(__y) > 0; }
template<typename _CharT, typename _Traits>
+ [[nodiscard]]
constexpr bool
operator<=(basic_string_view<_CharT, _Traits> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.compare(__y) <= 0; }
template<typename _CharT, typename _Traits>
+ [[nodiscard]]
constexpr bool
operator<=(basic_string_view<_CharT, _Traits> __x,
__type_identity_t<basic_string_view<_CharT, _Traits>> __y)
{ return __x.compare(__y) <= 0; }
template<typename _CharT, typename _Traits>
+ [[nodiscard]]
constexpr bool
operator<=(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.compare(__y) <= 0; }
template<typename _CharT, typename _Traits>
+ [[nodiscard]]
constexpr bool
operator>=(basic_string_view<_CharT, _Traits> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.compare(__y) >= 0; }
template<typename _CharT, typename _Traits>
+ [[nodiscard]]
constexpr bool
operator>=(basic_string_view<_CharT, _Traits> __x,
__type_identity_t<basic_string_view<_CharT, _Traits>> __y)
{ return __x.compare(__y) >= 0; }
template<typename _CharT, typename _Traits>
+ [[nodiscard]]
constexpr bool
operator>=(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
struct hash<string_view>
: public __hash_base<size_t, string_view>
{
+ [[nodiscard]]
size_t
operator()(const string_view& __str) const noexcept
{ return std::_Hash_impl::hash(__str.data(), __str.length()); }
struct hash<wstring_view>
: public __hash_base<size_t, wstring_view>
{
+ [[nodiscard]]
size_t
operator()(const wstring_view& __s) const noexcept
{ return std::_Hash_impl::hash(__s.data(),
struct hash<u8string_view>
: public __hash_base<size_t, u8string_view>
{
+ [[nodiscard]]
size_t
operator()(const u8string_view& __str) const noexcept
{ return std::_Hash_impl::hash(__str.data(), __str.length()); }
struct hash<u16string_view>
: public __hash_base<size_t, u16string_view>
{
+ [[nodiscard]]
size_t
operator()(const u16string_view& __s) const noexcept
{ return std::_Hash_impl::hash(__s.data(),
struct hash<u32string_view>
: public __hash_base<size_t, u32string_view>
{
+ [[nodiscard]]
size_t
operator()(const u32string_view& __s) const noexcept
{ return std::_Hash_impl::hash(__s.data(),