From Jason Turner

[string.syn]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpg4rewjy5/{from.md → to.md} +80 -100
tmp/tmpg4rewjy5/{from.md → to.md} RENAMED
@@ -1,128 +1,92 @@
1
  ### Header `<string>` synopsis <a id="string.syn">[[string.syn]]</a>
2
 
3
  ``` cpp
4
- #include <initializer_list>
 
5
 
6
  namespace std {
7
  // [char.traits], character traits
8
  template<class charT> struct char_traits;
9
  template<> struct char_traits<char>;
 
10
  template<> struct char_traits<char16_t>;
11
  template<> struct char_traits<char32_t>;
12
  template<> struct char_traits<wchar_t>;
13
 
14
  // [basic.string], basic_string
15
- template<class charT, class traits = char_traits<charT>,
16
- class Allocator = allocator<charT>>
17
  class basic_string;
18
 
19
  template<class charT, class traits, class Allocator>
20
- basic_string<charT, traits, Allocator>
21
  operator+(const basic_string<charT, traits, Allocator>& lhs,
22
  const basic_string<charT, traits, Allocator>& rhs);
23
  template<class charT, class traits, class Allocator>
24
- basic_string<charT, traits, Allocator>
25
  operator+(basic_string<charT, traits, Allocator>&& lhs,
26
  const basic_string<charT, traits, Allocator>& rhs);
27
  template<class charT, class traits, class Allocator>
28
- basic_string<charT, traits, Allocator>
29
  operator+(const basic_string<charT, traits, Allocator>& lhs,
30
  basic_string<charT, traits, Allocator>&& rhs);
31
  template<class charT, class traits, class Allocator>
32
- basic_string<charT, traits, Allocator>
33
  operator+(basic_string<charT, traits, Allocator>&& lhs,
34
  basic_string<charT, traits, Allocator>&& rhs);
35
  template<class charT, class traits, class Allocator>
36
- basic_string<charT, traits, Allocator>
37
  operator+(const charT* lhs,
38
  const basic_string<charT, traits, Allocator>& rhs);
39
  template<class charT, class traits, class Allocator>
40
- basic_string<charT, traits, Allocator>
41
  operator+(const charT* lhs,
42
  basic_string<charT, traits, Allocator>&& rhs);
43
  template<class charT, class traits, class Allocator>
44
- basic_string<charT, traits, Allocator>
45
- operator+(charT lhs, const basic_string<charT, traits, Allocator>& rhs);
 
46
  template<class charT, class traits, class Allocator>
47
- basic_string<charT, traits, Allocator>
48
- operator+(charT lhs, basic_string<charT, traits, Allocator>&& rhs);
 
49
  template<class charT, class traits, class Allocator>
50
- basic_string<charT, traits, Allocator>
51
  operator+(const basic_string<charT, traits, Allocator>& lhs,
52
  const charT* rhs);
53
  template<class charT, class traits, class Allocator>
54
- basic_string<charT, traits, Allocator>
55
  operator+(basic_string<charT, traits, Allocator>&& lhs,
56
  const charT* rhs);
57
  template<class charT, class traits, class Allocator>
58
- basic_string<charT, traits, Allocator>
59
- operator+(const basic_string<charT, traits, Allocator>& lhs, charT rhs);
 
60
  template<class charT, class traits, class Allocator>
61
- basic_string<charT, traits, Allocator>
62
- operator+(basic_string<charT, traits, Allocator>&& lhs, charT rhs);
 
63
 
64
  template<class charT, class traits, class Allocator>
65
- bool operator==(const basic_string<charT, traits, Allocator>& lhs,
66
- const basic_string<charT, traits, Allocator>& rhs) noexcept;
67
- template<class charT, class traits, class Allocator>
68
- bool operator==(const charT* lhs,
69
- const basic_string<charT, traits, Allocator>& rhs);
70
- template<class charT, class traits, class Allocator>
71
- bool operator==(const basic_string<charT, traits, Allocator>& lhs,
72
- const charT* rhs);
73
- template<class charT, class traits, class Allocator>
74
- bool operator!=(const basic_string<charT, traits, Allocator>& lhs,
75
  const basic_string<charT, traits, Allocator>& rhs) noexcept;
76
  template<class charT, class traits, class Allocator>
77
- bool operator!=(const charT* lhs,
78
- const basic_string<charT, traits, Allocator>& rhs);
79
- template<class charT, class traits, class Allocator>
80
- bool operator!=(const basic_string<charT, traits, Allocator>& lhs,
81
  const charT* rhs);
82
 
83
  template<class charT, class traits, class Allocator>
84
- bool operator< (const basic_string<charT, traits, Allocator>& lhs,
85
- const basic_string<charT, traits, Allocator>& rhs) noexcept;
86
  template<class charT, class traits, class Allocator>
87
- bool operator< (const basic_string<charT, traits, Allocator>& lhs,
88
- const charT* rhs);
89
- template<class charT, class traits, class Allocator>
90
- bool operator< (const charT* lhs,
91
- const basic_string<charT, traits, Allocator>& rhs);
92
- template<class charT, class traits, class Allocator>
93
- bool operator> (const basic_string<charT, traits, Allocator>& lhs,
94
- const basic_string<charT, traits, Allocator>& rhs) noexcept;
95
- template<class charT, class traits, class Allocator>
96
- bool operator> (const basic_string<charT, traits, Allocator>& lhs,
97
- const charT* rhs);
98
- template<class charT, class traits, class Allocator>
99
- bool operator> (const charT* lhs,
100
- const basic_string<charT, traits, Allocator>& rhs);
101
-
102
- template<class charT, class traits, class Allocator>
103
- bool operator<=(const basic_string<charT, traits, Allocator>& lhs,
104
- const basic_string<charT, traits, Allocator>& rhs) noexcept;
105
- template<class charT, class traits, class Allocator>
106
- bool operator<=(const basic_string<charT, traits, Allocator>& lhs,
107
- const charT* rhs);
108
- template<class charT, class traits, class Allocator>
109
- bool operator<=(const charT* lhs,
110
- const basic_string<charT, traits, Allocator>& rhs);
111
- template<class charT, class traits, class Allocator>
112
- bool operator>=(const basic_string<charT, traits, Allocator>& lhs,
113
- const basic_string<charT, traits, Allocator>& rhs) noexcept;
114
- template<class charT, class traits, class Allocator>
115
- bool operator>=(const basic_string<charT, traits, Allocator>& lhs,
116
- const charT* rhs);
117
- template<class charT, class traits, class Allocator>
118
- bool operator>=(const charT* lhs,
119
- const basic_string<charT, traits, Allocator>& rhs);
120
 
121
  // [string.special], swap
122
  template<class charT, class traits, class Allocator>
123
- void swap(basic_string<charT, traits, Allocator>& lhs,
 
124
  basic_string<charT, traits, Allocator>& rhs)
125
  noexcept(noexcept(lhs.swap(rhs)));
126
 
127
  // [string.io], inserters and extractors
128
  template<class charT, class traits, class Allocator>
@@ -150,78 +114,94 @@ namespace std {
150
  template<class charT, class traits, class Allocator>
151
  basic_istream<charT, traits>&
152
  getline(basic_istream<charT, traits>&& is,
153
  basic_string<charT, traits, Allocator>& str);
154
 
 
 
 
 
 
 
 
 
155
  // basic_string typedef names
156
  using string = basic_string<char>;
 
157
  using u16string = basic_string<char16_t>;
158
  using u32string = basic_string<char32_t>;
159
  using wstring = basic_string<wchar_t>;
160
 
161
  // [string.conversions], numeric conversions
162
- int stoi(const string& str, size_t* idx = 0, int base = 10);
163
- long stol(const string& str, size_t* idx = 0, int base = 10);
164
- unsigned long stoul(const string& str, size_t* idx = 0, int base = 10);
165
- long long stoll(const string& str, size_t* idx = 0, int base = 10);
166
- unsigned long long stoull(const string& str, size_t* idx = 0, int base = 10);
167
- float stof(const string& str, size_t* idx = 0);
168
- double stod(const string& str, size_t* idx = 0);
169
- long double stold(const string& str, size_t* idx = 0);
170
  string to_string(int val);
171
  string to_string(unsigned val);
172
  string to_string(long val);
173
  string to_string(unsigned long val);
174
  string to_string(long long val);
175
  string to_string(unsigned long long val);
176
  string to_string(float val);
177
  string to_string(double val);
178
  string to_string(long double val);
179
 
180
- int stoi(const wstring& str, size_t* idx = 0, int base = 10);
181
- long stol(const wstring& str, size_t* idx = 0, int base = 10);
182
- unsigned long stoul(const wstring& str, size_t* idx = 0, int base = 10);
183
- long long stoll(const wstring& str, size_t* idx = 0, int base = 10);
184
- unsigned long long stoull(const wstring& str, size_t* idx = 0, int base = 10);
185
- float stof(const wstring& str, size_t* idx = 0);
186
- double stod(const wstring& str, size_t* idx = 0);
187
- long double stold(const wstring& str, size_t* idx = 0);
188
  wstring to_wstring(int val);
189
  wstring to_wstring(unsigned val);
190
  wstring to_wstring(long val);
191
  wstring to_wstring(unsigned long val);
192
  wstring to_wstring(long long val);
193
  wstring to_wstring(unsigned long long val);
194
  wstring to_wstring(float val);
195
  wstring to_wstring(double val);
196
  wstring to_wstring(long double val);
197
 
 
 
 
 
 
 
 
 
 
 
 
198
  // [basic.string.hash], hash support
199
  template<class T> struct hash;
200
  template<> struct hash<string>;
 
201
  template<> struct hash<u16string>;
202
  template<> struct hash<u32string>;
203
  template<> struct hash<wstring>;
204
-
205
- namespace pmr {
206
- template <class charT, class traits = char_traits<charT>>
207
- using basic_string =
208
- std::basic_string<charT, traits, polymorphic_allocator<charT>>;
209
-
210
- using string = basic_string<char>;
211
- using u16string = basic_string<char16_t>;
212
- using u32string = basic_string<char32_t>;
213
- using wstring = basic_string<wchar_t>;
214
- }
215
 
216
  inline namespace literals {
217
  inline namespace string_literals {
218
  // [basic.string.literals], suffix for basic_string literals
219
- string operator""s(const char* str, size_t len);
220
- u16string operator""s(const char16_t* str, size_t len);
221
- u32string operator""s(const char32_t* str, size_t len);
222
- wstring operator""s(const wchar_t* str, size_t len);
 
223
  }
224
  }
225
  }
226
  ```
227
 
 
1
  ### Header `<string>` synopsis <a id="string.syn">[[string.syn]]</a>
2
 
3
  ``` cpp
4
+ #include <compare> // see [compare.syn]
5
+ #include <initializer_list> // see [initializer.list.syn]
6
 
7
  namespace std {
8
  // [char.traits], character traits
9
  template<class charT> struct char_traits;
10
  template<> struct char_traits<char>;
11
+ template<> struct char_traits<char8_t>;
12
  template<> struct char_traits<char16_t>;
13
  template<> struct char_traits<char32_t>;
14
  template<> struct char_traits<wchar_t>;
15
 
16
  // [basic.string], basic_string
17
+ template<class charT, class traits = char_traits<charT>, class Allocator = allocator<charT>>
 
18
  class basic_string;
19
 
20
  template<class charT, class traits, class Allocator>
21
+ constexpr basic_string<charT, traits, Allocator>
22
  operator+(const basic_string<charT, traits, Allocator>& lhs,
23
  const basic_string<charT, traits, Allocator>& rhs);
24
  template<class charT, class traits, class Allocator>
25
+ constexpr basic_string<charT, traits, Allocator>
26
  operator+(basic_string<charT, traits, Allocator>&& lhs,
27
  const basic_string<charT, traits, Allocator>& rhs);
28
  template<class charT, class traits, class Allocator>
29
+ constexpr basic_string<charT, traits, Allocator>
30
  operator+(const basic_string<charT, traits, Allocator>& lhs,
31
  basic_string<charT, traits, Allocator>&& rhs);
32
  template<class charT, class traits, class Allocator>
33
+ constexpr basic_string<charT, traits, Allocator>
34
  operator+(basic_string<charT, traits, Allocator>&& lhs,
35
  basic_string<charT, traits, Allocator>&& rhs);
36
  template<class charT, class traits, class Allocator>
37
+ constexpr basic_string<charT, traits, Allocator>
38
  operator+(const charT* lhs,
39
  const basic_string<charT, traits, Allocator>& rhs);
40
  template<class charT, class traits, class Allocator>
41
+ constexpr basic_string<charT, traits, Allocator>
42
  operator+(const charT* lhs,
43
  basic_string<charT, traits, Allocator>&& rhs);
44
  template<class charT, class traits, class Allocator>
45
+ constexpr basic_string<charT, traits, Allocator>
46
+ operator+(charT lhs,
47
+ const basic_string<charT, traits, Allocator>& rhs);
48
  template<class charT, class traits, class Allocator>
49
+ constexpr basic_string<charT, traits, Allocator>
50
+ operator+(charT lhs,
51
+ basic_string<charT, traits, Allocator>&& rhs);
52
  template<class charT, class traits, class Allocator>
53
+ constexpr basic_string<charT, traits, Allocator>
54
  operator+(const basic_string<charT, traits, Allocator>& lhs,
55
  const charT* rhs);
56
  template<class charT, class traits, class Allocator>
57
+ constexpr basic_string<charT, traits, Allocator>
58
  operator+(basic_string<charT, traits, Allocator>&& lhs,
59
  const charT* rhs);
60
  template<class charT, class traits, class Allocator>
61
+ constexpr basic_string<charT, traits, Allocator>
62
+ operator+(const basic_string<charT, traits, Allocator>& lhs,
63
+ charT rhs);
64
  template<class charT, class traits, class Allocator>
65
+ constexpr basic_string<charT, traits, Allocator>
66
+ operator+(basic_string<charT, traits, Allocator>&& lhs,
67
+ charT rhs);
68
 
69
  template<class charT, class traits, class Allocator>
70
+ constexpr bool
71
+ operator==(const basic_string<charT, traits, Allocator>& lhs,
 
 
 
 
 
 
 
 
72
  const basic_string<charT, traits, Allocator>& rhs) noexcept;
73
  template<class charT, class traits, class Allocator>
74
+ constexpr bool operator==(const basic_string<charT, traits, Allocator>& lhs,
 
 
 
75
  const charT* rhs);
76
 
77
  template<class charT, class traits, class Allocator>
78
+ constexpr see below operator<=>(const basic_string<charT, traits, Allocator>& lhs,
79
+ \itcorr const basic_string<charT, traits, Allocator>& rhs) noexcept;
80
  template<class charT, class traits, class Allocator>
81
+ constexpr see below operator<=>(const basic_string<charT, traits, Allocator>& lhs,
82
+ \itcorr const charT* rhs);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
 
84
  // [string.special], swap
85
  template<class charT, class traits, class Allocator>
86
+ constexpr void
87
+ swap(basic_string<charT, traits, Allocator>& lhs,
88
  basic_string<charT, traits, Allocator>& rhs)
89
  noexcept(noexcept(lhs.swap(rhs)));
90
 
91
  // [string.io], inserters and extractors
92
  template<class charT, class traits, class Allocator>
 
114
  template<class charT, class traits, class Allocator>
115
  basic_istream<charT, traits>&
116
  getline(basic_istream<charT, traits>&& is,
117
  basic_string<charT, traits, Allocator>& str);
118
 
119
+ // [string.erasure], erasure
120
+ template<class charT, class traits, class Allocator, class U>
121
+ constexpr typename basic_string<charT, traits, Allocator>::size_type
122
+ erase(basic_string<charT, traits, Allocator>& c, const U& value);
123
+ template<class charT, class traits, class Allocator, class Predicate>
124
+ constexpr typename basic_string<charT, traits, Allocator>::size_type
125
+ erase_if(basic_string<charT, traits, Allocator>& c, Predicate pred);
126
+
127
  // basic_string typedef names
128
  using string = basic_string<char>;
129
+ using u8string = basic_string<char8_t>;
130
  using u16string = basic_string<char16_t>;
131
  using u32string = basic_string<char32_t>;
132
  using wstring = basic_string<wchar_t>;
133
 
134
  // [string.conversions], numeric conversions
135
+ int stoi(const string& str, size_t* idx = nullptr, int base = 10);
136
+ long stol(const string& str, size_t* idx = nullptr, int base = 10);
137
+ unsigned long stoul(const string& str, size_t* idx = nullptr, int base = 10);
138
+ long long stoll(const string& str, size_t* idx = nullptr, int base = 10);
139
+ unsigned long long stoull(const string& str, size_t* idx = nullptr, int base = 10);
140
+ float stof(const string& str, size_t* idx = nullptr);
141
+ double stod(const string& str, size_t* idx = nullptr);
142
+ long double stold(const string& str, size_t* idx = nullptr);
143
  string to_string(int val);
144
  string to_string(unsigned val);
145
  string to_string(long val);
146
  string to_string(unsigned long val);
147
  string to_string(long long val);
148
  string to_string(unsigned long long val);
149
  string to_string(float val);
150
  string to_string(double val);
151
  string to_string(long double val);
152
 
153
+ int stoi(const wstring& str, size_t* idx = nullptr, int base = 10);
154
+ long stol(const wstring& str, size_t* idx = nullptr, int base = 10);
155
+ unsigned long stoul(const wstring& str, size_t* idx = nullptr, int base = 10);
156
+ long long stoll(const wstring& str, size_t* idx = nullptr, int base = 10);
157
+ unsigned long long stoull(const wstring& str, size_t* idx = nullptr, int base = 10);
158
+ float stof(const wstring& str, size_t* idx = nullptr);
159
+ double stod(const wstring& str, size_t* idx = nullptr);
160
+ long double stold(const wstring& str, size_t* idx = nullptr);
161
  wstring to_wstring(int val);
162
  wstring to_wstring(unsigned val);
163
  wstring to_wstring(long val);
164
  wstring to_wstring(unsigned long val);
165
  wstring to_wstring(long long val);
166
  wstring to_wstring(unsigned long long val);
167
  wstring to_wstring(float val);
168
  wstring to_wstring(double val);
169
  wstring to_wstring(long double val);
170
 
171
+ namespace pmr {
172
+ template<class charT, class traits = char_traits<charT>>
173
+ using basic_string = std::basic_string<charT, traits, polymorphic_allocator<charT>>;
174
+
175
+ using string = basic_string<char>;
176
+ using u8string = basic_string<char8_t>;
177
+ using u16string = basic_string<char16_t>;
178
+ using u32string = basic_string<char32_t>;
179
+ using wstring = basic_string<wchar_t>;
180
+ }
181
+
182
  // [basic.string.hash], hash support
183
  template<class T> struct hash;
184
  template<> struct hash<string>;
185
+ template<> struct hash<u8string>;
186
  template<> struct hash<u16string>;
187
  template<> struct hash<u32string>;
188
  template<> struct hash<wstring>;
189
+ template<> struct hash<pmr::string>;
190
+ template<> struct hash<pmr::u8string>;
191
+ template<> struct hash<pmr::u16string>;
192
+ template<> struct hash<pmr::u32string>;
193
+ template<> struct hash<pmr::wstring>;
 
 
 
 
 
 
194
 
195
  inline namespace literals {
196
  inline namespace string_literals {
197
  // [basic.string.literals], suffix for basic_string literals
198
+ constexpr string operator""s(const char* str, size_t len);
199
+ constexpr u8string operator""s(const char8_t* str, size_t len);
200
+ constexpr u16string operator""s(const char16_t* str, size_t len);
201
+ constexpr u32string operator""s(const char32_t* str, size_t len);
202
+ constexpr wstring operator""s(const wchar_t* str, size_t len);
203
  }
204
  }
205
  }
206
  ```
207