From Jason Turner

[basic.string]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp36xupwrw/{from.md → to.md} +83 -90
tmp/tmp36xupwrw/{from.md → to.md} RENAMED
@@ -48,11 +48,12 @@ namespace std {
48
  typedef std::reverse_iterator<iterator> reverse_iterator;
49
  typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
50
  static const size_type npos = -1;
51
 
52
  // [string.cons], construct/copy/destroy:
53
- explicit basic_string(const Allocator& a = Allocator());
 
54
  basic_string(const basic_string& str);
55
  basic_string(basic_string&& str) noexcept;
56
  basic_string(const basic_string& str, size_type pos, size_type n = npos,
57
  const Allocator& a = Allocator());
58
  basic_string(const charT* s,
@@ -117,11 +118,11 @@ namespace std {
117
  basic_string& operator+=(const charT* s);
118
  basic_string& operator+=(charT c);
119
  basic_string& operator+=(initializer_list<charT>);
120
  basic_string& append(const basic_string& str);
121
  basic_string& append(const basic_string& str, size_type pos,
122
- size_type n);
123
  basic_string& append(const charT* s, size_type n);
124
  basic_string& append(const charT* s);
125
  basic_string& append(size_type n, charT c);
126
  template<class InputIterator>
127
  basic_string& append(InputIterator first, InputIterator last);
@@ -129,21 +130,21 @@ namespace std {
129
  void push_back(charT c);
130
 
131
  basic_string& assign(const basic_string& str);
132
  basic_string& assign(basic_string&& str) noexcept;
133
  basic_string& assign(const basic_string& str, size_type pos,
134
- size_type n);
135
  basic_string& assign(const charT* s, size_type n);
136
  basic_string& assign(const charT* s);
137
  basic_string& assign(size_type n, charT c);
138
  template<class InputIterator>
139
  basic_string& assign(InputIterator first, InputIterator last);
140
  basic_string& assign(initializer_list<charT>);
141
 
142
  basic_string& insert(size_type pos1, const basic_string& str);
143
  basic_string& insert(size_type pos1, const basic_string& str,
144
- size_type pos2, size_type n);
145
  basic_string& insert(size_type pos, const charT* s, size_type n);
146
  basic_string& insert(size_type pos, const charT* s);
147
  basic_string& insert(size_type pos, size_type n, charT c);
148
  iterator insert(const_iterator p, charT c);
149
  iterator insert(const_iterator p, size_type n, charT c);
@@ -159,11 +160,11 @@ namespace std {
159
 
160
  basic_string& replace(size_type pos1, size_type n1,
161
  const basic_string& str);
162
  basic_string& replace(size_type pos1, size_type n1,
163
  const basic_string& str,
164
- size_type pos2, size_type n2);
165
  basic_string& replace(size_type pos, size_type n1, const charT* s,
166
  size_type n2);
167
  basic_string& replace(size_type pos, size_type n1, const charT* s);
168
  basic_string& replace(size_type pos, size_type n1, size_type n2,
169
  charT c);
@@ -189,50 +190,50 @@ namespace std {
189
  allocator_type get_allocator() const noexcept;
190
 
191
  size_type find (const basic_string& str, size_type pos = 0) const noexcept;
192
  size_type find (const charT* s, size_type pos, size_type n) const;
193
  size_type find (const charT* s, size_type pos = 0) const;
194
- size_type find (charT c, size_type pos = 0) const noexcept;
195
  size_type rfind(const basic_string& str, size_type pos = npos) const noexcept;
196
  size_type rfind(const charT* s, size_type pos, size_type n) const;
197
  size_type rfind(const charT* s, size_type pos = npos) const;
198
- size_type rfind(charT c, size_type pos = npos) const noexcept;
199
 
200
  size_type find_first_of(const basic_string& str,
201
  size_type pos = 0) const noexcept;
202
  size_type find_first_of(const charT* s,
203
  size_type pos, size_type n) const;
204
  size_type find_first_of(const charT* s, size_type pos = 0) const;
205
- size_type find_first_of(charT c, size_type pos = 0) const noexcept;
206
  size_type find_last_of (const basic_string& str,
207
  size_type pos = npos) const noexcept;
208
  size_type find_last_of (const charT* s,
209
  size_type pos, size_type n) const;
210
  size_type find_last_of (const charT* s, size_type pos = npos) const;
211
- size_type find_last_of (charT c, size_type pos = npos) const noexcept;
212
 
213
  size_type find_first_not_of(const basic_string& str,
214
  size_type pos = 0) const noexcept;
215
  size_type find_first_not_of(const charT* s, size_type pos,
216
  size_type n) const;
217
  size_type find_first_not_of(const charT* s, size_type pos = 0) const;
218
- size_type find_first_not_of(charT c, size_type pos = 0) const noexcept;
219
  size_type find_last_not_of (const basic_string& str,
220
  size_type pos = npos) const noexcept;
221
  size_type find_last_not_of (const charT* s, size_type pos,
222
  size_type n) const;
223
  size_type find_last_not_of (const charT* s,
224
  size_type pos = npos) const;
225
- size_type find_last_not_of (charT c, size_type pos = npos) const noexcept;
226
 
227
  basic_string substr(size_type pos = 0, size_type n = npos) const;
228
  int compare(const basic_string& str) const noexcept;
229
  int compare(size_type pos1, size_type n1,
230
  const basic_string& str) const;
231
  int compare(size_type pos1, size_type n1,
232
  const basic_string& str,
233
- size_type pos2, size_type n2) const;
234
  int compare(const charT* s) const;
235
  int compare(size_type pos1, size_type n1,
236
  const charT* s) const;
237
  int compare(size_type pos1, size_type n1,
238
  const charT* s, size_type n2) const;
@@ -246,12 +247,10 @@ If any operation would cause `size()` to exceed `max_size()`, that
246
  operation shall throw an exception object of type `length_error`.
247
 
248
  If any member function or operator of `basic_string` throws an
249
  exception, that function or operator shall have no other effect.
250
 
251
- No `erase()` or `pop_back()` member function shall throw any exceptions.
252
-
253
  In every specialization `basic_string<charT, traits, Allocator>`, the
254
  type `allocator_traits<Allocator>::value_type` shall name the same type
255
  as `charT`. Every object of type
256
  `basic_string<charT, traits, Allocator>` shall use an object of type
257
  `Allocator` to allocate and free storage for the contained `charT`
@@ -273,11 +272,11 @@ References, pointers, and iterators referring to the elements of a
273
  `front`, `back`, `begin`, `rbegin`, `end`, and `rend`.
274
 
275
  ### `basic_string` constructors and assignment operators <a id="string.cons">[[string.cons]]</a>
276
 
277
  ``` cpp
278
- explicit basic_string(const Allocator& a = Allocator());
279
  ```
280
 
281
  *Effects:* Constructs an object of class `basic_string`. The
282
  postconditions of this function are indicated in
283
  Table  [[tab:strings.ctr.1]].
@@ -289,31 +288,28 @@ Table  [[tab:strings.ctr.1]].
289
  | `data()` | a non-null pointer that is copyable and can have 0 added to it |
290
  | `size()` | 0 |
291
  | `capacity()` | an unspecified value |
292
 
293
  ``` cpp
294
- basic_string(const basic_string<charT,traits,Allocator>& str);
295
- basic_string(basic_string<charT,traits,Allocator>&& str) noexcept;
296
  ```
297
 
298
  *Effects:* Constructs an object of class `basic_string` as indicated in
299
  Table  [[tab:strings.ctr.cpy]]. In the second form, `str` is left in a
300
  valid state with an unspecified value.
301
 
302
- *Throws:* The second form throws nothing if the allocator’s move
303
- constructor throws nothing.
304
-
305
  **Table: `basic_string(const basic_string&)` effects** <a id="tab:strings.ctr.cpy">[tab:strings.ctr.cpy]</a>
306
 
307
  | Element | Value |
308
  | ------------ | --------------------------------------------------------------------------------------------------------------- |
309
  | `data()` | points at the first element of an allocated copy of the array whose first element is pointed at by `str.data()` |
310
  | `size()` | `str.size()` |
311
  | `capacity()` | a value at least as large as `size()` |
312
 
313
  ``` cpp
314
- basic_string(const basic_string<charT,traits,Allocator>& str,
315
  size_type pos, size_type n = npos,
316
  const Allocator& a = Allocator());
317
  ```
318
 
319
  *Requires:* `pos <= str.size()`
@@ -336,11 +332,11 @@ Table  [[tab:strings.ctr.2]].
336
  ``` cpp
337
  basic_string(const charT* s, size_type n,
338
  const Allocator& a = Allocator());
339
  ```
340
 
341
- *Requires:* `s` shall not be a null pointer and `n < npos`.
342
 
343
  *Effects:* Constructs an object of class `basic_string` and determines
344
  its initial string value from the array of `charT` of length `n` whose
345
  first element is designated by `s`, as indicated in
346
  Table  [[tab:strings.ctr.3]].
@@ -355,11 +351,12 @@ Table  [[tab:strings.ctr.3]].
355
 
356
  ``` cpp
357
  basic_string(const charT* s, const Allocator& a = Allocator());
358
  ```
359
 
360
- *Requires:* `s` shall not be a null pointer.
 
361
 
362
  *Effects:* Constructs an object of class `basic_string` and determines
363
  its initial string value from the array of `charT` of length
364
  `traits::length(s)` whose first element is designated by `s`, as
365
  indicated in Table  [[tab:strings.ctr.4]].
@@ -435,68 +432,64 @@ unspecified value.
435
  | `capacity()` | a value at least as large as `size()` |
436
  | `get_allocator()` | `alloc` |
437
 
438
 
439
  *Throws:* The second form throws nothing if
440
- `alloc == str.get_allocator()` unless the copy constructor for
441
- `Allocator` throws.
442
 
443
  ``` cpp
444
- basic_string<charT,traits,Allocator>&
445
- operator=(const basic_string<charT,traits,Allocator>& str);
446
  ```
447
 
448
  *Effects:* If `*this` and `str` are not the same object, modifies
449
  `*this` as shown in Table  [[tab:strings.op=]].
450
 
451
  If `*this` and `str` are the same object, the member has no effect.
452
 
453
  *Returns:* `*this`
454
 
455
- **Table: `operator=(const basic_string<charT, traits, Allocator>&)` effects** <a id="tab:strings.op=">[tab:strings.op=]</a>
456
 
457
  | Element | Value |
458
  | ------------ | --------------------------------------------------------------------------------------------------------------- |
459
  | `data()` | points at the first element of an allocated copy of the array whose first element is pointed at by `str.data()` |
460
  | `size()` | `str.size()` |
461
  | `capacity()` | a value at least as large as `size()` |
462
 
463
  ``` cpp
464
- basic_string<charT,traits,Allocator>&
465
- operator=(basic_string<charT,traits,Allocator>&& str) noexcept;
466
  ```
467
 
468
  *Effects:* If `*this` and `str` are not the same object, modifies
469
  `*this` as shown in Table  [[tab:strings.op=rv]]. A valid implementation
470
  is `swap(str)`.
471
 
472
  If `*this` and `str` are the same object, the member has no effect.
473
 
474
  *Returns:* `*this`
475
 
476
- **Table: `operator=(const basic_string<charT, traits, Allocator>&&)` effects** <a id="tab:strings.op=rv">[tab:strings.op=rv]</a>
477
 
478
  | Element | Value |
479
  | ------------ | ---------------------------------------------------------------------- |
480
  | `data()` | points at the array whose first element was pointed at by `str.data()` |
481
  | `size()` | previous value of `str.size()` |
482
  | `capacity()` | a value at least as large as `size()` |
483
 
484
  ``` cpp
485
- basic_string<charT,traits,Allocator>&
486
- operator=(const charT* s);
487
  ```
488
 
489
- *Returns:* `*this = basic_string<charT,traits,Allocator>(s)`.
490
 
491
  *Remarks:* Uses `traits::length()`.
492
 
493
  ``` cpp
494
- basic_string<charT,traits,Allocator>& operator=(charT c);
495
  ```
496
 
497
- *Returns:* `*this = basic_string<charT,traits,Allocator>(1,c)`.
498
 
499
  ``` cpp
500
  basic_string& operator=(initializer_list<charT> il);
501
  ```
502
 
@@ -547,11 +540,11 @@ size_type size() const noexcept;
547
  ```
548
 
549
  *Returns:* A count of the number of char-like objects currently in the
550
  string.
551
 
552
- *Complexity:* constant time.
553
 
554
  ``` cpp
555
  size_type length() const noexcept;
556
  ```
557
 
@@ -561,11 +554,11 @@ size_type length() const noexcept;
561
  size_type max_size() const noexcept;
562
  ```
563
 
564
  *Returns:* The size of the largest possible string.
565
 
566
- *Complexity:* constant time.
567
 
568
  ``` cpp
569
  void resize(size_type n, charT c);
570
  ```
571
 
@@ -649,19 +642,17 @@ reference operator[](size_type pos);
649
  reference to an object of type `charT` with value `charT()`, where
650
  modifying the object leads to undefined behavior.
651
 
652
  *Throws:* Nothing.
653
 
654
- *Complexity:* constant time.
655
 
656
  ``` cpp
657
  const_reference at(size_type pos) const;
658
  reference at(size_type pos);
659
  ```
660
 
661
- *Requires:* `pos < size()`
662
-
663
  *Throws:* `out_of_range` if `pos >= size()`.
664
 
665
  *Returns:* `operator[](pos)`.
666
 
667
  ``` cpp
@@ -730,11 +721,11 @@ basic_string&
730
 
731
  *Returns:* `*this`.
732
 
733
  ``` cpp
734
  basic_string&
735
- append(const basic_string& str, size_type pos, size_type n);
736
  ```
737
 
738
  *Requires:* `pos <= str.size()`
739
 
740
  *Throws:* `out_of_range` if `pos > str.size()`.
@@ -798,11 +789,11 @@ basic_string& append(initializer_list<charT> il);
798
  *Effects:* Calls `append(il.begin(), il.size())`.
799
 
800
  *Returns:* `*this`.
801
 
802
  ``` cpp
803
- void push_back(charT c)
804
  ```
805
 
806
  *Effects:* Equivalent to `append(static_cast<size_type>(1), c)`.
807
 
808
  #### `basic_string::assign` <a id="string::assign">[[string::assign]]</a>
@@ -826,11 +817,11 @@ controlled by `str`. A valid implementation is `swap(str)`.
826
  *Returns:* `*this`.
827
 
828
  ``` cpp
829
  basic_string&
830
  assign(const basic_string& str, size_type pos,
831
- size_type n);
832
  ```
833
 
834
  *Requires:* `pos <= str.size()`
835
 
836
  *Throws:* `out_of_range` if `pos > str.size()`.
@@ -908,11 +899,11 @@ basic_string&
908
 
909
  ``` cpp
910
  basic_string&
911
  insert(size_type pos1,
912
  const basic_string& str,
913
- size_type pos2, size_type n);
914
  ```
915
 
916
  *Requires:* `pos1 <= size()` and `pos2 <= str.size()`
917
 
918
  *Throws:* `out_of_range` if `pos1 > size()` or `pos2 > str.size()`.
@@ -1012,12 +1003,11 @@ iterator insert(const_iterator p, initializer_list<charT> il);
1012
  character, or `p` if `i1` is empty.
1013
 
1014
  #### `basic_string::erase` <a id="string::erase">[[string::erase]]</a>
1015
 
1016
  ``` cpp
1017
- basic_string<charT,traits,Allocator>&
1018
- erase(size_type pos = 0, size_type n = npos);
1019
  ```
1020
 
1021
  *Requires:* `pos` ` <= size()`
1022
 
1023
  *Throws:* `out_of_range` if `pos` `> size()`.
@@ -1035,10 +1025,12 @@ string controlled by `*this` beginning at position `pos + xlen`.
1035
 
1036
  ``` cpp
1037
  iterator erase(const_iterator p);
1038
  ```
1039
 
 
 
1040
  *Effects:* removes the character referred to by `p`.
1041
 
1042
  *Returns:* An iterator which points to the element immediately following
1043
  `p` prior to the element being erased. If no such element exists,
1044
  `end()` is returned.
@@ -1048,10 +1040,12 @@ iterator erase(const_iterator first, const_iterator last);
1048
  ```
1049
 
1050
  *Requires:* `first` and `last` are valid iterators on `*this`, defining
1051
  a range `[first,last)`.
1052
 
 
 
1053
  *Effects:* removes the characters in the range `[first,last)`.
1054
 
1055
  *Returns:* An iterator which points to the element pointed to by `last`
1056
  prior to the other elements being erased. If no such element exists,
1057
  `end()` is returned.
@@ -1060,10 +1054,12 @@ prior to the other elements being erased. If no such element exists,
1060
  void pop_back();
1061
  ```
1062
 
1063
  *Requires:* `!empty()`
1064
 
 
 
1065
  *Effects:* Equivalent to `erase(size() - 1, 1)`.
1066
 
1067
  #### `basic_string::replace` <a id="string::replace">[[string::replace]]</a>
1068
 
1069
  ``` cpp
@@ -1082,11 +1078,11 @@ basic_string&
1082
 
1083
  ``` cpp
1084
  basic_string&
1085
  replace(size_type pos1, size_type n1,
1086
  const basic_string& str,
1087
- size_type pos2, size_type n2);
1088
  ```
1089
 
1090
  *Requires:* `pos1 <= size()` and `pos2 <= str.size()`.
1091
 
1092
  *Throws:* `out_of_range` if `pos1 > size()` or `pos2 > str.size()`.
@@ -1208,11 +1204,11 @@ basic_string& replace(const_iterator i1, const_iterator i2,
1208
  *Requires:* \[`begin()`, `i1`) and \[`i1`, `i2`) are valid ranges.
1209
 
1210
  *Effects:* Calls
1211
  `replace(i1 - begin(), i2 - i1, il.begin(), il.size())`.
1212
 
1213
- `*this`.
1214
 
1215
  #### `basic_string::copy` <a id="string::copy">[[string::copy]]</a>
1216
 
1217
  ``` cpp
1218
  size_type copy(charT* s, size_type n, size_type pos = 0) const;
@@ -1236,19 +1232,19 @@ The function does not append a null object to the string designated by
1236
  *Returns:* `rlen`.
1237
 
1238
  #### `basic_string::swap` <a id="string::swap">[[string::swap]]</a>
1239
 
1240
  ``` cpp
1241
- void swap(basic_string<charT,traits,Allocator>& s);
1242
  ```
1243
 
1244
  `*this` contains the same sequence of characters that was in `s`, `s`
1245
  contains the same sequence of characters that was in `*this`.
1246
 
1247
  *Throws:* Nothing.
1248
 
1249
- *Complexity:* constant time.
1250
 
1251
  ### `basic_string` string operations <a id="string.ops">[[string.ops]]</a>
1252
 
1253
  #### `basic_string` accessors <a id="string.accessors">[[string.accessors]]</a>
1254
 
@@ -1258,11 +1254,11 @@ const charT* data() const noexcept;
1258
  ```
1259
 
1260
  *Returns:* A pointer `p` such that `p + i == &operator[](i)` for each
1261
  `i` in \[`0`, `size()`\].
1262
 
1263
- *Complexity:* constant time.
1264
 
1265
  *Requires:* The program shall not alter any of the values stored in the
1266
  character array.
1267
 
1268
  ``` cpp
@@ -1294,26 +1290,26 @@ Otherwise, returns `npos`.
1294
 
1295
  ``` cpp
1296
  size_type find(const charT* s, size_type pos, size_type n) const;
1297
  ```
1298
 
1299
- *Returns:* `find(basic_string<charT,traits,Allocator>(s,n),pos)`.
1300
 
1301
  ``` cpp
1302
- size_type find(const charT* s, size_type pos = 0) const noexcept;
1303
  ```
1304
 
1305
  *Requires:* `s` points to an array of at least `traits::length(s) + 1`
1306
  elements of `charT`.
1307
 
1308
  *Returns:* `find(basic_string(s), pos)`.
1309
 
1310
  ``` cpp
1311
- size_type find(charT c, size_type pos = 0) const noexcept;
1312
  ```
1313
 
1314
- *Returns:* `find(basic_string<charT,traits,Allocator>(1,c), pos)`.
1315
 
1316
  #### `basic_string::rfind` <a id="string::rfind">[[string::rfind]]</a>
1317
 
1318
  ``` cpp
1319
  size_type rfind(const basic_string& str,
@@ -1346,14 +1342,14 @@ size_type rfind(const charT* s, size_type pos = npos) const;
1346
  elements of `charT`.
1347
 
1348
  *Returns:* `rfind(basic_string(s), pos)`.
1349
 
1350
  ``` cpp
1351
- size_type rfind(charT c, size_type pos = npos) const noexcept;
1352
  ```
1353
 
1354
- *Returns:* `rfind(basic_string<charT,traits,Allocator>(1,c),pos)`.
1355
 
1356
  #### `basic_string::find_first_of` <a id="string::find.first.of">[[string::find.first.of]]</a>
1357
 
1358
  ``` cpp
1359
  size_type
@@ -1388,15 +1384,14 @@ size_type find_first_of(const charT* s, size_type pos = 0) const;
1388
  elements of `charT`.
1389
 
1390
  *Returns:* `find_first_of(basic_string(s), pos)`.
1391
 
1392
  ``` cpp
1393
- size_type find_first_of(charT c, size_type pos = 0) const noexcept;
1394
  ```
1395
 
1396
- *Returns:*
1397
- `find_first_of(basic_string<charT,traits,Allocator>(1,c), pos)`.
1398
 
1399
  #### `basic_string::find_last_of` <a id="string::find.last.of">[[string::find.last.of]]</a>
1400
 
1401
  ``` cpp
1402
  size_type
@@ -1430,15 +1425,14 @@ size_type find_last_of(const charT* s, size_type pos = npos) const;
1430
  elements of `charT`.
1431
 
1432
  *Returns:* `find_last_of(basic_string(s), pos)`.
1433
 
1434
  ``` cpp
1435
- size_type find_last_of(charT c, size_type pos = npos) const noexcept;
1436
  ```
1437
 
1438
- *Returns:*
1439
- `find_last_of(basic_string<charT,traits,Allocator>(1,c),pos)`.
1440
 
1441
  #### `basic_string::find_first_not_of` <a id="string::find.first.not.of">[[string::find.first.not.of]]</a>
1442
 
1443
  ``` cpp
1444
  size_type
@@ -1473,11 +1467,11 @@ size_type find_first_not_of(const charT* s, size_type pos = 0) const;
1473
  elements of `charT`.
1474
 
1475
  *Returns:* `find_first_not_of(basic_string(s), pos)`.
1476
 
1477
  ``` cpp
1478
- size_type find_first_not_of(charT c, size_type pos = 0) const noexcept;
1479
  ```
1480
 
1481
  *Returns:* `find_first_not_of(basic_string(1, c), pos)`.
1482
 
1483
  #### `basic_string::find_last_not_of` <a id="string::find.last.not.of">[[string::find.last.not.of]]</a>
@@ -1515,30 +1509,29 @@ size_type find_last_not_of(const charT* s, size_type pos = npos) const;
1515
  elements of `charT`.
1516
 
1517
  *Returns:* `find_last_not_of(basic_string(s), pos)`.
1518
 
1519
  ``` cpp
1520
- size_type find_last_not_of(charT c, size_type pos = npos) const noexcept;
1521
  ```
1522
 
1523
  *Returns:* `find_last_not_of(basic_string(1, c), pos)`.
1524
 
1525
  #### `basic_string::substr` <a id="string::substr">[[string::substr]]</a>
1526
 
1527
  ``` cpp
1528
- basic_string<charT,traits,Allocator>
1529
- substr(size_type pos = 0, size_type n = npos) const;
1530
  ```
1531
 
1532
  *Requires:* `pos <= size()`
1533
 
1534
  *Throws:* `out_of_range` if `pos > size()`.
1535
 
1536
  *Effects:* Determines the effective length `rlen` of the string to copy
1537
  as the smaller of `n` and `size() - pos`.
1538
 
1539
- *Returns:* `basic_string<charT,traits,Allocator>(data()+pos,rlen)`.
1540
 
1541
  #### `basic_string::compare` <a id="string::compare">[[string::compare]]</a>
1542
 
1543
  ``` cpp
1544
  int compare(const basic_string& str) const noexcept;
@@ -1569,11 +1562,11 @@ int compare(size_type pos1, size_type n1,
1569
  *Returns:* `basic_string(*this,pos1,n1).compare(str)`.
1570
 
1571
  ``` cpp
1572
  int compare(size_type pos1, size_type n1,
1573
  const basic_string& str,
1574
- size_type pos2, size_type n2 ) const;
1575
  ```
1576
 
1577
  *Returns:*
1578
  `basic_string(*this, pos1, n1).compare(basic_string(str, pos2, n2))`.
1579
 
@@ -1729,19 +1722,19 @@ template<class charT, class traits, class Allocator>
1729
  *Returns:* `lhs.compare(rhs) == 0`.
1730
 
1731
  ``` cpp
1732
  template<class charT, class traits, class Allocator>
1733
  bool operator==(const charT* lhs,
1734
- const basic_string<charT,traits,Allocator>& rhs) noexcept;
1735
  ```
1736
 
1737
  *Returns:* `rhs == lhs`.
1738
 
1739
  ``` cpp
1740
  template<class charT, class traits, class Allocator>
1741
  bool operator==(const basic_string<charT,traits,Allocator>& lhs,
1742
- const charT* rhs) noexcept;
1743
  ```
1744
 
1745
  *Requires:* `rhs` points to an array of at least
1746
  `traits::length(rhs) + 1` elements of `charT`.
1747
 
@@ -1758,19 +1751,19 @@ template<class charT, class traits, class Allocator>
1758
  *Returns:* `!(lhs == rhs)`.
1759
 
1760
  ``` cpp
1761
  template<class charT, class traits, class Allocator>
1762
  bool operator!=(const charT* lhs,
1763
- const basic_string<charT,traits,Allocator>& rhs) noexcept;
1764
  ```
1765
 
1766
  *Returns:* `rhs != lhs`.
1767
 
1768
  ``` cpp
1769
  template<class charT, class traits, class Allocator>
1770
  bool operator!=(const basic_string<charT,traits,Allocator>& lhs,
1771
- const charT* rhs) noexcept;
1772
  ```
1773
 
1774
  *Requires:* `rhs` points to an array of at least
1775
  `traits::length(rhs) + 1` elements of `charT`.
1776
 
@@ -1787,19 +1780,19 @@ template<class charT, class traits, class Allocator>
1787
  *Returns:* `lhs.compare(rhs) < 0`.
1788
 
1789
  ``` cpp
1790
  template<class charT, class traits, class Allocator>
1791
  bool operator< (const charT* lhs,
1792
- const basic_string<charT,traits,Allocator>& rhs) noexcept;
1793
  ```
1794
 
1795
  *Returns:* `rhs.compare(lhs) > 0`.
1796
 
1797
  ``` cpp
1798
  template<class charT, class traits, class Allocator>
1799
  bool operator< (const basic_string<charT,traits,Allocator>& lhs,
1800
- const charT* rhs) noexcept;
1801
  ```
1802
 
1803
  *Returns:* `lhs.compare(rhs) < 0`.
1804
 
1805
  #### `operator>` <a id="string::op>">[[string::op>]]</a>
@@ -1813,19 +1806,19 @@ template<class charT, class traits, class Allocator>
1813
  *Returns:* `lhs.compare(rhs) > 0`.
1814
 
1815
  ``` cpp
1816
  template<class charT, class traits, class Allocator>
1817
  bool operator> (const charT* lhs,
1818
- const basic_string<charT,traits,Allocator>& rhs) noexcept;
1819
  ```
1820
 
1821
  *Returns:* `rhs.compare(lhs) < 0`.
1822
 
1823
  ``` cpp
1824
  template<class charT, class traits, class Allocator>
1825
  bool operator> (const basic_string<charT,traits,Allocator>& lhs,
1826
- const charT* rhs) noexcept;
1827
  ```
1828
 
1829
  *Returns:* `lhs.compare(rhs) > 0`.
1830
 
1831
  #### `operator<=` <a id="string::op<=">[[string::op<=]]</a>
@@ -1839,19 +1832,19 @@ template<class charT, class traits, class Allocator>
1839
  *Returns:* `lhs.compare(rhs) <= 0`.
1840
 
1841
  ``` cpp
1842
  template<class charT, class traits, class Allocator>
1843
  bool operator<=(const charT* lhs,
1844
- const basic_string<charT,traits,Allocator>& rhs) noexcept;
1845
  ```
1846
 
1847
  *Returns:* `rhs.compare(lhs) >= 0`.
1848
 
1849
  ``` cpp
1850
  template<class charT, class traits, class Allocator>
1851
  bool operator<=(const basic_string<charT,traits,Allocator>& lhs,
1852
- const charT* rhs) noexcept;
1853
  ```
1854
 
1855
  *Returns:* `lhs.compare(rhs) <= 0`.
1856
 
1857
  #### `operator>=` <a id="string::op>=">[[string::op>=]]</a>
@@ -1865,32 +1858,32 @@ template<class charT, class traits, class Allocator>
1865
  *Returns:* `lhs.compare(rhs) >= 0`.
1866
 
1867
  ``` cpp
1868
  template<class charT, class traits, class Allocator>
1869
  bool operator>=(const charT* lhs,
1870
- const basic_string<charT,traits,Allocator>& rhs) noexcept;
1871
  ```
1872
 
1873
  *Returns:* `rhs.compare(lhs) <= 0`.
1874
 
1875
  ``` cpp
1876
  template<class charT, class traits, class Allocator>
1877
  bool operator>=(const basic_string<charT,traits,Allocator>& lhs,
1878
- const charT* rhs) noexcept;
1879
  ```
1880
 
1881
  *Returns:* `lhs.compare(rhs) >= 0`.
1882
 
1883
  #### `swap` <a id="string.special">[[string.special]]</a>
1884
 
1885
  ``` cpp
1886
  template<class charT, class traits, class Allocator>
1887
  void swap(basic_string<charT,traits,Allocator>& lhs,
1888
- basic_string<charT,traits,Allocator>& rhs) noexcept;
1889
  ```
1890
 
1891
- *Effects:* `lhs.swap(rhs);`
1892
 
1893
  #### Inserters and extractors <a id="string.io">[[string.io]]</a>
1894
 
1895
  ``` cpp
1896
  template<class charT, class traits, class Allocator>
@@ -1928,16 +1921,16 @@ template<class charT, class traits, class Allocator>
1928
  operator<<(basic_ostream<charT, traits>& os,
1929
  const basic_string<charT,traits,Allocator>& str);
1930
  ```
1931
 
1932
  *Effects:* Behaves as a formatted output
1933
- function ([[ostream.formatted.reqmts]]). After constructing a `sentry`
1934
- object, if this object returns `true` when converted to a value of type
1935
- `bool`, determines padding as described in  [[facet.num.put.virtuals]],
1936
- then inserts the resulting sequence of characters `seq` as if by calling
1937
- `os.rdbuf()->sputn(seq, n)`, where `n` is the larger of `os.width()` and
1938
- `str.size()`; then calls `os.width(0)`.
1939
 
1940
  *Returns:* `os`
1941
 
1942
  ``` cpp
1943
  template<class charT, class traits, class Allocator>
 
48
  typedef std::reverse_iterator<iterator> reverse_iterator;
49
  typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
50
  static const size_type npos = -1;
51
 
52
  // [string.cons], construct/copy/destroy:
53
+ basic_string() : basic_string(Allocator()) { }
54
+ explicit basic_string(const Allocator& a);
55
  basic_string(const basic_string& str);
56
  basic_string(basic_string&& str) noexcept;
57
  basic_string(const basic_string& str, size_type pos, size_type n = npos,
58
  const Allocator& a = Allocator());
59
  basic_string(const charT* s,
 
118
  basic_string& operator+=(const charT* s);
119
  basic_string& operator+=(charT c);
120
  basic_string& operator+=(initializer_list<charT>);
121
  basic_string& append(const basic_string& str);
122
  basic_string& append(const basic_string& str, size_type pos,
123
+ size_type n = npos);
124
  basic_string& append(const charT* s, size_type n);
125
  basic_string& append(const charT* s);
126
  basic_string& append(size_type n, charT c);
127
  template<class InputIterator>
128
  basic_string& append(InputIterator first, InputIterator last);
 
130
  void push_back(charT c);
131
 
132
  basic_string& assign(const basic_string& str);
133
  basic_string& assign(basic_string&& str) noexcept;
134
  basic_string& assign(const basic_string& str, size_type pos,
135
+ size_type n = npos);
136
  basic_string& assign(const charT* s, size_type n);
137
  basic_string& assign(const charT* s);
138
  basic_string& assign(size_type n, charT c);
139
  template<class InputIterator>
140
  basic_string& assign(InputIterator first, InputIterator last);
141
  basic_string& assign(initializer_list<charT>);
142
 
143
  basic_string& insert(size_type pos1, const basic_string& str);
144
  basic_string& insert(size_type pos1, const basic_string& str,
145
+ size_type pos2, size_type n = npos);
146
  basic_string& insert(size_type pos, const charT* s, size_type n);
147
  basic_string& insert(size_type pos, const charT* s);
148
  basic_string& insert(size_type pos, size_type n, charT c);
149
  iterator insert(const_iterator p, charT c);
150
  iterator insert(const_iterator p, size_type n, charT c);
 
160
 
161
  basic_string& replace(size_type pos1, size_type n1,
162
  const basic_string& str);
163
  basic_string& replace(size_type pos1, size_type n1,
164
  const basic_string& str,
165
+ size_type pos2, size_type n2 = npos);
166
  basic_string& replace(size_type pos, size_type n1, const charT* s,
167
  size_type n2);
168
  basic_string& replace(size_type pos, size_type n1, const charT* s);
169
  basic_string& replace(size_type pos, size_type n1, size_type n2,
170
  charT c);
 
190
  allocator_type get_allocator() const noexcept;
191
 
192
  size_type find (const basic_string& str, size_type pos = 0) const noexcept;
193
  size_type find (const charT* s, size_type pos, size_type n) const;
194
  size_type find (const charT* s, size_type pos = 0) const;
195
+ size_type find (charT c, size_type pos = 0) const;
196
  size_type rfind(const basic_string& str, size_type pos = npos) const noexcept;
197
  size_type rfind(const charT* s, size_type pos, size_type n) const;
198
  size_type rfind(const charT* s, size_type pos = npos) const;
199
+ size_type rfind(charT c, size_type pos = npos) const;
200
 
201
  size_type find_first_of(const basic_string& str,
202
  size_type pos = 0) const noexcept;
203
  size_type find_first_of(const charT* s,
204
  size_type pos, size_type n) const;
205
  size_type find_first_of(const charT* s, size_type pos = 0) const;
206
+ size_type find_first_of(charT c, size_type pos = 0) const;
207
  size_type find_last_of (const basic_string& str,
208
  size_type pos = npos) const noexcept;
209
  size_type find_last_of (const charT* s,
210
  size_type pos, size_type n) const;
211
  size_type find_last_of (const charT* s, size_type pos = npos) const;
212
+ size_type find_last_of (charT c, size_type pos = npos) const;
213
 
214
  size_type find_first_not_of(const basic_string& str,
215
  size_type pos = 0) const noexcept;
216
  size_type find_first_not_of(const charT* s, size_type pos,
217
  size_type n) const;
218
  size_type find_first_not_of(const charT* s, size_type pos = 0) const;
219
+ size_type find_first_not_of(charT c, size_type pos = 0) const;
220
  size_type find_last_not_of (const basic_string& str,
221
  size_type pos = npos) const noexcept;
222
  size_type find_last_not_of (const charT* s, size_type pos,
223
  size_type n) const;
224
  size_type find_last_not_of (const charT* s,
225
  size_type pos = npos) const;
226
+ size_type find_last_not_of (charT c, size_type pos = npos) const;
227
 
228
  basic_string substr(size_type pos = 0, size_type n = npos) const;
229
  int compare(const basic_string& str) const noexcept;
230
  int compare(size_type pos1, size_type n1,
231
  const basic_string& str) const;
232
  int compare(size_type pos1, size_type n1,
233
  const basic_string& str,
234
+ size_type pos2, size_type n2 = npos) const;
235
  int compare(const charT* s) const;
236
  int compare(size_type pos1, size_type n1,
237
  const charT* s) const;
238
  int compare(size_type pos1, size_type n1,
239
  const charT* s, size_type n2) const;
 
247
  operation shall throw an exception object of type `length_error`.
248
 
249
  If any member function or operator of `basic_string` throws an
250
  exception, that function or operator shall have no other effect.
251
 
 
 
252
  In every specialization `basic_string<charT, traits, Allocator>`, the
253
  type `allocator_traits<Allocator>::value_type` shall name the same type
254
  as `charT`. Every object of type
255
  `basic_string<charT, traits, Allocator>` shall use an object of type
256
  `Allocator` to allocate and free storage for the contained `charT`
 
272
  `front`, `back`, `begin`, `rbegin`, `end`, and `rend`.
273
 
274
  ### `basic_string` constructors and assignment operators <a id="string.cons">[[string.cons]]</a>
275
 
276
  ``` cpp
277
+ explicit basic_string(const Allocator& a);
278
  ```
279
 
280
  *Effects:* Constructs an object of class `basic_string`. The
281
  postconditions of this function are indicated in
282
  Table  [[tab:strings.ctr.1]].
 
288
  | `data()` | a non-null pointer that is copyable and can have 0 added to it |
289
  | `size()` | 0 |
290
  | `capacity()` | an unspecified value |
291
 
292
  ``` cpp
293
+ basic_string(const basic_string& str);
294
+ basic_string(basic_string&& str) noexcept;
295
  ```
296
 
297
  *Effects:* Constructs an object of class `basic_string` as indicated in
298
  Table  [[tab:strings.ctr.cpy]]. In the second form, `str` is left in a
299
  valid state with an unspecified value.
300
 
 
 
 
301
  **Table: `basic_string(const basic_string&)` effects** <a id="tab:strings.ctr.cpy">[tab:strings.ctr.cpy]</a>
302
 
303
  | Element | Value |
304
  | ------------ | --------------------------------------------------------------------------------------------------------------- |
305
  | `data()` | points at the first element of an allocated copy of the array whose first element is pointed at by `str.data()` |
306
  | `size()` | `str.size()` |
307
  | `capacity()` | a value at least as large as `size()` |
308
 
309
  ``` cpp
310
+ basic_string(const basic_string& str,
311
  size_type pos, size_type n = npos,
312
  const Allocator& a = Allocator());
313
  ```
314
 
315
  *Requires:* `pos <= str.size()`
 
332
  ``` cpp
333
  basic_string(const charT* s, size_type n,
334
  const Allocator& a = Allocator());
335
  ```
336
 
337
+ *Requires:* `s` points to an array of at least `n` elements of `charT`.
338
 
339
  *Effects:* Constructs an object of class `basic_string` and determines
340
  its initial string value from the array of `charT` of length `n` whose
341
  first element is designated by `s`, as indicated in
342
  Table  [[tab:strings.ctr.3]].
 
351
 
352
  ``` cpp
353
  basic_string(const charT* s, const Allocator& a = Allocator());
354
  ```
355
 
356
+ *Requires:* `s` points to an array of at least `traits::length(s) + 1`
357
+ elements of `charT`.
358
 
359
  *Effects:* Constructs an object of class `basic_string` and determines
360
  its initial string value from the array of `charT` of length
361
  `traits::length(s)` whose first element is designated by `s`, as
362
  indicated in Table  [[tab:strings.ctr.4]].
 
432
  | `capacity()` | a value at least as large as `size()` |
433
  | `get_allocator()` | `alloc` |
434
 
435
 
436
  *Throws:* The second form throws nothing if
437
+ `alloc == str.get_allocator()`.
 
438
 
439
  ``` cpp
440
+ basic_string& operator=(const basic_string& str);
 
441
  ```
442
 
443
  *Effects:* If `*this` and `str` are not the same object, modifies
444
  `*this` as shown in Table  [[tab:strings.op=]].
445
 
446
  If `*this` and `str` are the same object, the member has no effect.
447
 
448
  *Returns:* `*this`
449
 
450
+ **Table: `operator=(const basic_string&)` effects** <a id="tab:strings.op=">[tab:strings.op=]</a>
451
 
452
  | Element | Value |
453
  | ------------ | --------------------------------------------------------------------------------------------------------------- |
454
  | `data()` | points at the first element of an allocated copy of the array whose first element is pointed at by `str.data()` |
455
  | `size()` | `str.size()` |
456
  | `capacity()` | a value at least as large as `size()` |
457
 
458
  ``` cpp
459
+ basic_string& operator=(basic_string&& str) noexcept;
 
460
  ```
461
 
462
  *Effects:* If `*this` and `str` are not the same object, modifies
463
  `*this` as shown in Table  [[tab:strings.op=rv]]. A valid implementation
464
  is `swap(str)`.
465
 
466
  If `*this` and `str` are the same object, the member has no effect.
467
 
468
  *Returns:* `*this`
469
 
470
+ **Table: `operator=(basic_string&&)` effects** <a id="tab:strings.op=rv">[tab:strings.op=rv]</a>
471
 
472
  | Element | Value |
473
  | ------------ | ---------------------------------------------------------------------- |
474
  | `data()` | points at the array whose first element was pointed at by `str.data()` |
475
  | `size()` | previous value of `str.size()` |
476
  | `capacity()` | a value at least as large as `size()` |
477
 
478
  ``` cpp
479
+ basic_string& operator=(const charT* s);
 
480
  ```
481
 
482
+ *Returns:* `*this = basic_string(s)`.
483
 
484
  *Remarks:* Uses `traits::length()`.
485
 
486
  ``` cpp
487
+ basic_string& operator=(charT c);
488
  ```
489
 
490
+ *Returns:* `*this = basic_string(1,c)`.
491
 
492
  ``` cpp
493
  basic_string& operator=(initializer_list<charT> il);
494
  ```
495
 
 
540
  ```
541
 
542
  *Returns:* A count of the number of char-like objects currently in the
543
  string.
544
 
545
+ *Complexity:* Constant time.
546
 
547
  ``` cpp
548
  size_type length() const noexcept;
549
  ```
550
 
 
554
  size_type max_size() const noexcept;
555
  ```
556
 
557
  *Returns:* The size of the largest possible string.
558
 
559
+ *Complexity:* Constant time.
560
 
561
  ``` cpp
562
  void resize(size_type n, charT c);
563
  ```
564
 
 
642
  reference to an object of type `charT` with value `charT()`, where
643
  modifying the object leads to undefined behavior.
644
 
645
  *Throws:* Nothing.
646
 
647
+ *Complexity:* Constant time.
648
 
649
  ``` cpp
650
  const_reference at(size_type pos) const;
651
  reference at(size_type pos);
652
  ```
653
 
 
 
654
  *Throws:* `out_of_range` if `pos >= size()`.
655
 
656
  *Returns:* `operator[](pos)`.
657
 
658
  ``` cpp
 
721
 
722
  *Returns:* `*this`.
723
 
724
  ``` cpp
725
  basic_string&
726
+ append(const basic_string& str, size_type pos, size_type n = npos);
727
  ```
728
 
729
  *Requires:* `pos <= str.size()`
730
 
731
  *Throws:* `out_of_range` if `pos > str.size()`.
 
789
  *Effects:* Calls `append(il.begin(), il.size())`.
790
 
791
  *Returns:* `*this`.
792
 
793
  ``` cpp
794
+ void push_back(charT c);
795
  ```
796
 
797
  *Effects:* Equivalent to `append(static_cast<size_type>(1), c)`.
798
 
799
  #### `basic_string::assign` <a id="string::assign">[[string::assign]]</a>
 
817
  *Returns:* `*this`.
818
 
819
  ``` cpp
820
  basic_string&
821
  assign(const basic_string& str, size_type pos,
822
+ size_type n = npos);
823
  ```
824
 
825
  *Requires:* `pos <= str.size()`
826
 
827
  *Throws:* `out_of_range` if `pos > str.size()`.
 
899
 
900
  ``` cpp
901
  basic_string&
902
  insert(size_type pos1,
903
  const basic_string& str,
904
+ size_type pos2, size_type n = npos);
905
  ```
906
 
907
  *Requires:* `pos1 <= size()` and `pos2 <= str.size()`
908
 
909
  *Throws:* `out_of_range` if `pos1 > size()` or `pos2 > str.size()`.
 
1003
  character, or `p` if `i1` is empty.
1004
 
1005
  #### `basic_string::erase` <a id="string::erase">[[string::erase]]</a>
1006
 
1007
  ``` cpp
1008
+ basic_string& erase(size_type pos = 0, size_type n = npos);
 
1009
  ```
1010
 
1011
  *Requires:* `pos` ` <= size()`
1012
 
1013
  *Throws:* `out_of_range` if `pos` `> size()`.
 
1025
 
1026
  ``` cpp
1027
  iterator erase(const_iterator p);
1028
  ```
1029
 
1030
+ *Throws:* Nothing.
1031
+
1032
  *Effects:* removes the character referred to by `p`.
1033
 
1034
  *Returns:* An iterator which points to the element immediately following
1035
  `p` prior to the element being erased. If no such element exists,
1036
  `end()` is returned.
 
1040
  ```
1041
 
1042
  *Requires:* `first` and `last` are valid iterators on `*this`, defining
1043
  a range `[first,last)`.
1044
 
1045
+ *Throws:* Nothing.
1046
+
1047
  *Effects:* removes the characters in the range `[first,last)`.
1048
 
1049
  *Returns:* An iterator which points to the element pointed to by `last`
1050
  prior to the other elements being erased. If no such element exists,
1051
  `end()` is returned.
 
1054
  void pop_back();
1055
  ```
1056
 
1057
  *Requires:* `!empty()`
1058
 
1059
+ *Throws:* Nothing.
1060
+
1061
  *Effects:* Equivalent to `erase(size() - 1, 1)`.
1062
 
1063
  #### `basic_string::replace` <a id="string::replace">[[string::replace]]</a>
1064
 
1065
  ``` cpp
 
1078
 
1079
  ``` cpp
1080
  basic_string&
1081
  replace(size_type pos1, size_type n1,
1082
  const basic_string& str,
1083
+ size_type pos2, size_type n2 = npos);
1084
  ```
1085
 
1086
  *Requires:* `pos1 <= size()` and `pos2 <= str.size()`.
1087
 
1088
  *Throws:* `out_of_range` if `pos1 > size()` or `pos2 > str.size()`.
 
1204
  *Requires:* \[`begin()`, `i1`) and \[`i1`, `i2`) are valid ranges.
1205
 
1206
  *Effects:* Calls
1207
  `replace(i1 - begin(), i2 - i1, il.begin(), il.size())`.
1208
 
1209
+ *Returns:* `*this`.
1210
 
1211
  #### `basic_string::copy` <a id="string::copy">[[string::copy]]</a>
1212
 
1213
  ``` cpp
1214
  size_type copy(charT* s, size_type n, size_type pos = 0) const;
 
1232
  *Returns:* `rlen`.
1233
 
1234
  #### `basic_string::swap` <a id="string::swap">[[string::swap]]</a>
1235
 
1236
  ``` cpp
1237
+ void swap(basic_string& s);
1238
  ```
1239
 
1240
  `*this` contains the same sequence of characters that was in `s`, `s`
1241
  contains the same sequence of characters that was in `*this`.
1242
 
1243
  *Throws:* Nothing.
1244
 
1245
+ *Complexity:* Constant time.
1246
 
1247
  ### `basic_string` string operations <a id="string.ops">[[string.ops]]</a>
1248
 
1249
  #### `basic_string` accessors <a id="string.accessors">[[string.accessors]]</a>
1250
 
 
1254
  ```
1255
 
1256
  *Returns:* A pointer `p` such that `p + i == &operator[](i)` for each
1257
  `i` in \[`0`, `size()`\].
1258
 
1259
+ *Complexity:* Constant time.
1260
 
1261
  *Requires:* The program shall not alter any of the values stored in the
1262
  character array.
1263
 
1264
  ``` cpp
 
1290
 
1291
  ``` cpp
1292
  size_type find(const charT* s, size_type pos, size_type n) const;
1293
  ```
1294
 
1295
+ *Returns:* `find(basic_string(s,n),pos)`.
1296
 
1297
  ``` cpp
1298
+ size_type find(const charT* s, size_type pos = 0) const;
1299
  ```
1300
 
1301
  *Requires:* `s` points to an array of at least `traits::length(s) + 1`
1302
  elements of `charT`.
1303
 
1304
  *Returns:* `find(basic_string(s), pos)`.
1305
 
1306
  ``` cpp
1307
+ size_type find(charT c, size_type pos = 0) const;
1308
  ```
1309
 
1310
+ *Returns:* `find(basic_string(1,c), pos)`.
1311
 
1312
  #### `basic_string::rfind` <a id="string::rfind">[[string::rfind]]</a>
1313
 
1314
  ``` cpp
1315
  size_type rfind(const basic_string& str,
 
1342
  elements of `charT`.
1343
 
1344
  *Returns:* `rfind(basic_string(s), pos)`.
1345
 
1346
  ``` cpp
1347
+ size_type rfind(charT c, size_type pos = npos) const;
1348
  ```
1349
 
1350
+ *Returns:* `rfind(basic_string(1,c),pos)`.
1351
 
1352
  #### `basic_string::find_first_of` <a id="string::find.first.of">[[string::find.first.of]]</a>
1353
 
1354
  ``` cpp
1355
  size_type
 
1384
  elements of `charT`.
1385
 
1386
  *Returns:* `find_first_of(basic_string(s), pos)`.
1387
 
1388
  ``` cpp
1389
+ size_type find_first_of(charT c, size_type pos = 0) const;
1390
  ```
1391
 
1392
+ *Returns:* `find_first_of(basic_string(1,c), pos)`.
 
1393
 
1394
  #### `basic_string::find_last_of` <a id="string::find.last.of">[[string::find.last.of]]</a>
1395
 
1396
  ``` cpp
1397
  size_type
 
1425
  elements of `charT`.
1426
 
1427
  *Returns:* `find_last_of(basic_string(s), pos)`.
1428
 
1429
  ``` cpp
1430
+ size_type find_last_of(charT c, size_type pos = npos) const;
1431
  ```
1432
 
1433
+ *Returns:* `find_last_of(basic_string(1,c),pos)`.
 
1434
 
1435
  #### `basic_string::find_first_not_of` <a id="string::find.first.not.of">[[string::find.first.not.of]]</a>
1436
 
1437
  ``` cpp
1438
  size_type
 
1467
  elements of `charT`.
1468
 
1469
  *Returns:* `find_first_not_of(basic_string(s), pos)`.
1470
 
1471
  ``` cpp
1472
+ size_type find_first_not_of(charT c, size_type pos = 0) const;
1473
  ```
1474
 
1475
  *Returns:* `find_first_not_of(basic_string(1, c), pos)`.
1476
 
1477
  #### `basic_string::find_last_not_of` <a id="string::find.last.not.of">[[string::find.last.not.of]]</a>
 
1509
  elements of `charT`.
1510
 
1511
  *Returns:* `find_last_not_of(basic_string(s), pos)`.
1512
 
1513
  ``` cpp
1514
+ size_type find_last_not_of(charT c, size_type pos = npos) const;
1515
  ```
1516
 
1517
  *Returns:* `find_last_not_of(basic_string(1, c), pos)`.
1518
 
1519
  #### `basic_string::substr` <a id="string::substr">[[string::substr]]</a>
1520
 
1521
  ``` cpp
1522
+ basic_string substr(size_type pos = 0, size_type n = npos) const;
 
1523
  ```
1524
 
1525
  *Requires:* `pos <= size()`
1526
 
1527
  *Throws:* `out_of_range` if `pos > size()`.
1528
 
1529
  *Effects:* Determines the effective length `rlen` of the string to copy
1530
  as the smaller of `n` and `size() - pos`.
1531
 
1532
+ *Returns:* `basic_string(data()+pos,rlen)`.
1533
 
1534
  #### `basic_string::compare` <a id="string::compare">[[string::compare]]</a>
1535
 
1536
  ``` cpp
1537
  int compare(const basic_string& str) const noexcept;
 
1562
  *Returns:* `basic_string(*this,pos1,n1).compare(str)`.
1563
 
1564
  ``` cpp
1565
  int compare(size_type pos1, size_type n1,
1566
  const basic_string& str,
1567
+ size_type pos2, size_type n2 = npos) const;
1568
  ```
1569
 
1570
  *Returns:*
1571
  `basic_string(*this, pos1, n1).compare(basic_string(str, pos2, n2))`.
1572
 
 
1722
  *Returns:* `lhs.compare(rhs) == 0`.
1723
 
1724
  ``` cpp
1725
  template<class charT, class traits, class Allocator>
1726
  bool operator==(const charT* lhs,
1727
+ const basic_string<charT,traits,Allocator>& rhs);
1728
  ```
1729
 
1730
  *Returns:* `rhs == lhs`.
1731
 
1732
  ``` cpp
1733
  template<class charT, class traits, class Allocator>
1734
  bool operator==(const basic_string<charT,traits,Allocator>& lhs,
1735
+ const charT* rhs);
1736
  ```
1737
 
1738
  *Requires:* `rhs` points to an array of at least
1739
  `traits::length(rhs) + 1` elements of `charT`.
1740
 
 
1751
  *Returns:* `!(lhs == rhs)`.
1752
 
1753
  ``` cpp
1754
  template<class charT, class traits, class Allocator>
1755
  bool operator!=(const charT* lhs,
1756
+ const basic_string<charT,traits,Allocator>& rhs);
1757
  ```
1758
 
1759
  *Returns:* `rhs != lhs`.
1760
 
1761
  ``` cpp
1762
  template<class charT, class traits, class Allocator>
1763
  bool operator!=(const basic_string<charT,traits,Allocator>& lhs,
1764
+ const charT* rhs);
1765
  ```
1766
 
1767
  *Requires:* `rhs` points to an array of at least
1768
  `traits::length(rhs) + 1` elements of `charT`.
1769
 
 
1780
  *Returns:* `lhs.compare(rhs) < 0`.
1781
 
1782
  ``` cpp
1783
  template<class charT, class traits, class Allocator>
1784
  bool operator< (const charT* lhs,
1785
+ const basic_string<charT,traits,Allocator>& rhs);
1786
  ```
1787
 
1788
  *Returns:* `rhs.compare(lhs) > 0`.
1789
 
1790
  ``` cpp
1791
  template<class charT, class traits, class Allocator>
1792
  bool operator< (const basic_string<charT,traits,Allocator>& lhs,
1793
+ const charT* rhs);
1794
  ```
1795
 
1796
  *Returns:* `lhs.compare(rhs) < 0`.
1797
 
1798
  #### `operator>` <a id="string::op>">[[string::op>]]</a>
 
1806
  *Returns:* `lhs.compare(rhs) > 0`.
1807
 
1808
  ``` cpp
1809
  template<class charT, class traits, class Allocator>
1810
  bool operator> (const charT* lhs,
1811
+ const basic_string<charT,traits,Allocator>& rhs);
1812
  ```
1813
 
1814
  *Returns:* `rhs.compare(lhs) < 0`.
1815
 
1816
  ``` cpp
1817
  template<class charT, class traits, class Allocator>
1818
  bool operator> (const basic_string<charT,traits,Allocator>& lhs,
1819
+ const charT* rhs);
1820
  ```
1821
 
1822
  *Returns:* `lhs.compare(rhs) > 0`.
1823
 
1824
  #### `operator<=` <a id="string::op<=">[[string::op<=]]</a>
 
1832
  *Returns:* `lhs.compare(rhs) <= 0`.
1833
 
1834
  ``` cpp
1835
  template<class charT, class traits, class Allocator>
1836
  bool operator<=(const charT* lhs,
1837
+ const basic_string<charT,traits,Allocator>& rhs);
1838
  ```
1839
 
1840
  *Returns:* `rhs.compare(lhs) >= 0`.
1841
 
1842
  ``` cpp
1843
  template<class charT, class traits, class Allocator>
1844
  bool operator<=(const basic_string<charT,traits,Allocator>& lhs,
1845
+ const charT* rhs);
1846
  ```
1847
 
1848
  *Returns:* `lhs.compare(rhs) <= 0`.
1849
 
1850
  #### `operator>=` <a id="string::op>=">[[string::op>=]]</a>
 
1858
  *Returns:* `lhs.compare(rhs) >= 0`.
1859
 
1860
  ``` cpp
1861
  template<class charT, class traits, class Allocator>
1862
  bool operator>=(const charT* lhs,
1863
+ const basic_string<charT,traits,Allocator>& rhs);
1864
  ```
1865
 
1866
  *Returns:* `rhs.compare(lhs) <= 0`.
1867
 
1868
  ``` cpp
1869
  template<class charT, class traits, class Allocator>
1870
  bool operator>=(const basic_string<charT,traits,Allocator>& lhs,
1871
+ const charT* rhs);
1872
  ```
1873
 
1874
  *Returns:* `lhs.compare(rhs) >= 0`.
1875
 
1876
  #### `swap` <a id="string.special">[[string.special]]</a>
1877
 
1878
  ``` cpp
1879
  template<class charT, class traits, class Allocator>
1880
  void swap(basic_string<charT,traits,Allocator>& lhs,
1881
+ basic_string<charT,traits,Allocator>& rhs);
1882
  ```
1883
 
1884
+ *Effects:* Equivalent to `lhs.swap(rhs);`
1885
 
1886
  #### Inserters and extractors <a id="string.io">[[string.io]]</a>
1887
 
1888
  ``` cpp
1889
  template<class charT, class traits, class Allocator>
 
1921
  operator<<(basic_ostream<charT, traits>& os,
1922
  const basic_string<charT,traits,Allocator>& str);
1923
  ```
1924
 
1925
  *Effects:* Behaves as a formatted output
1926
+ function ([[ostream.formatted.reqmts]]) of `os`. Forms a character
1927
+ sequence `seq`, initially consisting of the elements defined by the
1928
+ range \[`str.begin(), str.end()`). Determines padding for `seq` as
1929
+ described in  [[ostream.formatted.reqmts]]. Then inserts `seq` as if by
1930
+ calling `os.rdbuf()->sputn(seq, n)`, where `n` is the larger of
1931
+ `os.width()` and `str.size()`; then calls `os.width(0)`.
1932
 
1933
  *Returns:* `os`
1934
 
1935
  ``` cpp
1936
  template<class charT, class traits, class Allocator>