1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
diff --git a/include/string b/include/string
index 53cf9ab..a1bfff1 100644
--- a/include/string
+++ b/include/string
@@ -652,6 +652,7 @@ class
#endif
basic_string
{
+ static_assert(sizeof(_CharT) <= 4, "libc++ implementation of std::basic_string does not support extra-wide character types");
public:
typedef basic_string __self;
typedef basic_string_view<_CharT, _Traits> __self_view;
@@ -674,8 +675,13 @@ public:
static_assert(( is_same<typename allocator_type::value_type, value_type>::value),
"Allocator::value_type must be same type as value_type");
+#if _YNDX_LIBCPP_MAKE_STRING_ITERATOR_POINTERS == 1
+ typedef pointer iterator;
+ typedef const_pointer const_iterator;
+#else
typedef __wrap_iter<pointer> iterator;
typedef __wrap_iter<const_pointer> const_iterator;
+#endif
typedef _VSTD::reverse_iterator<iterator> reverse_iterator;
typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
@@ -790,6 +796,10 @@ public:
_NOEXCEPT;
#endif
+#if _LIBCPP_STD_VER > 17
+ basic_string(nullptr_t) = delete;
+#endif
+
_LIBCPP_INLINE_VISIBILITY
basic_string(basic_string&& __str, const allocator_type& __a);
#endif // _LIBCPP_CXX03_LANG
@@ -806,14 +816,18 @@ public:
_LIBCPP_INLINE_VISIBILITY
basic_string(const _CharT* __s, const _Allocator& __a);
-#if _LIBCPP_STD_VER > 20
- basic_string(nullptr_t) = delete;
-#endif
+ _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
+ basic_string(nullptr_t, size_t) = delete;
_LIBCPP_INLINE_VISIBILITY
basic_string(const _CharT* __s, size_type __n);
+
+ _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
+ basic_string(nullptr_t, size_t, const _Allocator&) = delete;
+
_LIBCPP_INLINE_VISIBILITY
basic_string(const _CharT* __s, size_type __n, const _Allocator& __a);
+
_LIBCPP_INLINE_VISIBILITY
basic_string(size_type __n, _CharT __c);
@@ -861,6 +875,8 @@ public:
basic_string& operator=(const basic_string& __str);
+ basic_string& operator=(nullptr_t) = delete;
+
template <class _Tp, class = __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && !__is_same_uncvref<_Tp, basic_string>::value> >
basic_string& operator=(const _Tp& __t)
{__self_view __sv = __t; return assign(__sv);}
@@ -939,6 +955,14 @@ public:
{return (__is_long() ? __get_long_cap()
: static_cast<size_type>(__min_cap)) - 1;}
+
+#if _YNDX_LIBCXX_ENABLE_STRING_RESIZE_UNINITIALIZED == 1
+ inline void resize_uninitialized(size_type __n)
+ {
+ __resize_default_init(__n);
+ }
+#endif
+
void resize(size_type __n, value_type __c);
_LIBCPP_INLINE_VISIBILITY void resize(size_type __n) {resize(__n, value_type());}
@@ -1375,7 +1399,8 @@ public:
int compare(size_type __pos1, size_type __n1, const value_type* __s) const;
int compare(size_type __pos1, size_type __n1, const value_type* __s, size_type __n2) const;
-#if _LIBCPP_STD_VER > 17
+//WARN: disabled std guards in order to allow using these options without switching to new std
+//#if _LIBCPP_STD_VER > 17
constexpr _LIBCPP_INLINE_VISIBILITY
bool starts_with(__self_view __sv) const noexcept
{ return __self_view(data(), size()).starts_with(__sv); }
@@ -1399,9 +1424,9 @@ public:
constexpr _LIBCPP_INLINE_VISIBILITY
bool ends_with(const value_type* __s) const noexcept
{ return ends_with(__self_view(__s)); }
-#endif
+//#endif
-#if _LIBCPP_STD_VER > 20
+#if _LIBCPP_STD_VER >= 20
constexpr _LIBCPP_INLINE_VISIBILITY
bool contains(__self_view __sv) const noexcept
{ return __self_view(data(), size()).contains(__sv); }
@@ -2316,7 +2341,7 @@ basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s, size_type __n)
{
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::assign received nullptr");
- return (__builtin_constant_p(__n) && __fits_in_sso(__n))
+ return (_LIBCPP_BUILTIN_CONSTANT_P(__n) && __fits_in_sso(__n))
? __assign_short(__s, __n)
: __assign_external(__s, __n);
}
@@ -2518,7 +2543,7 @@ basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s)
{
_LIBCPP_ASSERT(__s != nullptr, "string::assign received nullptr");
- return __builtin_constant_p(*__s)
+ return _LIBCPP_BUILTIN_CONSTANT_P(*__s)
? (__fits_in_sso(traits_type::length(__s))
? __assign_short(__s, traits_type::length(__s))
: __assign_external(__s, traits_type::length(__s)))
@@ -4494,6 +4519,10 @@ inline namespace literals
_LIBCPP_END_NAMESPACE_STD
+#ifdef _LIBCPP_COMPILER_MSVC
+#pragma warning ( pop )
+#endif
+
_LIBCPP_POP_MACROS
#endif // _LIBCPP_STRING
|