43-string.patch 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. diff --git a/include/string b/include/string
  2. index a456f8c..804373b 100644
  3. --- a/include/string
  4. +++ b/include/string
  5. @@ -83,6 +83,7 @@ template <> struct char_traits<char32_t>;
  6. template<class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
  7. class basic_string
  8. {
  9. + static_assert(sizeof(_CharT) <= 4, "libc++ implementation of std::basic_string does not support extra-wide character types");
  10. public:
  11. // types:
  12. typedef traits traits_type;
  13. @@ -981,9 +982,10 @@ public:
  14. __init(__s, traits_type::length(__s));
  15. }
  16. -#if _LIBCPP_STD_VER >= 23
  17. +#if _LIBCPP_STD_VER >= 20
  18. basic_string(nullptr_t) = delete;
  19. #endif
  20. + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(nullptr_t, size_t) = delete;
  21. _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const _CharT* __s, size_type __n)
  22. : __r_(__default_init_tag(), __default_init_tag()) {
  23. @@ -991,6 +993,8 @@ public:
  24. __init(__s, __n);
  25. }
  26. + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(nullptr_t, size_t, const _Allocator&) = delete;
  27. +
  28. _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
  29. basic_string(const _CharT* __s, size_type __n, const _Allocator& __a)
  30. : __r_(__default_init_tag(), __a) {
  31. @@ -1155,7 +1159,7 @@ public:
  32. _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator=(const value_type* __s) {
  33. return assign(__s);
  34. }
  35. -#if _LIBCPP_STD_VER >= 23
  36. +#if _LIBCPP_STD_VER >= 20
  37. basic_string& operator=(nullptr_t) = delete;
  38. #endif
  39. _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator=(value_type __c);
  40. @@ -1212,6 +1216,10 @@ public:
  41. return (__is_long() ? __get_long_cap() : static_cast<size_type>(__min_cap)) - 1;
  42. }
  43. +#if _YNDX_LIBCXX_ENABLE_STRING_RESIZE_UNINITIALIZED == 1
  44. + inline void resize_uninitialized(size_type __n) { __resize_default_init(__n); }
  45. +#endif
  46. +
  47. _LIBCPP_CONSTEXPR_SINCE_CXX20 void resize(size_type __n, value_type __c);
  48. _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void resize(size_type __n) { resize(__n, value_type()); }
  49. @@ -1759,7 +1767,7 @@ public:
  50. }
  51. #endif
  52. -#if _LIBCPP_STD_VER >= 23
  53. +#if _LIBCPP_STD_VER >= 20
  54. constexpr _LIBCPP_HIDE_FROM_ABI bool contains(__self_view __sv) const noexcept {
  55. return __self_view(data(), size()).contains(__sv);
  56. }