diff options
Diffstat (limited to 'libcxx/include/string')
| -rw-r--r-- | libcxx/include/string | 1637 | 
1 files changed, 777 insertions, 860 deletions
| diff --git a/libcxx/include/string b/libcxx/include/string index 3723dc8a3938..9f5838d42583 100644 --- a/libcxx/include/string +++ b/libcxx/include/string @@ -13,6 +13,9 @@  /*      string synopsis +#include <compare> +#include <initializer_list> +  namespace std  { @@ -43,11 +46,13 @@ template <class stateT> bool operator!=(const fpos<stateT>& x, const fpos<stateT  template <class charT>  struct char_traits  { -    typedef charT     char_type; -    typedef ...       int_type; -    typedef streamoff off_type; -    typedef streampos pos_type; -    typedef mbstate_t state_type; +    using char_type           = charT; +    using int_type            = ...; +    using off_type            = streamoff; +    using pos_type            = streampos; +    using state_type          = mbstate_t; +    using comparison_category = strong_ordering; // Since C++20 only for the specializations +                                                 // char, wchar_t, char8_t, char16_t, and char32_t.      static void assign(char_type& c1, const char_type& c2) noexcept;      static constexpr bool eq(char_type c1, char_type c2) noexcept; @@ -104,6 +109,10 @@ public:                   const allocator_type& a = allocator_type());                                   // constexpr since C++20      basic_string(const basic_string& str, size_type pos, size_type n,                   const Allocator& a = Allocator());                                             // constexpr since C++20 +    constexpr basic_string( +        basic_string&& str, size_type pos, const Allocator& a = Allocator());                   // since C++23 +    constexpr basic_string( +        basic_string&& str, size_type pos, size_type n, const Allocator& a = Allocator());      // since C++23      template<class T>          basic_string(const T& t, size_type pos, size_type n, const Allocator& a = Allocator()); // C++17, constexpr since C++20      template <class T> @@ -256,8 +265,9 @@ public:      basic_string& replace(const_iterator i1, const_iterator i2, initializer_list<value_type>);  // constexpr since C++20      size_type copy(value_type* s, size_type n, size_type pos = 0) const;                        // constexpr since C++20 -    basic_string substr(size_type pos = 0, size_type n = npos) const;                           // constexpr since C++20 - +    basic_string substr(size_type pos = 0, size_type n = npos) const;                           // constexpr in C++20, removed in C++23 +    basic_string substr(size_type pos = 0, size_type n = npos) const&;                          // since C++23 +    constexpr basic_string substr(size_type pos = 0, size_type n = npos) &&;                    // since C++23      void swap(basic_string& str)          noexcept(allocator_traits<allocator_type>::propagate_on_container_swap::value ||                   allocator_traits<allocator_type>::is_always_equal::value);                     // C++17, constexpr since C++20 @@ -370,60 +380,68 @@ bool operator==(const basic_string<charT, traits, Allocator>& lhs,                  const basic_string<charT, traits, Allocator>& rhs) noexcept;                    // constexpr since C++20  template<class charT, class traits, class Allocator> -bool operator==(const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept;  // constexpr since C++20 +bool operator==(const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept;  // removed in C++20  template<class charT, class traits, class Allocator>  bool operator==(const basic_string<charT,traits,Allocator>& lhs, const charT* rhs) noexcept;    // constexpr since C++20  template<class charT, class traits, class Allocator>  bool operator!=(const basic_string<charT,traits,Allocator>& lhs, -                const basic_string<charT, traits, Allocator>& rhs) noexcept;                    // constexpr since C++20 +                const basic_string<charT, traits, Allocator>& rhs) noexcept;                    // removed in C++20  template<class charT, class traits, class Allocator> -bool operator!=(const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept;  // constexpr since C++20 +bool operator!=(const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept;  // removed in C++20  template<class charT, class traits, class Allocator> -bool operator!=(const basic_string<charT, traits, Allocator>& lhs, const charT* rhs) noexcept;  // constexpr since C++20 +bool operator!=(const basic_string<charT, traits, Allocator>& lhs, const charT* rhs) noexcept;  // removed in C++20  template<class charT, class traits, class Allocator>  bool operator< (const basic_string<charT, traits, Allocator>& lhs, -                const basic_string<charT, traits, Allocator>& rhs) noexcept;                    // constexpr since C++20 +                const basic_string<charT, traits, Allocator>& rhs) noexcept;                    // removed in C++20  template<class charT, class traits, class Allocator> -bool operator< (const basic_string<charT, traits, Allocator>& lhs, const charT* rhs) noexcept;  // constexpr since C++20 +bool operator< (const basic_string<charT, traits, Allocator>& lhs, const charT* rhs) noexcept;  // removed in C++20  template<class charT, class traits, class Allocator> -bool operator< (const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept;  // constexpr since C++20 +bool operator< (const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept;  // removed in C++20  template<class charT, class traits, class Allocator>  bool operator> (const basic_string<charT, traits, Allocator>& lhs, -                const basic_string<charT, traits, Allocator>& rhs) noexcept;                    // constexpr since C++20 +                const basic_string<charT, traits, Allocator>& rhs) noexcept;                    // removed in C++20  template<class charT, class traits, class Allocator> -bool operator> (const basic_string<charT, traits, Allocator>& lhs, const charT* rhs) noexcept;  // constexpr since C++20 +bool operator> (const basic_string<charT, traits, Allocator>& lhs, const charT* rhs) noexcept;  // removed in C++20  template<class charT, class traits, class Allocator> -bool operator> (const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept;  // constexpr since C++20 +bool operator> (const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept;  // removed in C++20  template<class charT, class traits, class Allocator>  bool operator<=(const basic_string<charT, traits, Allocator>& lhs, -                const basic_string<charT, traits, Allocator>& rhs) noexcept;                    // constexpr since C++20 +                const basic_string<charT, traits, Allocator>& rhs) noexcept;                    // removed in C++20  template<class charT, class traits, class Allocator> -bool operator<=(const basic_string<charT, traits, Allocator>& lhs, const charT* rhs) noexcept;  // constexpr since C++20 +bool operator<=(const basic_string<charT, traits, Allocator>& lhs, const charT* rhs) noexcept;  // removed in C++20  template<class charT, class traits, class Allocator> -bool operator<=(const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept;  // constexpr since C++20 +bool operator<=(const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept;  // removed in C++20  template<class charT, class traits, class Allocator>  bool operator>=(const basic_string<charT, traits, Allocator>& lhs, -                const basic_string<charT, traits, Allocator>& rhs) noexcept;                    // constexpr since C++20 +                const basic_string<charT, traits, Allocator>& rhs) noexcept;                    // removed in C++20  template<class charT, class traits, class Allocator> -bool operator>=(const basic_string<charT, traits, Allocator>& lhs, const charT* rhs) noexcept;  // constexpr since C++20 +bool operator>=(const basic_string<charT, traits, Allocator>& lhs, const charT* rhs) noexcept;  // removed in C++20  template<class charT, class traits, class Allocator> -bool operator>=(const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept;  // constexpr since C++20 +bool operator>=(const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept;  // removed in C++20 + +template<class charT, class traits, class Allocator>                                            // since C++20 +constexpr see below operator<=>(const basic_string<charT, traits, Allocator>& lhs, +                                const basic_string<charT, traits, Allocator>& rhs) noexcept; + +template<class charT, class traits, class Allocator>                                            // since C++20 +constexpr see below operator<=>(const basic_string<charT, traits, Allocator>& lhs, +                                const charT* rhs) noexcept;  template<class charT, class traits, class Allocator>  void swap(basic_string<charT, traits, Allocator>& lhs, @@ -526,15 +544,24 @@ basic_string<char32_t> operator "" s( const char32_t *str, size_t len );  #include <__format/enable_insertable.h>  #include <__functional/hash.h>  #include <__functional/unary_function.h> +#include <__fwd/string.h>  #include <__ios/fpos.h>  #include <__iterator/distance.h>  #include <__iterator/iterator_traits.h>  #include <__iterator/reverse_iterator.h>  #include <__iterator/wrap_iter.h>  #include <__memory/allocate_at_least.h> +#include <__memory/allocator.h> +#include <__memory/allocator_traits.h> +#include <__memory/compressed_pair.h> +#include <__memory/construct_at.h> +#include <__memory/pointer_traits.h>  #include <__memory/swap_allocator.h> +#include <__memory_resource/polymorphic_allocator.h>  #include <__string/char_traits.h>  #include <__string/extern_template_lists.h> +#include <__type_traits/is_allocator.h> +#include <__type_traits/noexcept_move_assign_container.h>  #include <__utility/auto_cast.h>  #include <__utility/move.h>  #include <__utility/swap.h> @@ -544,9 +571,7 @@ basic_string<char32_t> operator "" s( const char32_t *str, size_t len );  #include <cstdio>  // EOF  #include <cstdlib>  #include <cstring> -#include <iosfwd>  #include <limits> -#include <memory>  #include <stdexcept>  #include <string_view>  #include <type_traits> @@ -556,16 +581,6 @@ basic_string<char32_t> operator "" s( const char32_t *str, size_t len );  #  include <cwchar>  #endif -#ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES -#  include <algorithm> -#  include <functional> -#  include <iterator> -#  include <new> -#  include <typeinfo> -#  include <utility> -#  include <vector> -#endif -  // standard-mandated includes  // [iterator.range] @@ -593,27 +608,27 @@ _LIBCPP_BEGIN_NAMESPACE_STD  template<class _CharT, class _Traits, class _Allocator>  basic_string<_CharT, _Traits, _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20  operator+(const basic_string<_CharT, _Traits, _Allocator>& __x,            const basic_string<_CharT, _Traits, _Allocator>& __y);  template<class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_HIDDEN _LIBCPP_CONSTEXPR_SINCE_CXX20  basic_string<_CharT, _Traits, _Allocator>  operator+(const _CharT* __x, const basic_string<_CharT,_Traits,_Allocator>& __y);  template<class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20  basic_string<_CharT, _Traits, _Allocator>  operator+(_CharT __x, const basic_string<_CharT,_Traits,_Allocator>& __y);  template<class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20  basic_string<_CharT, _Traits, _Allocator>  operator+(const basic_string<_CharT, _Traits, _Allocator>& __x, const _CharT* __y);  template<class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20  basic_string<_CharT, _Traits, _Allocator>  operator+(const basic_string<_CharT, _Traits, _Allocator>& __x, _CharT __y); @@ -636,23 +651,10 @@ struct __can_be_converted_to_string_view : public _BoolConstant<       !is_convertible<const _Tp&, const _CharT*>::value      > {}; -#ifndef _LIBCPP_HAS_NO_CHAR8_T -typedef basic_string<char8_t> u8string; -#endif -typedef basic_string<char16_t> u16string; -typedef basic_string<char32_t> u32string; -  struct __uninitialized_size_tag {};  template<class _CharT, class _Traits, class _Allocator> -class -    _LIBCPP_TEMPLATE_VIS -#ifndef _LIBCPP_HAS_NO_CHAR8_T -    _LIBCPP_PREFERRED_NAME(u8string) -#endif -    _LIBCPP_PREFERRED_NAME(u16string) -    _LIBCPP_PREFERRED_NAME(u32string) -    basic_string +class basic_string  {  public:      typedef basic_string                                 __self; @@ -676,6 +678,11 @@ public:      static_assert(( is_same<typename allocator_type::value_type, value_type>::value),                    "Allocator::value_type must be same type as value_type"); +    static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value, +                  "[allocator.requirements] states that rebinding an allocator to the same type should result in the " +                  "original allocator"); + +    // TODO: Implement iterator bounds checking without requiring the global database.      typedef __wrap_iter<pointer>                         iterator;      typedef __wrap_iter<const_pointer>                   const_iterator;      typedef std::reverse_iterator<iterator>              reverse_iterator; @@ -787,13 +794,13 @@ private:      // Construct a string with the given allocator and enough storage to hold `__size` characters, but      // don't initialize the characters. The contents of the string, including the null terminator, must be      // initialized separately. -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      explicit basic_string(__uninitialized_size_tag, size_type __size, const allocator_type& __a)              : __r_(__default_init_tag(), __a) {          if (__size > max_size())              __throw_length_error();          if (__fits_in_sso(__size)) { -            __zero(); +            __r_.first() = __rep();              __set_short_size(__size);          } else {              auto __capacity = __recommend(__size) + 1; @@ -806,176 +813,289 @@ private:          std::__debug_db_insert_c(this);      } +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator __make_iterator(pointer __p) { +        return iterator(this, __p); +    } + +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator __make_const_iterator(const_pointer __p) const { +        return const_iterator(this, __p); +    } +  public: -    _LIBCPP_TEMPLATE_DATA_VIS -    static const size_type npos = -1; +  _LIBCPP_TEMPLATE_DATA_VIS static const size_type npos = -1; -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string() -        _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value); +  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string() +      _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value) +      : __r_(__default_init_tag(), __default_init_tag()) { +    std::__debug_db_insert_c(this); +    __default_init(); +  } -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 explicit basic_string(const allocator_type& __a) +  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit basic_string(const allocator_type& __a)  #if _LIBCPP_STD_VER <= 14 -        _NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value); +      _NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value)  #else -        _NOEXCEPT; +      _NOEXCEPT  #endif +      : __r_(__default_init_tag(), __a) { +    std::__debug_db_insert_c(this); +    __default_init(); +  } -    _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string(const basic_string& __str); -    _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string(const basic_string& __str, const allocator_type& __a); +  _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const basic_string& __str); +  _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const basic_string& __str, const allocator_type& __a);  #ifndef _LIBCPP_CXX03_LANG -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 -    basic_string(basic_string&& __str) -#if _LIBCPP_STD_VER <= 14 -        _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value); -#else -        _NOEXCEPT; -#endif +  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(basic_string&& __str) +#  if _LIBCPP_STD_VER <= 14 +      _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value) +#  else +      _NOEXCEPT +#  endif +      : __r_(std::move(__str.__r_)) { +    __str.__default_init(); +    std::__debug_db_insert_c(this); +    if (__is_long()) +      std::__debug_db_swap(this, &__str); +  } -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 -    basic_string(basic_string&& __str, const allocator_type& __a); +  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(basic_string&& __str, const allocator_type& __a) +      : __r_(__default_init_tag(), __a) { +    if (__str.__is_long() && __a != __str.__alloc()) // copy, not move +      __init(std::__to_address(__str.__get_long_pointer()), __str.__get_long_size()); +    else { +      if (__libcpp_is_constant_evaluated()) +        __r_.first() = __rep(); +      __r_.first() = __str.__r_.first(); +      __str.__default_init(); +    } +    std::__debug_db_insert_c(this); +    if (__is_long()) +      std::__debug_db_swap(this, &__str); +  }  #endif // _LIBCPP_CXX03_LANG -    template <class = __enable_if_t<__is_allocator<_Allocator>::value, nullptr_t> > -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 -    basic_string(const _CharT* __s) : __r_(__default_init_tag(), __default_init_tag()) { -      _LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*) detected nullptr"); -      __init(__s, traits_type::length(__s)); -      std::__debug_db_insert_c(this); -    } +  template <class = __enable_if_t<__is_allocator<_Allocator>::value, nullptr_t> > +  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const _CharT* __s) +      : __r_(__default_init_tag(), __default_init_tag()) { +    _LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*) detected nullptr"); +    __init(__s, traits_type::length(__s)); +    std::__debug_db_insert_c(this); +  } -    template <class = __enable_if_t<__is_allocator<_Allocator>::value, nullptr_t> > -        _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 -        basic_string(const _CharT* __s, const _Allocator& __a); +  template <class = __enable_if_t<__is_allocator<_Allocator>::value, nullptr_t> > +  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const _CharT* __s, const _Allocator& __a);  #if _LIBCPP_STD_VER > 20 -    basic_string(nullptr_t) = delete; +  basic_string(nullptr_t) = delete;  #endif -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 -    basic_string(const _CharT* __s, size_type __n); -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 -    basic_string(const _CharT* __s, size_type __n, const _Allocator& __a); -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 -    basic_string(size_type __n, _CharT __c); - -    template <class = __enable_if_t<__is_allocator<_Allocator>::value, nullptr_t> > -        _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 -        basic_string(size_type __n, _CharT __c, const _Allocator& __a); - -    _LIBCPP_CONSTEXPR_AFTER_CXX17 -    basic_string(const basic_string& __str, size_type __pos, size_type __n, -                 const _Allocator& __a = _Allocator()); -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 -    basic_string(const basic_string& __str, size_type __pos, -                 const _Allocator& __a = _Allocator()); - -    template<class _Tp, class = __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && !__is_same_uncvref<_Tp, basic_string>::value> > -        _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 -        basic_string(const _Tp& __t, size_type __pos, size_type __n, -                     const allocator_type& __a = allocator_type()); - -    template<class _Tp, class = __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && -                                          !__is_same_uncvref<_Tp, basic_string>::value> > -        _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 -        explicit basic_string(const _Tp& __t); - -    template<class _Tp, class = __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && !__is_same_uncvref<_Tp, basic_string>::value> > -        _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 -        explicit basic_string(const _Tp& __t, const allocator_type& __a); - -    template<class _InputIterator, class = __enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value> > -        _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 -        basic_string(_InputIterator __first, _InputIterator __last); -    template<class _InputIterator, class = __enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value> > -        _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 -        basic_string(_InputIterator __first, _InputIterator __last, const allocator_type& __a); +  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const _CharT* __s, size_type __n) +      : __r_(__default_init_tag(), __default_init_tag()) { +    _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "basic_string(const char*, n) detected nullptr"); +    __init(__s, __n); +    std::__debug_db_insert_c(this); +  } + +  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 +  basic_string(const _CharT* __s, size_type __n, const _Allocator& __a) +      : __r_(__default_init_tag(), __a) { +    _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "basic_string(const char*, n, allocator) detected nullptr"); +    __init(__s, __n); +    std::__debug_db_insert_c(this); +  } + +  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(size_type __n, _CharT __c) +      : __r_(__default_init_tag(), __default_init_tag()) { +    __init(__n, __c); +    std::__debug_db_insert_c(this); +  } + +#if _LIBCPP_STD_VER > 20 +  _LIBCPP_HIDE_FROM_ABI constexpr +  basic_string(basic_string&& __str, size_type __pos, const _Allocator& __alloc = _Allocator()) +      : basic_string(std::move(__str), __pos, npos, __alloc) {} + +  _LIBCPP_HIDE_FROM_ABI constexpr +  basic_string(basic_string&& __str, size_type __pos, size_type __n, const _Allocator& __alloc = _Allocator()) +      : __r_(__default_init_tag(), __alloc) { +    if (__pos > __str.size()) +      __throw_out_of_range(); + +    auto __len = std::min<size_type>(__n, __str.size() - __pos); +    if (__alloc_traits::is_always_equal::value || __alloc == __str.__alloc()) { +      __r_.first() = __str.__r_.first(); +      __str.__default_init(); + +      _Traits::move(data(), data() + __pos, __len); +      __set_size(__len); +      _Traits::assign(data()[__len], value_type()); +    } else { +      // Perform a copy because the allocators are not compatible. +      __init(__str.data() + __pos, __len); +    } + +    std::__debug_db_insert_c(this); +    if (__is_long()) +      std::__debug_db_swap(this, &__str); +  } +#endif + +  template <class = __enable_if_t<__is_allocator<_Allocator>::value, nullptr_t> > +  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(size_type __n, _CharT __c, const _Allocator& __a); + +  _LIBCPP_CONSTEXPR_SINCE_CXX20 +  basic_string(const basic_string& __str, size_type __pos, size_type __n, const _Allocator& __a = _Allocator()); + +  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 +  basic_string(const basic_string& __str, size_type __pos, const _Allocator& __a = _Allocator()) +      : __r_(__default_init_tag(), __a) { +    size_type __str_sz = __str.size(); +    if (__pos > __str_sz) +      __throw_out_of_range(); +    __init(__str.data() + __pos, __str_sz - __pos); +    std::__debug_db_insert_c(this); +  } + +  template <class _Tp, +            class = __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && +                                  !__is_same_uncvref<_Tp, basic_string>::value> > +  _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 +  basic_string(const _Tp& __t, size_type __pos, size_type __n, const allocator_type& __a = allocator_type()); + +  template <class _Tp, +            class = __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && +                                  !__is_same_uncvref<_Tp, basic_string>::value> > +  _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit basic_string( +      const _Tp& __t); + +  template <class _Tp, +            class = __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && +                                  !__is_same_uncvref<_Tp, basic_string>::value> > +  _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit basic_string( +      const _Tp& __t, const allocator_type& __a); + +  template <class _InputIterator, class = __enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value> > +  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(_InputIterator __first, _InputIterator __last) +      : __r_(__default_init_tag(), __default_init_tag()) { +    __init(__first, __last); +    std::__debug_db_insert_c(this); +  } + +  template <class _InputIterator, class = __enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value> > +  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 +  basic_string(_InputIterator __first, _InputIterator __last, const allocator_type& __a) +      : __r_(__default_init_tag(), __a) { +    __init(__first, __last); +    std::__debug_db_insert_c(this); +  } +  #ifndef _LIBCPP_CXX03_LANG -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 -    basic_string(initializer_list<_CharT> __il); -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 -    basic_string(initializer_list<_CharT> __il, const _Allocator& __a); +  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(initializer_list<_CharT> __il) +      : __r_(__default_init_tag(), __default_init_tag()) { +    __init(__il.begin(), __il.end()); +    std::__debug_db_insert_c(this); +  } + +  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(initializer_list<_CharT> __il, const _Allocator& __a) +      : __r_(__default_init_tag(), __a) { +    __init(__il.begin(), __il.end()); +    std::__debug_db_insert_c(this); +  }  #endif // _LIBCPP_CXX03_LANG -    inline _LIBCPP_CONSTEXPR_AFTER_CXX17 ~basic_string(); +    inline _LIBCPP_CONSTEXPR_SINCE_CXX20 ~basic_string(); -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      operator __self_view() const _NOEXCEPT { return __self_view(data(), size()); } -    _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& operator=(const basic_string& __str); +    _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator=(const basic_string& __str);      template <class _Tp, class = __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&                                                 !__is_same_uncvref<_Tp, basic_string>::value> > -    _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& operator=(const _Tp& __t) { +    _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator=(const _Tp& __t) {        __self_view __sv = __t;        return assign(__sv);      }  #ifndef _LIBCPP_CXX03_LANG -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 -    basic_string& operator=(basic_string&& __str) -        _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)); -     _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator=(basic_string&& __str) +      _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)) { +    __move_assign(__str, integral_constant<bool, __alloc_traits::propagate_on_container_move_assignment::value>()); +    return *this; +  } + +     _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      basic_string& operator=(initializer_list<value_type> __il) {return assign(__il.begin(), __il.size());}  #endif -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      basic_string& operator=(const value_type* __s) {return assign(__s);}  #if _LIBCPP_STD_VER > 20      basic_string& operator=(nullptr_t) = delete;  #endif -    _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& operator=(value_type __c); +    _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator=(value_type __c); -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      iterator begin() _NOEXCEPT -        {return iterator(this, __get_pointer());} -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +        {return __make_iterator(__get_pointer());} +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      const_iterator begin() const _NOEXCEPT -        {return const_iterator(this, __get_pointer());} -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +        {return __make_const_iterator(__get_pointer());} +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      iterator end() _NOEXCEPT -        {return iterator(this, __get_pointer() + size());} -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +        {return __make_iterator(__get_pointer() + size());} +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      const_iterator end() const _NOEXCEPT -        {return const_iterator(this, __get_pointer() + size());} +        {return __make_const_iterator(__get_pointer() + size());} -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      reverse_iterator rbegin() _NOEXCEPT          {return reverse_iterator(end());} -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      const_reverse_iterator rbegin() const _NOEXCEPT          {return const_reverse_iterator(end());} -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      reverse_iterator rend() _NOEXCEPT          {return reverse_iterator(begin());} -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      const_reverse_iterator rend() const _NOEXCEPT          {return const_reverse_iterator(begin());} -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      const_iterator cbegin() const _NOEXCEPT          {return begin();} -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      const_iterator cend() const _NOEXCEPT          {return end();} -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      const_reverse_iterator crbegin() const _NOEXCEPT          {return rbegin();} -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      const_reverse_iterator crend() const _NOEXCEPT          {return rend();} -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 size_type size() const _NOEXCEPT +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type size() const _NOEXCEPT          {return __is_long() ? __get_long_size() : __get_short_size();} -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 size_type length() const _NOEXCEPT {return size();} -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 size_type max_size() const _NOEXCEPT; -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 size_type capacity() const _NOEXCEPT { +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type length() const _NOEXCEPT {return size();} + +  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type max_size() const _NOEXCEPT { +    size_type __m = __alloc_traits::max_size(__alloc()); +    if (__m <= std::numeric_limits<size_type>::max() / 2) { +      return __m - __alignment; +    } else { +    bool __uses_lsb = __endian_factor == 2; +      return __uses_lsb ? __m - __alignment : (__m / 2) - __alignment; +    } +  } + +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type capacity() const _NOEXCEPT {          return (__is_long() ? __get_long_cap() : static_cast<size_type>(__min_cap)) - 1;      } -    _LIBCPP_CONSTEXPR_AFTER_CXX17 void resize(size_type __n, value_type __c); -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 void resize(size_type __n) { resize(__n, value_type()); } +    _LIBCPP_CONSTEXPR_SINCE_CXX20 void resize(size_type __n, value_type __c); +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void resize(size_type __n) { resize(__n, value_type()); } -    _LIBCPP_CONSTEXPR_AFTER_CXX17 void reserve(size_type __requested_capacity); +    _LIBCPP_CONSTEXPR_SINCE_CXX20 void reserve(size_type __requested_capacity);  #if _LIBCPP_STD_VER > 20      template <class _Op> @@ -986,28 +1106,34 @@ public:      }  #endif -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 void __resize_default_init(size_type __n); +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __resize_default_init(size_type __n);      _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_HIDE_FROM_ABI void reserve() _NOEXCEPT { shrink_to_fit(); } -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 void shrink_to_fit() _NOEXCEPT; -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 void clear() _NOEXCEPT; +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void shrink_to_fit() _NOEXCEPT; +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void clear() _NOEXCEPT; -    _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      bool empty() const _NOEXCEPT {return size() == 0;} -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 -    const_reference operator[](size_type __pos) const _NOEXCEPT; -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 reference operator[](size_type __pos) _NOEXCEPT; +  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference operator[](size_type __pos) const _NOEXCEPT { +    _LIBCPP_ASSERT(__pos <= size(), "string index out of bounds"); +    return *(data() + __pos); +  } + +  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference operator[](size_type __pos) _NOEXCEPT { +    _LIBCPP_ASSERT(__pos <= size(), "string index out of bounds"); +    return *(__get_pointer() + __pos); +  } -    _LIBCPP_CONSTEXPR_AFTER_CXX17 const_reference at(size_type __n) const; -    _LIBCPP_CONSTEXPR_AFTER_CXX17 reference       at(size_type __n); +    _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference at(size_type __n) const; +    _LIBCPP_CONSTEXPR_SINCE_CXX20 reference       at(size_type __n); -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& operator+=(const basic_string& __str) { +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator+=(const basic_string& __str) {          return append(__str);      }      template <class _Tp> -    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20      __enable_if_t          <              __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value @@ -1018,35 +1144,36 @@ public:          __self_view __sv = __t; return append(__sv);      } -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& operator+=(const value_type* __s) { +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator+=(const value_type* __s) {          return append(__s);      } -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& operator+=(value_type __c) { +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator+=(value_type __c) {          push_back(__c);          return *this;      }  #ifndef _LIBCPP_CXX03_LANG -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      basic_string& operator+=(initializer_list<value_type> __il) { return append(__il); }  #endif // _LIBCPP_CXX03_LANG -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 -    basic_string& append(const basic_string& __str); +  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(const basic_string& __str) { +        return append(__str.data(), __str.size()); +  }      template <class _Tp> -    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20      __enable_if_t<              __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value              && !__is_same_uncvref<_Tp, basic_string>::value,              basic_string&          >                    append(const _Tp& __t) { __self_view __sv = __t; return append(__sv.data(), __sv.size()); } -    _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& append(const basic_string& __str, size_type __pos, size_type __n=npos); +    _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(const basic_string& __str, size_type __pos, size_type __n=npos);      template <class _Tp> -    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20      __enable_if_t          <              __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value @@ -1054,11 +1181,11 @@ public:              basic_string&          >                    append(const _Tp& __t, size_type __pos, size_type __n=npos); -    _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& append(const value_type* __s, size_type __n); -    _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& append(const value_type* __s); -    _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& append(size_type __n, value_type __c); +    _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(const value_type* __s, size_type __n); +    _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(const value_type* __s); +    _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(size_type __n, value_type __c); -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      void __append_default_init(size_type __n);      template<class _InputIterator> @@ -1068,7 +1195,7 @@ public:              __is_exactly_cpp17_input_iterator<_InputIterator>::value,              basic_string&          > -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      append(_InputIterator __first, _InputIterator __last) {        const basic_string __temp(__first, __last, __alloc());        append(__temp.data(), __temp.size()); @@ -1081,40 +1208,56 @@ public:              __is_cpp17_forward_iterator<_ForwardIterator>::value,              basic_string&          > -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      append(_ForwardIterator __first, _ForwardIterator __last);  #ifndef _LIBCPP_CXX03_LANG -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      basic_string& append(initializer_list<value_type> __il) {return append(__il.begin(), __il.size());}  #endif // _LIBCPP_CXX03_LANG -    _LIBCPP_CONSTEXPR_AFTER_CXX17 void push_back(value_type __c); -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 void pop_back(); -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 reference       front() _NOEXCEPT; -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 const_reference front() const _NOEXCEPT; -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 reference       back() _NOEXCEPT; -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 const_reference back() const _NOEXCEPT; +    _LIBCPP_CONSTEXPR_SINCE_CXX20 void push_back(value_type __c); +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void pop_back(); + +  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference front() _NOEXCEPT { +    _LIBCPP_ASSERT(!empty(), "string::front(): string is empty"); +    return *__get_pointer(); +  } + +  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference front() const _NOEXCEPT { +    _LIBCPP_ASSERT(!empty(), "string::front(): string is empty"); +    return *data(); +  } + +  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference back() _NOEXCEPT { +    _LIBCPP_ASSERT(!empty(), "string::back(): string is empty"); +    return *(__get_pointer() + size() - 1); +  } + +  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference back() const _NOEXCEPT { +    _LIBCPP_ASSERT(!empty(), "string::back(): string is empty"); +    return *(data() + size() - 1); +  }      template <class _Tp> -    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20      __enable_if_t          <              __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,              basic_string&          >                   assign(const _Tp & __t) { __self_view __sv = __t; return assign(__sv.data(), __sv.size()); } -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      basic_string& assign(const basic_string& __str) { return *this = __str; }  #ifndef _LIBCPP_CXX03_LANG -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      basic_string& assign(basic_string&& __str)          _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value))          {*this = std::move(__str); return *this;}  #endif -    _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& assign(const basic_string& __str, size_type __pos, size_type __n=npos); +    _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(const basic_string& __str, size_type __pos, size_type __n=npos);      template <class _Tp> -    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20      __enable_if_t          <              __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value @@ -1122,11 +1265,11 @@ public:              basic_string&          >                    assign(const _Tp & __t, size_type __pos, size_type __n=npos); -    _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& assign(const value_type* __s, size_type __n); -    _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& assign(const value_type* __s); -    _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& assign(size_type __n, value_type __c); +    _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(const value_type* __s, size_type __n); +    _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(const value_type* __s); +    _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(size_type __n, value_type __c);      template<class _InputIterator> -    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20      __enable_if_t          <              __is_exactly_cpp17_input_iterator<_InputIterator>::value, @@ -1134,7 +1277,7 @@ public:          >          assign(_InputIterator __first, _InputIterator __last);      template<class _ForwardIterator> -    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20      __enable_if_t          <              __is_cpp17_forward_iterator<_ForwardIterator>::value, @@ -1142,15 +1285,17 @@ public:          >          assign(_ForwardIterator __first, _ForwardIterator __last);  #ifndef _LIBCPP_CXX03_LANG -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      basic_string& assign(initializer_list<value_type> __il) {return assign(__il.begin(), __il.size());}  #endif // _LIBCPP_CXX03_LANG -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 -    basic_string& insert(size_type __pos1, const basic_string& __str); +  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& +  insert(size_type __pos1, const basic_string& __str) { +    return insert(__pos1, __str.data(), __str.size()); +  }      template <class _Tp> -    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20      __enable_if_t          <              __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, @@ -1160,23 +1305,31 @@ public:      { __self_view __sv = __t; return insert(__pos1, __sv.data(), __sv.size()); }      template <class _Tp> -    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20      __enable_if_t          <              __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && !__is_same_uncvref<_Tp, basic_string>::value,              basic_string&          >                    insert(size_type __pos1, const _Tp& __t, size_type __pos2, size_type __n=npos); -    _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_CONSTEXPR_SINCE_CXX20      basic_string& insert(size_type __pos1, const basic_string& __str, size_type __pos2, size_type __n=npos); -    _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& insert(size_type __pos, const value_type* __s, size_type __n); -    _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& insert(size_type __pos, const value_type* __s); -    _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& insert(size_type __pos, size_type __n, value_type __c); -    _LIBCPP_CONSTEXPR_AFTER_CXX17 iterator      insert(const_iterator __pos, value_type __c); -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 -    iterator      insert(const_iterator __pos, size_type __n, value_type __c); +    _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& insert(size_type __pos, const value_type* __s, size_type __n); +    _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& insert(size_type __pos, const value_type* __s); +    _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& insert(size_type __pos, size_type __n, value_type __c); +    _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator      insert(const_iterator __pos, value_type __c); + +  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator +  insert(const_iterator __pos, size_type __n, value_type __c) { +    _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(&__pos) == this, +                         "string::insert(iterator, n, value) called with an iterator not referring to this string"); +    difference_type __p = __pos - begin(); +    insert(static_cast<size_type>(__p), __n, __c); +    return begin() + __p; +  } +      template<class _InputIterator> -    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20      __enable_if_t          <              __is_exactly_cpp17_input_iterator<_InputIterator>::value, @@ -1184,7 +1337,7 @@ public:          >          insert(const_iterator __pos, _InputIterator __first, _InputIterator __last);      template<class _ForwardIterator> -    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20      __enable_if_t          <              __is_cpp17_forward_iterator<_ForwardIterator>::value, @@ -1192,47 +1345,53 @@ public:          >          insert(const_iterator __pos, _ForwardIterator __first, _ForwardIterator __last);  #ifndef _LIBCPP_CXX03_LANG -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      iterator insert(const_iterator __pos, initializer_list<value_type> __il)                      {return insert(__pos, __il.begin(), __il.end());}  #endif // _LIBCPP_CXX03_LANG -    _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& erase(size_type __pos = 0, size_type __n = npos); -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& erase(size_type __pos = 0, size_type __n = npos); +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      iterator      erase(const_iterator __pos); -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      iterator      erase(const_iterator __first, const_iterator __last); -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 -    basic_string& replace(size_type __pos1, size_type __n1, const basic_string& __str); +  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& +  replace(size_type __pos1, size_type __n1, const basic_string& __str) { +    return replace(__pos1, __n1, __str.data(), __str.size()); +  }      template <class _Tp> -    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20      __enable_if_t          <              __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,              basic_string&          >                    replace(size_type __pos1, size_type __n1, const _Tp& __t) { __self_view __sv = __t; return replace(__pos1, __n1, __sv.data(), __sv.size()); } -    _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_CONSTEXPR_SINCE_CXX20      basic_string& replace(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2=npos);      template <class _Tp> -    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20      __enable_if_t          <              __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value  && !__is_same_uncvref<_Tp, basic_string>::value,              basic_string&          >                    replace(size_type __pos1, size_type __n1, const _Tp& __t, size_type __pos2, size_type __n2=npos); -    _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_CONSTEXPR_SINCE_CXX20      basic_string& replace(size_type __pos, size_type __n1, const value_type* __s, size_type __n2); -    _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& replace(size_type __pos, size_type __n1, const value_type* __s); -    _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& replace(size_type __pos, size_type __n1, size_type __n2, value_type __c); -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 -    basic_string& replace(const_iterator __i1, const_iterator __i2, const basic_string& __str); +    _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& replace(size_type __pos, size_type __n1, const value_type* __s); +    _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& replace(size_type __pos, size_type __n1, size_type __n2, value_type __c); + +  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& +  replace(const_iterator __i1, const_iterator __i2, const basic_string& __str) { +    return replace( +        static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), __str.data(), __str.size()); +  }      template <class _Tp> -    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20      __enable_if_t          <              __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, @@ -1240,14 +1399,23 @@ public:          >                    replace(const_iterator __i1, const_iterator __i2, const _Tp& __t) { __self_view __sv = __t; return replace(__i1 - begin(), __i2 - __i1, __sv); } -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 -    basic_string& replace(const_iterator __i1, const_iterator __i2, const value_type* __s, size_type __n); -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 -    basic_string& replace(const_iterator __i1, const_iterator __i2, const value_type* __s); -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 -    basic_string& replace(const_iterator __i1, const_iterator __i2, size_type __n, value_type __c); +  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& +  replace(const_iterator __i1, const_iterator __i2, const value_type* __s, size_type __n) { +    return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), __s, __n); +  } + +  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& +  replace(const_iterator __i1, const_iterator __i2, const value_type* __s) { +    return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), __s); +  } + +  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& +  replace(const_iterator __i1, const_iterator __i2, size_type __n, value_type __c) { +    return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), __n, __c); +  } +      template<class _InputIterator> -    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20      __enable_if_t          <              __is_cpp17_input_iterator<_InputIterator>::value, @@ -1255,16 +1423,31 @@ public:          >          replace(const_iterator __i1, const_iterator __i2, _InputIterator __j1, _InputIterator __j2);  #ifndef _LIBCPP_CXX03_LANG -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      basic_string& replace(const_iterator __i1, const_iterator __i2, initializer_list<value_type> __il)          {return replace(__i1, __i2, __il.begin(), __il.end());}  #endif // _LIBCPP_CXX03_LANG -    _LIBCPP_CONSTEXPR_AFTER_CXX17 size_type copy(value_type* __s, size_type __n, size_type __pos = 0) const; -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 -    basic_string substr(size_type __pos = 0, size_type __n = npos) const; +    _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type copy(value_type* __s, size_type __n, size_type __pos = 0) const; -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +#if _LIBCPP_STD_VER <= 20 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 +    basic_string substr(size_type __pos = 0, size_type __n = npos) const { +      return basic_string(*this, __pos, __n); +    } +#else +    _LIBCPP_HIDE_FROM_ABI constexpr +    basic_string substr(size_type __pos = 0, size_type __n = npos) const& { +      return basic_string(*this, __pos, __n); +    } + +    _LIBCPP_HIDE_FROM_ABI constexpr +    basic_string substr(size_type __pos = 0, size_type __n = npos) && { +      return basic_string(std::move(*this), __pos, __n); +    } +#endif + +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      void swap(basic_string& __str)  #if _LIBCPP_STD_VER >= 14          _NOEXCEPT; @@ -1273,129 +1456,129 @@ public:                      __is_nothrow_swappable<allocator_type>::value);  #endif -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      const value_type* c_str() const _NOEXCEPT {return data();} -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      const value_type* data() const _NOEXCEPT  {return std::__to_address(__get_pointer());}  #if _LIBCPP_STD_VER > 14 || defined(_LIBCPP_BUILDING_LIBRARY) -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      value_type* data()             _NOEXCEPT  {return std::__to_address(__get_pointer());}  #endif -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      allocator_type get_allocator() const _NOEXCEPT {return __alloc();} -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      size_type find(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT;      template <class _Tp> -    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20      __enable_if_t          <              __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,              size_type          >                find(const _Tp& __t, size_type __pos = 0) const _NOEXCEPT; -    _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_CONSTEXPR_SINCE_CXX20      size_type find(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT; -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      size_type find(const value_type* __s, size_type __pos = 0) const _NOEXCEPT; -    _LIBCPP_CONSTEXPR_AFTER_CXX17 size_type find(value_type __c, size_type __pos = 0) const _NOEXCEPT; +    _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type find(value_type __c, size_type __pos = 0) const _NOEXCEPT; -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      size_type rfind(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT;      template <class _Tp> -    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20      __enable_if_t          <              __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,              size_type          >                rfind(const _Tp& __t, size_type __pos = npos) const _NOEXCEPT; -    _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_CONSTEXPR_SINCE_CXX20      size_type rfind(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT; -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      size_type rfind(const value_type* __s, size_type __pos = npos) const _NOEXCEPT; -    _LIBCPP_CONSTEXPR_AFTER_CXX17 size_type rfind(value_type __c, size_type __pos = npos) const _NOEXCEPT; +    _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type rfind(value_type __c, size_type __pos = npos) const _NOEXCEPT; -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      size_type find_first_of(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT;      template <class _Tp> -    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20      __enable_if_t          <              __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,              size_type          >                find_first_of(const _Tp& __t, size_type __pos = 0) const _NOEXCEPT; -    _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_CONSTEXPR_SINCE_CXX20      size_type find_first_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT; -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      size_type find_first_of(const value_type* __s, size_type __pos = 0) const _NOEXCEPT; -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      size_type find_first_of(value_type __c, size_type __pos = 0) const _NOEXCEPT; -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      size_type find_last_of(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT;      template <class _Tp> -    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20      __enable_if_t          <              __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,              size_type          >                find_last_of(const _Tp& __t, size_type __pos = npos) const _NOEXCEPT; -    _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_CONSTEXPR_SINCE_CXX20      size_type find_last_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT; -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      size_type find_last_of(const value_type* __s, size_type __pos = npos) const _NOEXCEPT; -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      size_type find_last_of(value_type __c, size_type __pos = npos) const _NOEXCEPT; -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      size_type find_first_not_of(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT;      template <class _Tp> -    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20      __enable_if_t          <              __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,              size_type          >                find_first_not_of(const _Tp &__t, size_type __pos = 0) const _NOEXCEPT; -    _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_CONSTEXPR_SINCE_CXX20      size_type find_first_not_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT; -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      size_type find_first_not_of(const value_type* __s, size_type __pos = 0) const _NOEXCEPT; -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      size_type find_first_not_of(value_type __c, size_type __pos = 0) const _NOEXCEPT; -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      size_type find_last_not_of(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT;      template <class _Tp> -    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20      __enable_if_t          <              __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,              size_type          >                find_last_not_of(const _Tp& __t, size_type __pos = npos) const _NOEXCEPT; -    _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_CONSTEXPR_SINCE_CXX20      size_type find_last_not_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT; -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      size_type find_last_not_of(const value_type* __s, size_type __pos = npos) const _NOEXCEPT; -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      size_type find_last_not_of(value_type __c, size_type __pos = npos) const _NOEXCEPT; -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      int compare(const basic_string& __str) const _NOEXCEPT;      template <class _Tp> -    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20      __enable_if_t          <              __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, @@ -1404,7 +1587,7 @@ public:          compare(const _Tp &__t) const _NOEXCEPT;      template <class _Tp> -    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20      __enable_if_t          <              __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, @@ -1412,23 +1595,23 @@ public:          >           compare(size_type __pos1, size_type __n1, const _Tp& __t) const; -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      int compare(size_type __pos1, size_type __n1, const basic_string& __str) const; -    _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_CONSTEXPR_SINCE_CXX20      int compare(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2,                  size_type __n2 = npos) const;      template <class _Tp> -    inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20          __enable_if_t          <              __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value  && !__is_same_uncvref<_Tp, basic_string>::value,              int          >          compare(size_type __pos1, size_type __n1, const _Tp& __t, size_type __pos2, size_type __n2=npos) const; -    _LIBCPP_CONSTEXPR_AFTER_CXX17 int compare(const value_type* __s) const _NOEXCEPT; -    _LIBCPP_CONSTEXPR_AFTER_CXX17 int compare(size_type __pos1, size_type __n1, const value_type* __s) const; -    _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_CONSTEXPR_SINCE_CXX20 int compare(const value_type* __s) const _NOEXCEPT; +    _LIBCPP_CONSTEXPR_SINCE_CXX20 int compare(size_type __pos1, size_type __n1, const value_type* __s) const; +    _LIBCPP_CONSTEXPR_SINCE_CXX20      int compare(size_type __pos1, size_type __n1, const value_type* __s, size_type __n2) const;  #if _LIBCPP_STD_VER > 17 @@ -1471,9 +1654,9 @@ public:      { return __self_view(data(), size()).contains(__s); }  #endif -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 bool __invariants() const; +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __invariants() const; -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 void __clear_and_shrink() _NOEXCEPT; +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __clear_and_shrink() _NOEXCEPT;  #ifdef _LIBCPP_ENABLE_DEBUG_MODE @@ -1486,20 +1669,20 @@ public:  private:      template<class _Alloc> -    inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      bool friend operator==(const basic_string<char, char_traits<char>, _Alloc>& __lhs,                             const basic_string<char, char_traits<char>, _Alloc>& __rhs) _NOEXCEPT; -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 void __shrink_or_extend(size_type __target_capacity); +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __shrink_or_extend(size_type __target_capacity); -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      bool __is_long() const _NOEXCEPT {          if (__libcpp_is_constant_evaluated())              return true;          return __r_.first().__s.__is_long_;      } -    static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 void __begin_lifetime(pointer __begin, size_type __n) { +    static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __begin_lifetime(pointer __begin, size_type __n) {  #if _LIBCPP_STD_VER > 17          if (__libcpp_is_constant_evaluated()) {              for (size_type __i = 0; __i != __n; ++__i) @@ -1511,8 +1694,8 @@ private:  #endif // _LIBCPP_STD_VER > 17      } -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 void __default_init() { -        __zero(); +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __default_init() { +        __r_.first() = __rep();          if (__libcpp_is_constant_evaluated()) {              size_type __sz = __recommend(0) + 1;              pointer __ptr = __alloc_traits::allocate(__alloc(), __sz); @@ -1523,7 +1706,7 @@ private:          }      } -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 void __deallocate_constexpr() { +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __deallocate_constexpr() {          if (__libcpp_is_constant_evaluated() && __get_pointer() != nullptr)              __alloc_traits::deallocate(__alloc(), __get_pointer(), __get_long_cap());      } @@ -1534,7 +1717,7 @@ private:      }      template <class _ForwardIterator> -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14      iterator __insert_from_safe_copy(size_type __n, size_type __ip, _ForwardIterator __first, _ForwardIterator __last) {          size_type __sz = size();          size_type __cap = capacity(); @@ -1560,76 +1743,71 @@ private:          return begin() + __ip;      } -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 allocator_type& __alloc() _NOEXCEPT { return __r_.second(); } +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 allocator_type& __alloc() _NOEXCEPT { return __r_.second(); }      _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const allocator_type& __alloc() const _NOEXCEPT { return __r_.second(); } -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      void __set_short_size(size_type __s) _NOEXCEPT {          _LIBCPP_ASSERT(__s < __min_cap, "__s should never be greater than or equal to the short string capacity");          __r_.first().__s.__size_ = __s;          __r_.first().__s.__is_long_ = false;      } -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      size_type __get_short_size() const _NOEXCEPT {          _LIBCPP_ASSERT(!__r_.first().__s.__is_long_, "String has to be short when trying to get the short size");          return __r_.first().__s.__size_;      } -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      void __set_long_size(size_type __s) _NOEXCEPT          {__r_.first().__l.__size_ = __s;} -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      size_type __get_long_size() const _NOEXCEPT          {return __r_.first().__l.__size_;} -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      void __set_size(size_type __s) _NOEXCEPT          {if (__is_long()) __set_long_size(__s); else __set_short_size(__s);} -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      void __set_long_cap(size_type __s) _NOEXCEPT {          __r_.first().__l.__cap_ = __s / __endian_factor;          __r_.first().__l.__is_long_ = true;      } -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      size_type __get_long_cap() const _NOEXCEPT {          return __r_.first().__l.__cap_ * __endian_factor;      } -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      void __set_long_pointer(pointer __p) _NOEXCEPT          {__r_.first().__l.__data_ = __p;} -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      pointer __get_long_pointer() _NOEXCEPT          {return __r_.first().__l.__data_;} -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      const_pointer __get_long_pointer() const _NOEXCEPT          {return __r_.first().__l.__data_;} -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      pointer __get_short_pointer() _NOEXCEPT          {return pointer_traits<pointer>::pointer_to(__r_.first().__s.__data_[0]);} -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      const_pointer __get_short_pointer() const _NOEXCEPT          {return pointer_traits<const_pointer>::pointer_to(__r_.first().__s.__data_[0]);} -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      pointer __get_pointer() _NOEXCEPT          {return __is_long() ? __get_long_pointer() : __get_short_pointer();} -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      const_pointer __get_pointer() const _NOEXCEPT          {return __is_long() ? __get_long_pointer() : __get_short_pointer();} -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 -    void __zero() _NOEXCEPT { -        __r_.first() = __rep(); -    } -      template <size_type __a> static -        _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +        _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20          size_type __align_it(size_type __s) _NOEXCEPT              {return (__s + (__a-1)) & ~(__a-1);}      enum {__alignment = 16}; -    static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      size_type __recommend(size_type __s) _NOEXCEPT      {          if (__s < __min_cap) { @@ -1644,11 +1822,11 @@ private:          return __guess;      } -    inline _LIBCPP_CONSTEXPR_AFTER_CXX17 +    inline _LIBCPP_CONSTEXPR_SINCE_CXX20      void __init(const value_type* __s, size_type __sz, size_type __reserve); -    inline _LIBCPP_CONSTEXPR_AFTER_CXX17 +    inline _LIBCPP_CONSTEXPR_SINCE_CXX20      void __init(const value_type* __s, size_type __sz); -    inline _LIBCPP_CONSTEXPR_AFTER_CXX17 +    inline _LIBCPP_CONSTEXPR_SINCE_CXX20      void __init(size_type __n, value_type __c);      // Slow path for the (inlined) copy constructor for 'long' strings. @@ -1659,10 +1837,10 @@ private:      // to call the __init() functions as those are marked as inline which may      // result in over-aggressive inlining by the compiler, where our aim is      // to only inline the fast path code directly in the ctor. -    _LIBCPP_CONSTEXPR_AFTER_CXX17 void __init_copy_ctor_external(const value_type* __s, size_type __sz); +    _LIBCPP_CONSTEXPR_SINCE_CXX20 void __init_copy_ctor_external(const value_type* __s, size_type __sz);      template <class _InputIterator> -    inline _LIBCPP_CONSTEXPR_AFTER_CXX17 +    inline _LIBCPP_CONSTEXPR_SINCE_CXX20      __enable_if_t      <          __is_exactly_cpp17_input_iterator<_InputIterator>::value @@ -1670,17 +1848,17 @@ private:      __init(_InputIterator __first, _InputIterator __last);      template <class _ForwardIterator> -    inline _LIBCPP_CONSTEXPR_AFTER_CXX17 +    inline _LIBCPP_CONSTEXPR_SINCE_CXX20      __enable_if_t      <          __is_cpp17_forward_iterator<_ForwardIterator>::value      >      __init(_ForwardIterator __first, _ForwardIterator __last); -    _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_CONSTEXPR_SINCE_CXX20      void __grow_by(size_type __old_cap, size_type __delta_cap, size_type __old_sz,                     size_type __n_copy,  size_type __n_del,     size_type __n_add = 0); -    _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_CONSTEXPR_SINCE_CXX20      void __grow_by_and_replace(size_type __old_cap, size_type __delta_cap, size_type __old_sz,                                 size_type __n_copy,  size_type __n_del,                                 size_type __n_add, const value_type* __p_new_stuff); @@ -1689,21 +1867,22 @@ private:      // have proof that the input does not alias the current instance.      // For example, operator=(basic_string) performs a 'self' check.      template <bool __is_short> -    _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& __assign_no_alias(const value_type* __s, size_type __n); +    _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& __assign_no_alias(const value_type* __s, size_type __n); -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 -    void __erase_to_end(size_type __pos); +  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __erase_to_end(size_type __pos) { +    __null_terminate_at(std::__to_address(__get_pointer()), __pos); +  }      // __erase_external_with_move is invoked for erase() invocations where      // `n ~= npos`, likely requiring memory moves on the string data. -    _LIBCPP_CONSTEXPR_AFTER_CXX17 void __erase_external_with_move(size_type __pos, size_type __n); +    _LIBCPP_CONSTEXPR_SINCE_CXX20 void __erase_external_with_move(size_type __pos, size_type __n); -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      void __copy_assign_alloc(const basic_string& __str)          {__copy_assign_alloc(__str, integral_constant<bool,                        __alloc_traits::propagate_on_container_copy_assignment::value>());} -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      void __copy_assign_alloc(const basic_string& __str, true_type)          {              if (__alloc() == __str.__alloc()) @@ -1720,7 +1899,7 @@ private:                      allocator_type __a = __str.__alloc();                      auto __allocation = std::__allocate_at_least(__a, __str.__get_long_cap());                      __begin_lifetime(__allocation.ptr, __allocation.count); -                    __clear_and_shrink(); +                    __alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap());                      __alloc() = std::move(__a);                      __set_long_pointer(__allocation.ptr);                      __set_long_cap(__allocation.count); @@ -1729,15 +1908,15 @@ private:              }          } -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      void __copy_assign_alloc(const basic_string&, false_type) _NOEXCEPT          {}  #ifndef _LIBCPP_CXX03_LANG -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      void __move_assign(basic_string& __str, false_type)          _NOEXCEPT_(__alloc_traits::is_always_equal::value); -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      void __move_assign(basic_string& __str, true_type)  #if _LIBCPP_STD_VER > 14          _NOEXCEPT; @@ -1746,7 +1925,7 @@ private:  #endif  #endif -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      void      __move_assign_alloc(basic_string& __str)          _NOEXCEPT_( @@ -1755,20 +1934,20 @@ private:      {__move_assign_alloc(__str, integral_constant<bool,                        __alloc_traits::propagate_on_container_move_assignment::value>());} -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      void __move_assign_alloc(basic_string& __c, true_type)          _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)          {              __alloc() = std::move(__c.__alloc());          } -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      void __move_assign_alloc(basic_string&, false_type)          _NOEXCEPT          {} -    _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& __assign_external(const value_type* __s); -    _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& __assign_external(const value_type* __s, size_type __n); +    _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& __assign_external(const value_type* __s); +    _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& __assign_external(const value_type* __s, size_type __n);      // Assigns the value in __s, guaranteed to be __n < __min_cap in length.      inline basic_string& __assign_short(const value_type* __s, size_type __n) { @@ -1780,7 +1959,7 @@ private:        return *this;      } -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      basic_string& __null_terminate_at(value_type* __p, size_type __newsz) {        __set_size(__newsz);        __invalidate_iterators_past(__newsz); @@ -1788,10 +1967,10 @@ private:        return *this;      } -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 void __invalidate_iterators_past(size_type); +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __invalidate_iterators_past(size_type);      template<class _Tp> -    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      bool __addr_in_range(_Tp&& __t) const {          // assume that the ranges overlap, because we can't check during constant evaluation          if (__libcpp_is_constant_evaluated()) @@ -1810,11 +1989,11 @@ private:          std::__throw_out_of_range("basic_string");      } -    friend _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string operator+<>(const basic_string&, const basic_string&); -    friend _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string operator+<>(const value_type*, const basic_string&); -    friend _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string operator+<>(value_type, const basic_string&); -    friend _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string operator+<>(const basic_string&, const value_type*); -    friend _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string operator+<>(const basic_string&, value_type); +    friend _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string operator+<>(const basic_string&, const basic_string&); +    friend _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string operator+<>(const value_type*, const basic_string&); +    friend _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string operator+<>(value_type, const basic_string&); +    friend _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string operator+<>(const basic_string&, const value_type*); +    friend _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string operator+<>(const basic_string&, value_type);  };  // These declarations must appear before any functions are implicitly used @@ -1863,7 +2042,7 @@ basic_string(basic_string_view<_CharT, _Traits>, _Sz, _Sz, const _Allocator& = _  #endif  template <class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 +inline _LIBCPP_CONSTEXPR_SINCE_CXX20  void  basic_string<_CharT, _Traits, _Allocator>::__invalidate_iterators_past(size_type __pos)  { @@ -1893,37 +2072,13 @@ basic_string<_CharT, _Traits, _Allocator>::__invalidate_iterators_past(size_type  }  template <class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -basic_string<_CharT, _Traits, _Allocator>::basic_string() -    _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value) -     : __r_(__default_init_tag(), __default_init_tag()) -{ -    std::__debug_db_insert_c(this); -    __default_init(); -} - -template <class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -basic_string<_CharT, _Traits, _Allocator>::basic_string(const allocator_type& __a) -#if _LIBCPP_STD_VER <= 14 -        _NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value) -#else -        _NOEXCEPT -#endif -: __r_(__default_init_tag(), __a) -{ -    std::__debug_db_insert_c(this); -    __default_init(); -} - -template <class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  void basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s,                                                         size_type __sz,                                                         size_type __reserve)  {      if (__libcpp_is_constant_evaluated()) -        __zero(); +        __r_.first() = __rep();      if (__reserve > max_size())          __throw_length_error();      pointer __p; @@ -1946,12 +2101,12 @@ void basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s,  }  template <class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  void  basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_type __sz)  {      if (__libcpp_is_constant_evaluated()) -        __zero(); +        __r_.first() = __rep();      if (__sz > max_size())          __throw_length_error();      pointer __p; @@ -1975,7 +2130,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_ty  template <class _CharT, class _Traits, class _Allocator>  template <class> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, const _Allocator& __a)      : __r_(__default_init_tag(), __a)  { @@ -1985,32 +2140,12 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, const  }  template <class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_type __n) -     : __r_(__default_init_tag(), __default_init_tag()) -{ -    _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "basic_string(const char*, n) detected nullptr"); -    __init(__s, __n); -    std::__debug_db_insert_c(this); -} - -template <class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_type __n, const _Allocator& __a) -    : __r_(__default_init_tag(), __a) -{ -    _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "basic_string(const char*, n, allocator) detected nullptr"); -    __init(__s, __n); -    std::__debug_db_insert_c(this); -} - -template <class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str)      : __r_(__default_init_tag(), __alloc_traits::select_on_container_copy_construction(__str.__alloc()))  {      if (!__str.__is_long()) -        __r_.first().__r = __str.__r_.first().__r; +        __r_.first() = __str.__r_.first();      else          __init_copy_ctor_external(std::__to_address(__str.__get_long_pointer()),                                    __str.__get_long_size()); @@ -2018,13 +2153,13 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __st  }  template <class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  basic_string<_CharT, _Traits, _Allocator>::basic_string(      const basic_string& __str, const allocator_type& __a)      : __r_(__default_init_tag(), __a)  {      if (!__str.__is_long()) -        __r_.first().__r = __str.__r_.first().__r; +        __r_.first() = __str.__r_.first();      else          __init_copy_ctor_external(std::__to_address(__str.__get_long_pointer()),                                    __str.__get_long_size()); @@ -2032,11 +2167,12 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(  }  template <class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  void basic_string<_CharT, _Traits, _Allocator>::__init_copy_ctor_external(      const value_type* __s, size_type __sz) {    if (__libcpp_is_constant_evaluated()) -    __zero(); +    __r_.first() = __rep(); +    pointer __p;    if (__fits_in_sso(__sz)) {      __p = __get_short_pointer(); @@ -2054,55 +2190,14 @@ void basic_string<_CharT, _Traits, _Allocator>::__init_copy_ctor_external(    traits_type::copy(std::__to_address(__p), __s, __sz + 1);  } -#ifndef _LIBCPP_CXX03_LANG - -template <class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str) -#if _LIBCPP_STD_VER <= 14 -        _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value) -#else -        _NOEXCEPT -#endif -    : __r_(std::move(__str.__r_)) -{ -    __str.__default_init(); -    std::__debug_db_insert_c(this); -    if (__is_long()) -        std::__debug_db_swap(this, &__str); -} -  template <class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str, const allocator_type& __a) -    : __r_(__default_init_tag(), __a) -{ -    if (__str.__is_long() && __a != __str.__alloc()) // copy, not move -        __init(std::__to_address(__str.__get_long_pointer()), __str.__get_long_size()); -    else -    { -        if (__libcpp_is_constant_evaluated()) { -            __zero(); -            __r_.first().__l = __str.__r_.first().__l; -        } else { -            __r_.first().__r = __str.__r_.first().__r; -        } -        __str.__default_init(); -    } -    std::__debug_db_insert_c(this); -    if (__is_long()) -        std::__debug_db_swap(this, &__str); -} - -#endif // _LIBCPP_CXX03_LANG - -template <class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  void  basic_string<_CharT, _Traits, _Allocator>::__init(size_type __n, value_type __c)  {      if (__libcpp_is_constant_evaluated()) -        __zero(); +        __r_.first() = __rep(); +      if (__n > max_size())          __throw_length_error();      pointer __p; @@ -2125,17 +2220,8 @@ basic_string<_CharT, _Traits, _Allocator>::__init(size_type __n, value_type __c)  }  template <class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __c) -     : __r_(__default_init_tag(), __default_init_tag()) -{ -    __init(__n, __c); -    std::__debug_db_insert_c(this); -} - -template <class _CharT, class _Traits, class _Allocator>  template <class> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __c, const _Allocator& __a)      : __r_(__default_init_tag(), __a)  { @@ -2144,7 +2230,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __  }  template <class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str,                                                          size_type __pos, size_type __n,                                                          const _Allocator& __a) @@ -2158,21 +2244,8 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __st  }  template <class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str, size_type __pos, -                                                        const _Allocator& __a) -    : __r_(__default_init_tag(), __a) -{ -    size_type __str_sz = __str.size(); -    if (__pos > __str_sz) -        __throw_out_of_range(); -    __init(__str.data() + __pos, __str_sz - __pos); -    std::__debug_db_insert_c(this); -} - -template <class _CharT, class _Traits, class _Allocator>  template <class _Tp, class> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  basic_string<_CharT, _Traits, _Allocator>::basic_string(               const _Tp& __t, size_type __pos, size_type __n, const allocator_type& __a)      : __r_(__default_init_tag(), __a) @@ -2185,7 +2258,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(  template <class _CharT, class _Traits, class _Allocator>  template <class _Tp, class> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  basic_string<_CharT, _Traits, _Allocator>::basic_string(const _Tp & __t)       : __r_(__default_init_tag(), __default_init_tag())  { @@ -2196,7 +2269,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _Tp & __t)  template <class _CharT, class _Traits, class _Allocator>  template <class _Tp, class> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  basic_string<_CharT, _Traits, _Allocator>::basic_string(const _Tp & __t, const _Allocator& __a)      : __r_(__default_init_tag(), __a)  { @@ -2207,7 +2280,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _Tp & __t, const _  template <class _CharT, class _Traits, class _Allocator>  template <class _InputIterator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  __enable_if_t  <      __is_exactly_cpp17_input_iterator<_InputIterator>::value @@ -2234,7 +2307,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(_InputIterator __first, _Input  template <class _CharT, class _Traits, class _Allocator>  template <class _ForwardIterator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  __enable_if_t  <      __is_cpp17_forward_iterator<_ForwardIterator>::value @@ -2242,7 +2315,7 @@ __enable_if_t  basic_string<_CharT, _Traits, _Allocator>::__init(_ForwardIterator __first, _ForwardIterator __last)  {      if (__libcpp_is_constant_evaluated()) -        __zero(); +        __r_.first() = __rep();      size_type __sz = static_cast<size_type>(std::distance(__first, __last));      if (__sz > max_size())          __throw_length_error(); @@ -2281,52 +2354,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(_ForwardIterator __first, _For  }  template <class _CharT, class _Traits, class _Allocator> -template<class _InputIterator, class> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first, _InputIterator __last) -     : __r_(__default_init_tag(), __default_init_tag()) -{ -    __init(__first, __last); -    std::__debug_db_insert_c(this); -} - -template <class _CharT, class _Traits, class _Allocator> -template<class _InputIterator, class> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first, _InputIterator __last, -                                                        const allocator_type& __a) -    : __r_(__default_init_tag(), __a) -{ -    __init(__first, __last); -    std::__debug_db_insert_c(this); -} - -#ifndef _LIBCPP_CXX03_LANG - -template <class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -basic_string<_CharT, _Traits, _Allocator>::basic_string( -    initializer_list<_CharT> __il) -     : __r_(__default_init_tag(), __default_init_tag()) -{ -    __init(__il.begin(), __il.end()); -    std::__debug_db_insert_c(this); -} - -template <class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -basic_string<_CharT, _Traits, _Allocator>::basic_string( -    initializer_list<_CharT> __il, const _Allocator& __a) -    : __r_(__default_init_tag(), __a) -{ -    __init(__il.begin(), __il.end()); -    std::__debug_db_insert_c(this); -} - -#endif // _LIBCPP_CXX03_LANG - -template <class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  basic_string<_CharT, _Traits, _Allocator>::~basic_string()  {      std::__debug_db_erase_c(this); @@ -2335,7 +2363,7 @@ basic_string<_CharT, _Traits, _Allocator>::~basic_string()  }  template <class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  void  basic_string<_CharT, _Traits, _Allocator>::__grow_by_and_replace      (size_type __old_cap, size_type __delta_cap, size_type __old_sz, @@ -2372,7 +2400,7 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by_and_replace  template <class _CharT, class _Traits, class _Allocator>  void -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  basic_string<_CharT, _Traits, _Allocator>::__grow_by(size_type __old_cap, size_type __delta_cap, size_type __old_sz,                                                       size_type __n_copy,  size_type __n_del,     size_type __n_add)  { @@ -2405,7 +2433,7 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by(size_type __old_cap, size_t  template <class _CharT, class _Traits, class _Allocator>  template <bool __is_short> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  basic_string<_CharT, _Traits, _Allocator>&  basic_string<_CharT, _Traits, _Allocator>::__assign_no_alias(      const value_type* __s, size_type __n) { @@ -2424,7 +2452,7 @@ basic_string<_CharT, _Traits, _Allocator>::__assign_no_alias(  }  template <class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  basic_string<_CharT, _Traits, _Allocator>&  basic_string<_CharT, _Traits, _Allocator>::__assign_external(      const value_type* __s, size_type __n) { @@ -2441,7 +2469,7 @@ basic_string<_CharT, _Traits, _Allocator>::__assign_external(  }  template <class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  basic_string<_CharT, _Traits, _Allocator>&  basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s, size_type __n)  { @@ -2452,7 +2480,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s, size_ty  }  template <class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  basic_string<_CharT, _Traits, _Allocator>&  basic_string<_CharT, _Traits, _Allocator>::assign(size_type __n, value_type __c)  { @@ -2468,7 +2496,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(size_type __n, value_type __c)  }  template <class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  basic_string<_CharT, _Traits, _Allocator>&  basic_string<_CharT, _Traits, _Allocator>::operator=(value_type __c)  { @@ -2490,7 +2518,7 @@ basic_string<_CharT, _Traits, _Allocator>::operator=(value_type __c)  }  template <class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  basic_string<_CharT, _Traits, _Allocator>&  basic_string<_CharT, _Traits, _Allocator>::operator=(const basic_string& __str)  { @@ -2498,7 +2526,7 @@ basic_string<_CharT, _Traits, _Allocator>::operator=(const basic_string& __str)      __copy_assign_alloc(__str);      if (!__is_long()) {        if (!__str.__is_long()) { -        __r_.first().__r = __str.__r_.first().__r; +        __r_.first() = __str.__r_.first();        } else {          return __assign_no_alias<true>(__str.data(), __str.size());        } @@ -2512,7 +2540,7 @@ basic_string<_CharT, _Traits, _Allocator>::operator=(const basic_string& __str)  #ifndef _LIBCPP_CXX03_LANG  template <class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 +inline _LIBCPP_CONSTEXPR_SINCE_CXX20  void  basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, false_type)      _NOEXCEPT_(__alloc_traits::is_always_equal::value) @@ -2524,7 +2552,7 @@ basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, fa  }  template <class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 +inline _LIBCPP_CONSTEXPR_SINCE_CXX20  void  basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, true_type)  #if _LIBCPP_STD_VER > 14 @@ -2553,22 +2581,11 @@ basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, tr    }  } -template <class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -basic_string<_CharT, _Traits, _Allocator>& -basic_string<_CharT, _Traits, _Allocator>::operator=(basic_string&& __str) -    _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)) -{ -    __move_assign(__str, integral_constant<bool, -          __alloc_traits::propagate_on_container_move_assignment::value>()); -    return *this; -} -  #endif  template <class _CharT, class _Traits, class _Allocator>  template<class _InputIterator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  __enable_if_t  <       __is_exactly_cpp17_input_iterator<_InputIterator>::value, @@ -2583,7 +2600,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(_InputIterator __first, _Input  template <class _CharT, class _Traits, class _Allocator>  template<class _ForwardIterator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  __enable_if_t  <      __is_cpp17_forward_iterator<_ForwardIterator>::value, @@ -2619,7 +2636,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(_ForwardIterator __first, _For  }  template <class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  basic_string<_CharT, _Traits, _Allocator>&  basic_string<_CharT, _Traits, _Allocator>::assign(const basic_string& __str, size_type __pos, size_type __n)  { @@ -2631,7 +2648,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(const basic_string& __str, siz  template <class _CharT, class _Traits, class _Allocator>  template <class _Tp> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  __enable_if_t  <      __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value @@ -2649,14 +2666,14 @@ basic_string<_CharT, _Traits, _Allocator>::assign(const _Tp & __t, size_type __p  template <class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  basic_string<_CharT, _Traits, _Allocator>&  basic_string<_CharT, _Traits, _Allocator>::__assign_external(const value_type* __s) {    return __assign_external(__s, traits_type::length(__s));  }  template <class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  basic_string<_CharT, _Traits, _Allocator>&  basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s)  { @@ -2670,7 +2687,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s)  // append  template <class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  basic_string<_CharT, _Traits, _Allocator>&  basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s, size_type __n)  { @@ -2694,7 +2711,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s, size_ty  }  template <class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  basic_string<_CharT, _Traits, _Allocator>&  basic_string<_CharT, _Traits, _Allocator>::append(size_type __n, value_type __c)  { @@ -2714,7 +2731,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(size_type __n, value_type __c)  }  template <class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 inline void +_LIBCPP_CONSTEXPR_SINCE_CXX20 inline void  basic_string<_CharT, _Traits, _Allocator>::__append_default_init(size_type __n)  {      if (__n) @@ -2731,7 +2748,7 @@ basic_string<_CharT, _Traits, _Allocator>::__append_default_init(size_type __n)  }  template <class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  void  basic_string<_CharT, _Traits, _Allocator>::push_back(value_type __c)  { @@ -2770,7 +2787,7 @@ basic_string<_CharT, _Traits, _Allocator>::push_back(value_type __c)  template <class _CharT, class _Traits, class _Allocator>  template<class _ForwardIterator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  __enable_if_t  <      __is_cpp17_forward_iterator<_ForwardIterator>::value, @@ -2805,15 +2822,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(  }  template <class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -basic_string<_CharT, _Traits, _Allocator>& -basic_string<_CharT, _Traits, _Allocator>::append(const basic_string& __str) -{ -    return append(__str.data(), __str.size()); -} - -template <class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  basic_string<_CharT, _Traits, _Allocator>&  basic_string<_CharT, _Traits, _Allocator>::append(const basic_string& __str, size_type __pos, size_type __n)  { @@ -2825,7 +2834,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(const basic_string& __str, siz  template <class _CharT, class _Traits, class _Allocator>  template <class _Tp> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20      __enable_if_t      <          __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value  && !__is_same_uncvref<_Tp, basic_string<_CharT, _Traits, _Allocator> >::value, @@ -2841,7 +2850,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(const _Tp & __t, size_type __p  }  template <class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  basic_string<_CharT, _Traits, _Allocator>&  basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s)  { @@ -2852,7 +2861,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s)  // insert  template <class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  basic_string<_CharT, _Traits, _Allocator>&  basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_type* __s, size_type __n)  { @@ -2892,7 +2901,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_t  }  template <class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  basic_string<_CharT, _Traits, _Allocator>&  basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, size_type __n, value_type __c)  { @@ -2925,7 +2934,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, size_type __n  template <class _CharT, class _Traits, class _Allocator>  template<class _InputIterator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  __enable_if_t  <     __is_exactly_cpp17_input_iterator<_InputIterator>::value, @@ -2942,7 +2951,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _InputIt  template <class _CharT, class _Traits, class _Allocator>  template<class _ForwardIterator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  __enable_if_t  <      __is_cpp17_forward_iterator<_ForwardIterator>::value, @@ -2970,15 +2979,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _Forward  }  template <class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -basic_string<_CharT, _Traits, _Allocator>& -basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos1, const basic_string& __str) -{ -    return insert(__pos1, __str.data(), __str.size()); -} - -template <class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  basic_string<_CharT, _Traits, _Allocator>&  basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos1, const basic_string& __str,                                                    size_type __pos2, size_type __n) @@ -2991,7 +2992,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos1, const basic_  template <class _CharT, class _Traits, class _Allocator>  template <class _Tp> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  __enable_if_t  <      __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value  && !__is_same_uncvref<_Tp, basic_string<_CharT, _Traits, _Allocator> >::value, @@ -3008,7 +3009,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos1, const _Tp& _  }  template <class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  basic_string<_CharT, _Traits, _Allocator>&  basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_type* __s)  { @@ -3017,7 +3018,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_t  }  template <class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  typename basic_string<_CharT, _Traits, _Allocator>::iterator  basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, value_type __c)  { @@ -3047,23 +3048,10 @@ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, value_ty      return begin() + static_cast<difference_type>(__ip);  } -template <class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -typename basic_string<_CharT, _Traits, _Allocator>::iterator -basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, size_type __n, value_type __c) -{ -  _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(&__pos) == this, -                       "string::insert(iterator, n, value) called with an iterator not" -                       " referring to this string"); -  difference_type __p = __pos - begin(); -  insert(static_cast<size_type>(__p), __n, __c); -  return begin() + __p; -} -  // replace  template <class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  basic_string<_CharT, _Traits, _Allocator>&  basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, const value_type* __s, size_type __n2)      _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK @@ -3117,7 +3105,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __  }  template <class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  basic_string<_CharT, _Traits, _Allocator>&  basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, size_type __n2, value_type __c)  { @@ -3148,7 +3136,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __  template <class _CharT, class _Traits, class _Allocator>  template<class _InputIterator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  __enable_if_t  <      __is_cpp17_input_iterator<_InputIterator>::value, @@ -3162,15 +3150,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_it  }  template <class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -basic_string<_CharT, _Traits, _Allocator>& -basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos1, size_type __n1, const basic_string& __str) -{ -    return replace(__pos1, __n1, __str.data(), __str.size()); -} - -template <class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  basic_string<_CharT, _Traits, _Allocator>&  basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos1, size_type __n1, const basic_string& __str,                                                     size_type __pos2, size_type __n2) @@ -3183,7 +3163,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos1, size_type _  template <class _CharT, class _Traits, class _Allocator>  template <class _Tp> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  __enable_if_t  <      __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && !__is_same_uncvref<_Tp, basic_string<_CharT, _Traits, _Allocator> >::value, @@ -3200,7 +3180,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos1, size_type _  }  template <class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  basic_string<_CharT, _Traits, _Allocator>&  basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, const value_type* __s)  { @@ -3208,45 +3188,12 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __      return replace(__pos, __n1, __s, traits_type::length(__s));  } -template <class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -basic_string<_CharT, _Traits, _Allocator>& -basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, const basic_string& __str) -{ -    return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), -                   __str.data(), __str.size()); -} - -template <class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -basic_string<_CharT, _Traits, _Allocator>& -basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, const value_type* __s, size_type __n) -{ -    return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), __s, __n); -} - -template <class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -basic_string<_CharT, _Traits, _Allocator>& -basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, const value_type* __s) -{ -    return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), __s); -} - -template <class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -basic_string<_CharT, _Traits, _Allocator>& -basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, size_type __n, value_type __c) -{ -    return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), __n, __c); -} -  // erase  // 'externally instantiated' erase() implementation, called when __n != npos.  // Does not check __pos against size()  template <class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  void  basic_string<_CharT, _Traits, _Allocator>::__erase_external_with_move(      size_type __pos, size_type __n) @@ -3264,7 +3211,7 @@ basic_string<_CharT, _Traits, _Allocator>::__erase_external_with_move(  }  template <class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  basic_string<_CharT, _Traits, _Allocator>&  basic_string<_CharT, _Traits, _Allocator>::erase(size_type __pos,                                                   size_type __n) { @@ -3279,7 +3226,7 @@ basic_string<_CharT, _Traits, _Allocator>::erase(size_type __pos,  }  template <class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 +inline _LIBCPP_CONSTEXPR_SINCE_CXX20  typename basic_string<_CharT, _Traits, _Allocator>::iterator  basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __pos)  { @@ -3295,7 +3242,7 @@ basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __pos)  }  template <class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 +inline _LIBCPP_CONSTEXPR_SINCE_CXX20  typename basic_string<_CharT, _Traits, _Allocator>::iterator  basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __first, const_iterator __last)  { @@ -3311,7 +3258,7 @@ basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __first, const_i  }  template <class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 +inline _LIBCPP_CONSTEXPR_SINCE_CXX20  void  basic_string<_CharT, _Traits, _Allocator>::pop_back()  { @@ -3320,7 +3267,7 @@ basic_string<_CharT, _Traits, _Allocator>::pop_back()  }  template <class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 +inline _LIBCPP_CONSTEXPR_SINCE_CXX20  void  basic_string<_CharT, _Traits, _Allocator>::clear() _NOEXCEPT  { @@ -3338,15 +3285,7 @@ basic_string<_CharT, _Traits, _Allocator>::clear() _NOEXCEPT  }  template <class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -void -basic_string<_CharT, _Traits, _Allocator>::__erase_to_end(size_type __pos) -{ -  __null_terminate_at(std::__to_address(__get_pointer()), __pos); -} - -template <class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  void  basic_string<_CharT, _Traits, _Allocator>::resize(size_type __n, value_type __c)  { @@ -3358,7 +3297,7 @@ basic_string<_CharT, _Traits, _Allocator>::resize(size_type __n, value_type __c)  }  template <class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 inline void +_LIBCPP_CONSTEXPR_SINCE_CXX20 inline void  basic_string<_CharT, _Traits, _Allocator>::__resize_default_init(size_type __n)  {      size_type __sz = size(); @@ -3369,21 +3308,7 @@ basic_string<_CharT, _Traits, _Allocator>::__resize_default_init(size_type __n)  }  template <class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -typename basic_string<_CharT, _Traits, _Allocator>::size_type -basic_string<_CharT, _Traits, _Allocator>::max_size() const _NOEXCEPT -{ -    size_type __m = __alloc_traits::max_size(__alloc()); -    if (__m <= std::numeric_limits<size_type>::max() / 2) { -        return __m - __alignment; -    } else { -        bool __uses_lsb = __endian_factor == 2; -        return __uses_lsb ? __m - __alignment : (__m / 2) - __alignment; -    } -} - -template <class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  void  basic_string<_CharT, _Traits, _Allocator>::reserve(size_type __requested_capacity)  { @@ -3404,7 +3329,7 @@ basic_string<_CharT, _Traits, _Allocator>::reserve(size_type __requested_capacit  }  template <class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 +inline _LIBCPP_CONSTEXPR_SINCE_CXX20  void  basic_string<_CharT, _Traits, _Allocator>::shrink_to_fit() _NOEXCEPT  { @@ -3415,7 +3340,7 @@ basic_string<_CharT, _Traits, _Allocator>::shrink_to_fit() _NOEXCEPT  }  template <class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 +inline _LIBCPP_CONSTEXPR_SINCE_CXX20  void  basic_string<_CharT, _Traits, _Allocator>::__shrink_or_extend(size_type __target_capacity)  { @@ -3479,25 +3404,7 @@ basic_string<_CharT, _Traits, _Allocator>::__shrink_or_extend(size_type __target  }  template <class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -typename basic_string<_CharT, _Traits, _Allocator>::const_reference -basic_string<_CharT, _Traits, _Allocator>::operator[](size_type __pos) const _NOEXCEPT -{ -    _LIBCPP_ASSERT(__pos <= size(), "string index out of bounds"); -    return *(data() + __pos); -} - -template <class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -typename basic_string<_CharT, _Traits, _Allocator>::reference -basic_string<_CharT, _Traits, _Allocator>::operator[](size_type __pos) _NOEXCEPT -{ -    _LIBCPP_ASSERT(__pos <= size(), "string index out of bounds"); -    return *(__get_pointer() + __pos); -} - -template <class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  typename basic_string<_CharT, _Traits, _Allocator>::const_reference  basic_string<_CharT, _Traits, _Allocator>::at(size_type __n) const  { @@ -3507,7 +3414,7 @@ basic_string<_CharT, _Traits, _Allocator>::at(size_type __n) const  }  template <class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  typename basic_string<_CharT, _Traits, _Allocator>::reference  basic_string<_CharT, _Traits, _Allocator>::at(size_type __n)  { @@ -3517,43 +3424,7 @@ basic_string<_CharT, _Traits, _Allocator>::at(size_type __n)  }  template <class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -typename basic_string<_CharT, _Traits, _Allocator>::reference -basic_string<_CharT, _Traits, _Allocator>::front() _NOEXCEPT -{ -    _LIBCPP_ASSERT(!empty(), "string::front(): string is empty"); -    return *__get_pointer(); -} - -template <class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -typename basic_string<_CharT, _Traits, _Allocator>::const_reference -basic_string<_CharT, _Traits, _Allocator>::front() const _NOEXCEPT -{ -    _LIBCPP_ASSERT(!empty(), "string::front(): string is empty"); -    return *data(); -} - -template <class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -typename basic_string<_CharT, _Traits, _Allocator>::reference -basic_string<_CharT, _Traits, _Allocator>::back() _NOEXCEPT -{ -    _LIBCPP_ASSERT(!empty(), "string::back(): string is empty"); -    return *(__get_pointer() + size() - 1); -} - -template <class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -typename basic_string<_CharT, _Traits, _Allocator>::const_reference -basic_string<_CharT, _Traits, _Allocator>::back() const _NOEXCEPT -{ -    _LIBCPP_ASSERT(!empty(), "string::back(): string is empty"); -    return *(data() + size() - 1); -} - -template <class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  typename basic_string<_CharT, _Traits, _Allocator>::size_type  basic_string<_CharT, _Traits, _Allocator>::copy(value_type* __s, size_type __n, size_type __pos) const  { @@ -3566,15 +3437,7 @@ basic_string<_CharT, _Traits, _Allocator>::copy(value_type* __s, size_type __n,  }  template <class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -basic_string<_CharT, _Traits, _Allocator> -basic_string<_CharT, _Traits, _Allocator>::substr(size_type __pos, size_type __n) const -{ -    return basic_string(*this, __pos, __n, __alloc()); -} - -template <class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 +inline _LIBCPP_CONSTEXPR_SINCE_CXX20  void  basic_string<_CharT, _Traits, _Allocator>::swap(basic_string& __str)  #if _LIBCPP_STD_VER >= 14 @@ -3610,30 +3473,30 @@ struct _LIBCPP_HIDDEN __traits_eq  };  template<class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  typename basic_string<_CharT, _Traits, _Allocator>::size_type  basic_string<_CharT, _Traits, _Allocator>::find(const value_type* __s,                                                  size_type __pos,                                                  size_type __n) const _NOEXCEPT  {      _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find(): received nullptr"); -    return __str_find<value_type, size_type, traits_type, npos> +    return std::__str_find<value_type, size_type, traits_type, npos>          (data(), size(), __s, __pos, __n);  }  template<class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 +inline _LIBCPP_CONSTEXPR_SINCE_CXX20  typename basic_string<_CharT, _Traits, _Allocator>::size_type  basic_string<_CharT, _Traits, _Allocator>::find(const basic_string& __str,                                                  size_type __pos) const _NOEXCEPT  { -    return __str_find<value_type, size_type, traits_type, npos> +    return std::__str_find<value_type, size_type, traits_type, npos>          (data(), size(), __str.data(), __pos, __str.size());  }  template<class _CharT, class _Traits, class _Allocator>  template <class _Tp> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  __enable_if_t  <      __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, @@ -3643,58 +3506,58 @@ basic_string<_CharT, _Traits, _Allocator>::find(const _Tp &__t,                                                  size_type __pos) const _NOEXCEPT  {      __self_view __sv = __t; -    return __str_find<value_type, size_type, traits_type, npos> +    return std::__str_find<value_type, size_type, traits_type, npos>          (data(), size(), __sv.data(), __pos, __sv.size());  }  template<class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 +inline _LIBCPP_CONSTEXPR_SINCE_CXX20  typename basic_string<_CharT, _Traits, _Allocator>::size_type  basic_string<_CharT, _Traits, _Allocator>::find(const value_type* __s,                                                  size_type __pos) const _NOEXCEPT  {      _LIBCPP_ASSERT(__s != nullptr, "string::find(): received nullptr"); -    return __str_find<value_type, size_type, traits_type, npos> +    return std::__str_find<value_type, size_type, traits_type, npos>          (data(), size(), __s, __pos, traits_type::length(__s));  }  template<class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  typename basic_string<_CharT, _Traits, _Allocator>::size_type  basic_string<_CharT, _Traits, _Allocator>::find(value_type __c,                                                  size_type __pos) const _NOEXCEPT  { -    return __str_find<value_type, size_type, traits_type, npos> +    return std::__str_find<value_type, size_type, traits_type, npos>          (data(), size(), __c, __pos);  }  // rfind  template<class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  typename basic_string<_CharT, _Traits, _Allocator>::size_type  basic_string<_CharT, _Traits, _Allocator>::rfind(const value_type* __s,                                                   size_type __pos,                                                   size_type __n) const _NOEXCEPT  {      _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::rfind(): received nullptr"); -    return __str_rfind<value_type, size_type, traits_type, npos> +    return std::__str_rfind<value_type, size_type, traits_type, npos>          (data(), size(), __s, __pos, __n);  }  template<class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 +inline _LIBCPP_CONSTEXPR_SINCE_CXX20  typename basic_string<_CharT, _Traits, _Allocator>::size_type  basic_string<_CharT, _Traits, _Allocator>::rfind(const basic_string& __str,                                                   size_type __pos) const _NOEXCEPT  { -    return __str_rfind<value_type, size_type, traits_type, npos> +    return std::__str_rfind<value_type, size_type, traits_type, npos>          (data(), size(), __str.data(), __pos, __str.size());  }  template<class _CharT, class _Traits, class _Allocator>  template <class _Tp> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  __enable_if_t  <      __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, @@ -3704,58 +3567,58 @@ basic_string<_CharT, _Traits, _Allocator>::rfind(const _Tp& __t,                                                  size_type __pos) const _NOEXCEPT  {      __self_view __sv = __t; -    return __str_rfind<value_type, size_type, traits_type, npos> +    return std::__str_rfind<value_type, size_type, traits_type, npos>          (data(), size(), __sv.data(), __pos, __sv.size());  }  template<class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 +inline _LIBCPP_CONSTEXPR_SINCE_CXX20  typename basic_string<_CharT, _Traits, _Allocator>::size_type  basic_string<_CharT, _Traits, _Allocator>::rfind(const value_type* __s,                                                   size_type __pos) const _NOEXCEPT  {      _LIBCPP_ASSERT(__s != nullptr, "string::rfind(): received nullptr"); -    return __str_rfind<value_type, size_type, traits_type, npos> +    return std::__str_rfind<value_type, size_type, traits_type, npos>          (data(), size(), __s, __pos, traits_type::length(__s));  }  template<class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  typename basic_string<_CharT, _Traits, _Allocator>::size_type  basic_string<_CharT, _Traits, _Allocator>::rfind(value_type __c,                                                   size_type __pos) const _NOEXCEPT  { -    return __str_rfind<value_type, size_type, traits_type, npos> +    return std::__str_rfind<value_type, size_type, traits_type, npos>          (data(), size(), __c, __pos);  }  // find_first_of  template<class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  typename basic_string<_CharT, _Traits, _Allocator>::size_type  basic_string<_CharT, _Traits, _Allocator>::find_first_of(const value_type* __s,                                                           size_type __pos,                                                           size_type __n) const _NOEXCEPT  {      _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_first_of(): received nullptr"); -    return __str_find_first_of<value_type, size_type, traits_type, npos> +    return std::__str_find_first_of<value_type, size_type, traits_type, npos>          (data(), size(), __s, __pos, __n);  }  template<class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 +inline _LIBCPP_CONSTEXPR_SINCE_CXX20  typename basic_string<_CharT, _Traits, _Allocator>::size_type  basic_string<_CharT, _Traits, _Allocator>::find_first_of(const basic_string& __str,                                                           size_type __pos) const _NOEXCEPT  { -    return __str_find_first_of<value_type, size_type, traits_type, npos> +    return std::__str_find_first_of<value_type, size_type, traits_type, npos>          (data(), size(), __str.data(), __pos, __str.size());  }  template<class _CharT, class _Traits, class _Allocator>  template <class _Tp> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  __enable_if_t  <      __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, @@ -3765,23 +3628,23 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_of(const _Tp& __t,                                                  size_type __pos) const _NOEXCEPT  {      __self_view __sv = __t; -    return __str_find_first_of<value_type, size_type, traits_type, npos> +    return std::__str_find_first_of<value_type, size_type, traits_type, npos>          (data(), size(), __sv.data(), __pos, __sv.size());  }  template<class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 +inline _LIBCPP_CONSTEXPR_SINCE_CXX20  typename basic_string<_CharT, _Traits, _Allocator>::size_type  basic_string<_CharT, _Traits, _Allocator>::find_first_of(const value_type* __s,                                                           size_type __pos) const _NOEXCEPT  {      _LIBCPP_ASSERT(__s != nullptr, "string::find_first_of(): received nullptr"); -    return __str_find_first_of<value_type, size_type, traits_type, npos> +    return std::__str_find_first_of<value_type, size_type, traits_type, npos>          (data(), size(), __s, __pos, traits_type::length(__s));  }  template<class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 +inline _LIBCPP_CONSTEXPR_SINCE_CXX20  typename basic_string<_CharT, _Traits, _Allocator>::size_type  basic_string<_CharT, _Traits, _Allocator>::find_first_of(value_type __c,                                                           size_type __pos) const _NOEXCEPT @@ -3792,30 +3655,30 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_of(value_type __c,  // find_last_of  template<class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 +inline _LIBCPP_CONSTEXPR_SINCE_CXX20  typename basic_string<_CharT, _Traits, _Allocator>::size_type  basic_string<_CharT, _Traits, _Allocator>::find_last_of(const value_type* __s,                                                          size_type __pos,                                                          size_type __n) const _NOEXCEPT  {      _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_last_of(): received nullptr"); -    return __str_find_last_of<value_type, size_type, traits_type, npos> +    return std::__str_find_last_of<value_type, size_type, traits_type, npos>          (data(), size(), __s, __pos, __n);  }  template<class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 +inline _LIBCPP_CONSTEXPR_SINCE_CXX20  typename basic_string<_CharT, _Traits, _Allocator>::size_type  basic_string<_CharT, _Traits, _Allocator>::find_last_of(const basic_string& __str,                                                          size_type __pos) const _NOEXCEPT  { -    return __str_find_last_of<value_type, size_type, traits_type, npos> +    return std::__str_find_last_of<value_type, size_type, traits_type, npos>          (data(), size(), __str.data(), __pos, __str.size());  }  template<class _CharT, class _Traits, class _Allocator>  template <class _Tp> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  __enable_if_t  <      __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, @@ -3825,23 +3688,23 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_of(const _Tp& __t,                                                  size_type __pos) const _NOEXCEPT  {      __self_view __sv = __t; -    return __str_find_last_of<value_type, size_type, traits_type, npos> +    return std::__str_find_last_of<value_type, size_type, traits_type, npos>          (data(), size(), __sv.data(), __pos, __sv.size());  }  template<class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 +inline _LIBCPP_CONSTEXPR_SINCE_CXX20  typename basic_string<_CharT, _Traits, _Allocator>::size_type  basic_string<_CharT, _Traits, _Allocator>::find_last_of(const value_type* __s,                                                          size_type __pos) const _NOEXCEPT  {      _LIBCPP_ASSERT(__s != nullptr, "string::find_last_of(): received nullptr"); -    return __str_find_last_of<value_type, size_type, traits_type, npos> +    return std::__str_find_last_of<value_type, size_type, traits_type, npos>          (data(), size(), __s, __pos, traits_type::length(__s));  }  template<class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 +inline _LIBCPP_CONSTEXPR_SINCE_CXX20  typename basic_string<_CharT, _Traits, _Allocator>::size_type  basic_string<_CharT, _Traits, _Allocator>::find_last_of(value_type __c,                                                          size_type __pos) const _NOEXCEPT @@ -3852,30 +3715,30 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_of(value_type __c,  // find_first_not_of  template<class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  typename basic_string<_CharT, _Traits, _Allocator>::size_type  basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const value_type* __s,                                                               size_type __pos,                                                               size_type __n) const _NOEXCEPT  {      _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_first_not_of(): received nullptr"); -    return __str_find_first_not_of<value_type, size_type, traits_type, npos> +    return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>          (data(), size(), __s, __pos, __n);  }  template<class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 +inline _LIBCPP_CONSTEXPR_SINCE_CXX20  typename basic_string<_CharT, _Traits, _Allocator>::size_type  basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const basic_string& __str,                                                               size_type __pos) const _NOEXCEPT  { -    return __str_find_first_not_of<value_type, size_type, traits_type, npos> +    return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>          (data(), size(), __str.data(), __pos, __str.size());  }  template<class _CharT, class _Traits, class _Allocator>  template <class _Tp> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  __enable_if_t  <      __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, @@ -3885,58 +3748,58 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const _Tp& __t,                                                  size_type __pos) const _NOEXCEPT  {      __self_view __sv = __t; -    return __str_find_first_not_of<value_type, size_type, traits_type, npos> +    return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>          (data(), size(), __sv.data(), __pos, __sv.size());  }  template<class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 +inline _LIBCPP_CONSTEXPR_SINCE_CXX20  typename basic_string<_CharT, _Traits, _Allocator>::size_type  basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const value_type* __s,                                                               size_type __pos) const _NOEXCEPT  {      _LIBCPP_ASSERT(__s != nullptr, "string::find_first_not_of(): received nullptr"); -    return __str_find_first_not_of<value_type, size_type, traits_type, npos> +    return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>          (data(), size(), __s, __pos, traits_type::length(__s));  }  template<class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 +inline _LIBCPP_CONSTEXPR_SINCE_CXX20  typename basic_string<_CharT, _Traits, _Allocator>::size_type  basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(value_type __c,                                                               size_type __pos) const _NOEXCEPT  { -    return __str_find_first_not_of<value_type, size_type, traits_type, npos> +    return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>          (data(), size(), __c, __pos);  }  // find_last_not_of  template<class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  typename basic_string<_CharT, _Traits, _Allocator>::size_type  basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const value_type* __s,                                                              size_type __pos,                                                              size_type __n) const _NOEXCEPT  {      _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_last_not_of(): received nullptr"); -    return __str_find_last_not_of<value_type, size_type, traits_type, npos> +    return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>          (data(), size(), __s, __pos, __n);  }  template<class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 +inline _LIBCPP_CONSTEXPR_SINCE_CXX20  typename basic_string<_CharT, _Traits, _Allocator>::size_type  basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const basic_string& __str,                                                              size_type __pos) const _NOEXCEPT  { -    return __str_find_last_not_of<value_type, size_type, traits_type, npos> +    return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>          (data(), size(), __str.data(), __pos, __str.size());  }  template<class _CharT, class _Traits, class _Allocator>  template <class _Tp> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  __enable_if_t  <      __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, @@ -3946,28 +3809,28 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const _Tp& __t,                                                  size_type __pos) const _NOEXCEPT  {      __self_view __sv = __t; -    return __str_find_last_not_of<value_type, size_type, traits_type, npos> +    return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>          (data(), size(), __sv.data(), __pos, __sv.size());  }  template<class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 +inline _LIBCPP_CONSTEXPR_SINCE_CXX20  typename basic_string<_CharT, _Traits, _Allocator>::size_type  basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const value_type* __s,                                                              size_type __pos) const _NOEXCEPT  {      _LIBCPP_ASSERT(__s != nullptr, "string::find_last_not_of(): received nullptr"); -    return __str_find_last_not_of<value_type, size_type, traits_type, npos> +    return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>          (data(), size(), __s, __pos, traits_type::length(__s));  }  template<class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 +inline _LIBCPP_CONSTEXPR_SINCE_CXX20  typename basic_string<_CharT, _Traits, _Allocator>::size_type  basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(value_type __c,                                                              size_type __pos) const _NOEXCEPT  { -    return __str_find_last_not_of<value_type, size_type, traits_type, npos> +    return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>          (data(), size(), __c, __pos);  } @@ -3975,7 +3838,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(value_type __c,  template <class _CharT, class _Traits, class _Allocator>  template <class _Tp> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  __enable_if_t  <      __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, @@ -3998,7 +3861,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(const _Tp& __t) const _NOEXCE  }  template <class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 +inline _LIBCPP_CONSTEXPR_SINCE_CXX20  int  basic_string<_CharT, _Traits, _Allocator>::compare(const basic_string& __str) const _NOEXCEPT  { @@ -4006,7 +3869,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(const basic_string& __str) co  }  template <class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 +inline _LIBCPP_CONSTEXPR_SINCE_CXX20  int  basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,                                                     size_type __n1, @@ -4031,7 +3894,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,  template <class _CharT, class _Traits, class _Allocator>  template <class _Tp> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  __enable_if_t  <      __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, @@ -4046,7 +3909,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,  }  template <class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 +inline _LIBCPP_CONSTEXPR_SINCE_CXX20  int  basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,                                                     size_type __n1, @@ -4057,7 +3920,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,  template <class _CharT, class _Traits, class _Allocator>  template <class _Tp> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  __enable_if_t  <      __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value @@ -4075,7 +3938,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,  }  template <class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  int  basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,                                                     size_type __n1, @@ -4087,7 +3950,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,  }  template <class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  int  basic_string<_CharT, _Traits, _Allocator>::compare(const value_type* __s) const _NOEXCEPT  { @@ -4096,7 +3959,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(const value_type* __s) const  }  template <class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_CONSTEXPR_SINCE_CXX20  int  basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,                                                     size_type __n1, @@ -4109,7 +3972,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,  // __invariants  template<class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 +inline _LIBCPP_CONSTEXPR_SINCE_CXX20  bool  basic_string<_CharT, _Traits, _Allocator>::__invariants() const  { @@ -4127,7 +3990,7 @@ basic_string<_CharT, _Traits, _Allocator>::__invariants() const  // __clear_and_shrink  template<class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 +inline _LIBCPP_CONSTEXPR_SINCE_CXX20  void  basic_string<_CharT, _Traits, _Allocator>::__clear_and_shrink() _NOEXCEPT  { @@ -4135,28 +3998,30 @@ basic_string<_CharT, _Traits, _Allocator>::__clear_and_shrink() _NOEXCEPT      if(__is_long())      {          __alloc_traits::deallocate(__alloc(), __get_long_pointer(), capacity() + 1); -        __set_long_cap(0); -        __set_short_size(0); -        traits_type::assign(*__get_short_pointer(), value_type()); +        __default_init();      }  }  // operator==  template<class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI +inline _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI  bool  operator==(const basic_string<_CharT, _Traits, _Allocator>& __lhs,             const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT  { +#if _LIBCPP_STD_VER > 17 +    return basic_string_view<_CharT, _Traits>(__lhs) == basic_string_view<_CharT, _Traits>(__rhs); +#else      size_t __lhs_sz = __lhs.size();      return __lhs_sz == __rhs.size() && _Traits::compare(__lhs.data(),                                                          __rhs.data(),                                                          __lhs_sz) == 0; +#endif  }  template<class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI +inline _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI  bool  operator==(const basic_string<char, char_traits<char>, _Allocator>& __lhs,             const basic_string<char, char_traits<char>, _Allocator>& __rhs) _NOEXCEPT @@ -4174,8 +4039,9 @@ operator==(const basic_string<char, char_traits<char>, _Allocator>& __lhs,      return true;  } +#if _LIBCPP_STD_VER <= 17  template<class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI +inline _LIBCPP_HIDE_FROM_ABI  bool  operator==(const _CharT* __lhs,             const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT @@ -4186,22 +4052,44 @@ operator==(const _CharT* __lhs,      if (__lhs_len != __rhs.size()) return false;      return __rhs.compare(0, _String::npos, __lhs, __lhs_len) == 0;  } +#endif // _LIBCPP_STD_VER <= 17  template<class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI +inline _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI  bool  operator==(const basic_string<_CharT,_Traits,_Allocator>& __lhs,             const _CharT* __rhs) _NOEXCEPT  { +#if _LIBCPP_STD_VER > 17 +    return basic_string_view<_CharT, _Traits>(__lhs) == basic_string_view<_CharT, _Traits>(__rhs); +#else      typedef basic_string<_CharT, _Traits, _Allocator> _String;      _LIBCPP_ASSERT(__rhs != nullptr, "operator==(basic_string, char*): received nullptr");      size_t __rhs_len = _Traits::length(__rhs);      if (__rhs_len != __lhs.size()) return false;      return __lhs.compare(0, _String::npos, __rhs, __rhs_len) == 0; +#endif  } +#if _LIBCPP_STD_VER > 17 + +template <class _CharT, class _Traits, class _Allocator> +_LIBCPP_HIDE_FROM_ABI constexpr auto operator<=>( +    const basic_string<_CharT, _Traits, _Allocator>& __lhs, +    const basic_string<_CharT, _Traits, _Allocator>& __rhs) noexcept { +    return basic_string_view<_CharT, _Traits>(__lhs) <=> basic_string_view<_CharT, _Traits>(__rhs); +} + +template <class _CharT, class _Traits, class _Allocator> +_LIBCPP_HIDE_FROM_ABI constexpr auto +operator<=>(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const _CharT* __rhs) { +    return basic_string_view<_CharT, _Traits>(__lhs) <=> basic_string_view<_CharT, _Traits>(__rhs); +} + +#else // _LIBCPP_STD_VER > 17 +  template<class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI +inline _LIBCPP_HIDE_FROM_ABI  bool  operator!=(const basic_string<_CharT,_Traits,_Allocator>& __lhs,             const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT @@ -4210,7 +4098,7 @@ operator!=(const basic_string<_CharT,_Traits,_Allocator>& __lhs,  }  template<class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI +inline _LIBCPP_HIDE_FROM_ABI  bool  operator!=(const _CharT* __lhs,             const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT @@ -4219,7 +4107,7 @@ operator!=(const _CharT* __lhs,  }  template<class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI +inline _LIBCPP_HIDE_FROM_ABI  bool  operator!=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,             const _CharT* __rhs) _NOEXCEPT @@ -4230,7 +4118,7 @@ operator!=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,  // operator<  template<class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI +inline _LIBCPP_HIDE_FROM_ABI  bool  operator< (const basic_string<_CharT, _Traits, _Allocator>& __lhs,             const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT @@ -4239,7 +4127,7 @@ operator< (const basic_string<_CharT, _Traits, _Allocator>& __lhs,  }  template<class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI +inline _LIBCPP_HIDE_FROM_ABI  bool  operator< (const basic_string<_CharT, _Traits, _Allocator>& __lhs,             const _CharT* __rhs) _NOEXCEPT @@ -4248,7 +4136,7 @@ operator< (const basic_string<_CharT, _Traits, _Allocator>& __lhs,  }  template<class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI +inline _LIBCPP_HIDE_FROM_ABI  bool  operator< (const _CharT* __lhs,             const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT @@ -4259,7 +4147,7 @@ operator< (const _CharT* __lhs,  // operator>  template<class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI +inline _LIBCPP_HIDE_FROM_ABI  bool  operator> (const basic_string<_CharT, _Traits, _Allocator>& __lhs,             const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT @@ -4268,7 +4156,7 @@ operator> (const basic_string<_CharT, _Traits, _Allocator>& __lhs,  }  template<class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI +inline _LIBCPP_HIDE_FROM_ABI  bool  operator> (const basic_string<_CharT, _Traits, _Allocator>& __lhs,             const _CharT* __rhs) _NOEXCEPT @@ -4277,7 +4165,7 @@ operator> (const basic_string<_CharT, _Traits, _Allocator>& __lhs,  }  template<class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI +inline _LIBCPP_HIDE_FROM_ABI  bool  operator> (const _CharT* __lhs,             const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT @@ -4288,7 +4176,7 @@ operator> (const _CharT* __lhs,  // operator<=  template<class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI +inline _LIBCPP_HIDE_FROM_ABI  bool  operator<=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,             const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT @@ -4297,7 +4185,7 @@ operator<=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,  }  template<class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI +inline _LIBCPP_HIDE_FROM_ABI  bool  operator<=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,             const _CharT* __rhs) _NOEXCEPT @@ -4306,7 +4194,7 @@ operator<=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,  }  template<class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI +inline _LIBCPP_HIDE_FROM_ABI  bool  operator<=(const _CharT* __lhs,             const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT @@ -4317,7 +4205,7 @@ operator<=(const _CharT* __lhs,  // operator>=  template<class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI +inline _LIBCPP_HIDE_FROM_ABI  bool  operator>=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,             const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT @@ -4326,7 +4214,7 @@ operator>=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,  }  template<class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI +inline _LIBCPP_HIDE_FROM_ABI  bool  operator>=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,             const _CharT* __rhs) _NOEXCEPT @@ -4335,18 +4223,19 @@ operator>=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,  }  template<class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI +inline _LIBCPP_HIDE_FROM_ABI  bool  operator>=(const _CharT* __lhs,             const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT  {      return !(__lhs < __rhs);  } +#endif // _LIBCPP_STD_VER > 17  // operator +  template<class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20  basic_string<_CharT, _Traits, _Allocator>  operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs,            const basic_string<_CharT, _Traits, _Allocator>& __rhs) @@ -4365,7 +4254,7 @@ operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs,  }  template<class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_HIDDEN _LIBCPP_CONSTEXPR_SINCE_CXX20  basic_string<_CharT, _Traits, _Allocator>  operator+(const _CharT* __lhs , const basic_string<_CharT,_Traits,_Allocator>& __rhs)  { @@ -4383,7 +4272,7 @@ operator+(const _CharT* __lhs , const basic_string<_CharT,_Traits,_Allocator>& _  }  template<class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20  basic_string<_CharT, _Traits, _Allocator>  operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Allocator>& __rhs)  { @@ -4400,7 +4289,7 @@ operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Allocator>& __rhs)  }  template<class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 +inline _LIBCPP_CONSTEXPR_SINCE_CXX20  basic_string<_CharT, _Traits, _Allocator>  operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const _CharT* __rhs)  { @@ -4418,7 +4307,7 @@ operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const _CharT*  }  template<class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_AFTER_CXX17 +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20  basic_string<_CharT, _Traits, _Allocator>  operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, _CharT __rhs)  { @@ -4437,7 +4326,7 @@ operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, _CharT __rhs)  #ifndef _LIBCPP_CXX03_LANG  template<class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20  basic_string<_CharT, _Traits, _Allocator>  operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, const basic_string<_CharT, _Traits, _Allocator>& __rhs)  { @@ -4445,7 +4334,7 @@ operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, const basic_string<  }  template<class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20  basic_string<_CharT, _Traits, _Allocator>  operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, basic_string<_CharT, _Traits, _Allocator>&& __rhs)  { @@ -4453,7 +4342,7 @@ operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, basic_string<_  }  template<class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20  basic_string<_CharT, _Traits, _Allocator>  operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, basic_string<_CharT, _Traits, _Allocator>&& __rhs)  { @@ -4461,7 +4350,7 @@ operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, basic_string<_CharT  }  template<class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20  basic_string<_CharT, _Traits, _Allocator>  operator+(const _CharT* __lhs , basic_string<_CharT,_Traits,_Allocator>&& __rhs)  { @@ -4469,7 +4358,7 @@ operator+(const _CharT* __lhs , basic_string<_CharT,_Traits,_Allocator>&& __rhs)  }  template<class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20  basic_string<_CharT, _Traits, _Allocator>  operator+(_CharT __lhs, basic_string<_CharT,_Traits,_Allocator>&& __rhs)  { @@ -4478,7 +4367,7 @@ operator+(_CharT __lhs, basic_string<_CharT,_Traits,_Allocator>&& __rhs)  }  template<class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20  basic_string<_CharT, _Traits, _Allocator>  operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, const _CharT* __rhs)  { @@ -4486,7 +4375,7 @@ operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, const _CharT* __rhs  }  template<class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20  basic_string<_CharT, _Traits, _Allocator>  operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, _CharT __rhs)  { @@ -4499,7 +4388,7 @@ operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, _CharT __rhs)  // swap  template<class _CharT, class _Traits, class _Allocator> -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20  void  swap(basic_string<_CharT, _Traits, _Allocator>& __lhs,       basic_string<_CharT, _Traits, _Allocator>& __rhs) @@ -4556,27 +4445,44 @@ const typename basic_string<_CharT, _Traits, _Allocator>::size_type                 basic_string<_CharT, _Traits, _Allocator>::npos;  template <class _CharT, class _Allocator> -struct _LIBCPP_TEMPLATE_VIS -    hash<basic_string<_CharT, char_traits<_CharT>, _Allocator> > -    : public __unary_function<basic_string<_CharT, char_traits<_CharT>, _Allocator>, size_t> +struct __string_hash : public __unary_function<basic_string<_CharT, char_traits<_CharT>, _Allocator>, size_t>  {      size_t      operator()(const basic_string<_CharT, char_traits<_CharT>, _Allocator>& __val) const _NOEXCEPT -    { return __do_string_hash(__val.data(), __val.data() + __val.size()); } +    { return std::__do_string_hash(__val.data(), __val.data() + __val.size()); }  }; +template <class _Allocator> +struct hash<basic_string<char, char_traits<char>, _Allocator> > : __string_hash<char, _Allocator> {}; + +#ifndef _LIBCPP_HAS_NO_CHAR8_T +template <class _Allocator> +struct hash<basic_string<char8_t, char_traits<char8_t>, _Allocator> > : __string_hash<char8_t, _Allocator> {}; +#endif + +template <class _Allocator> +struct hash<basic_string<char16_t, char_traits<char16_t>, _Allocator> > : __string_hash<char16_t, _Allocator> {}; + +template <class _Allocator> +struct hash<basic_string<char32_t, char_traits<char32_t>, _Allocator> > : __string_hash<char32_t, _Allocator> {}; + +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +template <class _Allocator> +struct hash<basic_string<wchar_t, char_traits<wchar_t>, _Allocator> > : __string_hash<wchar_t, _Allocator> {}; +#endif +  template<class _CharT, class _Traits, class _Allocator> -basic_ostream<_CharT, _Traits>& +_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&  operator<<(basic_ostream<_CharT, _Traits>& __os,             const basic_string<_CharT, _Traits, _Allocator>& __str);  template<class _CharT, class _Traits, class _Allocator> -basic_istream<_CharT, _Traits>& +_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&  operator>>(basic_istream<_CharT, _Traits>& __is,             basic_string<_CharT, _Traits, _Allocator>& __str);  template<class _CharT, class _Traits, class _Allocator> -basic_istream<_CharT, _Traits>& +_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&  getline(basic_istream<_CharT, _Traits>& __is,          basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm); @@ -4662,14 +4568,14 @@ inline namespace literals  {    inline namespace string_literals    { -    inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      basic_string<char> operator "" s( const char *__str, size_t __len )      {          return basic_string<char> (__str, __len);      }  #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -    inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      basic_string<wchar_t> operator "" s( const wchar_t *__str, size_t __len )      {          return basic_string<wchar_t> (__str, __len); @@ -4678,19 +4584,19 @@ inline namespace literals  #ifndef _LIBCPP_HAS_NO_CHAR8_T      inline _LIBCPP_HIDE_FROM_ABI constexpr -    basic_string<char8_t> operator "" s(const char8_t *__str, size_t __len) _NOEXCEPT +    basic_string<char8_t> operator "" s(const char8_t *__str, size_t __len)      {          return basic_string<char8_t> (__str, __len);      }  #endif -    inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      basic_string<char16_t> operator "" s( const char16_t *__str, size_t __len )      {          return basic_string<char16_t> (__str, __len);      } -    inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +    inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20      basic_string<char32_t> operator "" s( const char32_t *__str, size_t __len )      {          return basic_string<char32_t> (__str, __len); @@ -4713,4 +4619,15 @@ _LIBCPP_END_NAMESPACE_STD  _LIBCPP_POP_MACROS +#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 +#  include <algorithm> +#  include <concepts> +#  include <functional> +#  include <iterator> +#  include <new> +#  include <typeinfo> +#  include <utility> +#  include <vector> +#endif +  #endif // _LIBCPP_STRING | 
