tmp/tmpt_wrgs59/{from.md → to.md}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
| 1 |
### `basic_string` constructors and assignment operators <a id="string.cons">[[string.cons]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
-
explicit basic_string(const Allocator& a
|
| 5 |
```
|
| 6 |
|
| 7 |
*Effects:* Constructs an object of class `basic_string`. The
|
| 8 |
postconditions of this function are indicated in
|
| 9 |
Table [[tab:strings.ctr.1]].
|
|
@@ -15,31 +15,28 @@ Table [[tab:strings.ctr.1]].
|
|
| 15 |
| `data()` | a non-null pointer that is copyable and can have 0 added to it |
|
| 16 |
| `size()` | 0 |
|
| 17 |
| `capacity()` | an unspecified value |
|
| 18 |
|
| 19 |
``` cpp
|
| 20 |
-
basic_string(const basic_string
|
| 21 |
-
basic_string(basic_string
|
| 22 |
```
|
| 23 |
|
| 24 |
*Effects:* Constructs an object of class `basic_string` as indicated in
|
| 25 |
Table [[tab:strings.ctr.cpy]]. In the second form, `str` is left in a
|
| 26 |
valid state with an unspecified value.
|
| 27 |
|
| 28 |
-
*Throws:* The second form throws nothing if the allocator’s move
|
| 29 |
-
constructor throws nothing.
|
| 30 |
-
|
| 31 |
**Table: `basic_string(const basic_string&)` effects** <a id="tab:strings.ctr.cpy">[tab:strings.ctr.cpy]</a>
|
| 32 |
|
| 33 |
| Element | Value |
|
| 34 |
| ------------ | --------------------------------------------------------------------------------------------------------------- |
|
| 35 |
| `data()` | points at the first element of an allocated copy of the array whose first element is pointed at by `str.data()` |
|
| 36 |
| `size()` | `str.size()` |
|
| 37 |
| `capacity()` | a value at least as large as `size()` |
|
| 38 |
|
| 39 |
``` cpp
|
| 40 |
-
basic_string(const basic_string
|
| 41 |
size_type pos, size_type n = npos,
|
| 42 |
const Allocator& a = Allocator());
|
| 43 |
```
|
| 44 |
|
| 45 |
*Requires:* `pos <= str.size()`
|
|
@@ -62,11 +59,11 @@ Table [[tab:strings.ctr.2]].
|
|
| 62 |
``` cpp
|
| 63 |
basic_string(const charT* s, size_type n,
|
| 64 |
const Allocator& a = Allocator());
|
| 65 |
```
|
| 66 |
|
| 67 |
-
*Requires:* `s`
|
| 68 |
|
| 69 |
*Effects:* Constructs an object of class `basic_string` and determines
|
| 70 |
its initial string value from the array of `charT` of length `n` whose
|
| 71 |
first element is designated by `s`, as indicated in
|
| 72 |
Table [[tab:strings.ctr.3]].
|
|
@@ -81,11 +78,12 @@ Table [[tab:strings.ctr.3]].
|
|
| 81 |
|
| 82 |
``` cpp
|
| 83 |
basic_string(const charT* s, const Allocator& a = Allocator());
|
| 84 |
```
|
| 85 |
|
| 86 |
-
*Requires:* `s`
|
|
|
|
| 87 |
|
| 88 |
*Effects:* Constructs an object of class `basic_string` and determines
|
| 89 |
its initial string value from the array of `charT` of length
|
| 90 |
`traits::length(s)` whose first element is designated by `s`, as
|
| 91 |
indicated in Table [[tab:strings.ctr.4]].
|
|
@@ -161,68 +159,64 @@ unspecified value.
|
|
| 161 |
| `capacity()` | a value at least as large as `size()` |
|
| 162 |
| `get_allocator()` | `alloc` |
|
| 163 |
|
| 164 |
|
| 165 |
*Throws:* The second form throws nothing if
|
| 166 |
-
`alloc == str.get_allocator()`
|
| 167 |
-
`Allocator` throws.
|
| 168 |
|
| 169 |
``` cpp
|
| 170 |
-
basic_string
|
| 171 |
-
operator=(const basic_string<charT,traits,Allocator>& str);
|
| 172 |
```
|
| 173 |
|
| 174 |
*Effects:* If `*this` and `str` are not the same object, modifies
|
| 175 |
`*this` as shown in Table [[tab:strings.op=]].
|
| 176 |
|
| 177 |
If `*this` and `str` are the same object, the member has no effect.
|
| 178 |
|
| 179 |
*Returns:* `*this`
|
| 180 |
|
| 181 |
-
**Table: `operator=(const basic_string
|
| 182 |
|
| 183 |
| Element | Value |
|
| 184 |
| ------------ | --------------------------------------------------------------------------------------------------------------- |
|
| 185 |
| `data()` | points at the first element of an allocated copy of the array whose first element is pointed at by `str.data()` |
|
| 186 |
| `size()` | `str.size()` |
|
| 187 |
| `capacity()` | a value at least as large as `size()` |
|
| 188 |
|
| 189 |
``` cpp
|
| 190 |
-
basic_string
|
| 191 |
-
operator=(basic_string<charT,traits,Allocator>&& str) noexcept;
|
| 192 |
```
|
| 193 |
|
| 194 |
*Effects:* If `*this` and `str` are not the same object, modifies
|
| 195 |
`*this` as shown in Table [[tab:strings.op=rv]]. A valid implementation
|
| 196 |
is `swap(str)`.
|
| 197 |
|
| 198 |
If `*this` and `str` are the same object, the member has no effect.
|
| 199 |
|
| 200 |
*Returns:* `*this`
|
| 201 |
|
| 202 |
-
**Table: `operator=(
|
| 203 |
|
| 204 |
| Element | Value |
|
| 205 |
| ------------ | ---------------------------------------------------------------------- |
|
| 206 |
| `data()` | points at the array whose first element was pointed at by `str.data()` |
|
| 207 |
| `size()` | previous value of `str.size()` |
|
| 208 |
| `capacity()` | a value at least as large as `size()` |
|
| 209 |
|
| 210 |
``` cpp
|
| 211 |
-
basic_string
|
| 212 |
-
operator=(const charT* s);
|
| 213 |
```
|
| 214 |
|
| 215 |
-
*Returns:* `*this = basic_string
|
| 216 |
|
| 217 |
*Remarks:* Uses `traits::length()`.
|
| 218 |
|
| 219 |
``` cpp
|
| 220 |
-
basic_string
|
| 221 |
```
|
| 222 |
|
| 223 |
-
*Returns:* `*this = basic_string
|
| 224 |
|
| 225 |
``` cpp
|
| 226 |
basic_string& operator=(initializer_list<charT> il);
|
| 227 |
```
|
| 228 |
|
|
|
|
| 1 |
### `basic_string` constructors and assignment operators <a id="string.cons">[[string.cons]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
+
explicit basic_string(const Allocator& a);
|
| 5 |
```
|
| 6 |
|
| 7 |
*Effects:* Constructs an object of class `basic_string`. The
|
| 8 |
postconditions of this function are indicated in
|
| 9 |
Table [[tab:strings.ctr.1]].
|
|
|
|
| 15 |
| `data()` | a non-null pointer that is copyable and can have 0 added to it |
|
| 16 |
| `size()` | 0 |
|
| 17 |
| `capacity()` | an unspecified value |
|
| 18 |
|
| 19 |
``` cpp
|
| 20 |
+
basic_string(const basic_string& str);
|
| 21 |
+
basic_string(basic_string&& str) noexcept;
|
| 22 |
```
|
| 23 |
|
| 24 |
*Effects:* Constructs an object of class `basic_string` as indicated in
|
| 25 |
Table [[tab:strings.ctr.cpy]]. In the second form, `str` is left in a
|
| 26 |
valid state with an unspecified value.
|
| 27 |
|
|
|
|
|
|
|
|
|
|
| 28 |
**Table: `basic_string(const basic_string&)` effects** <a id="tab:strings.ctr.cpy">[tab:strings.ctr.cpy]</a>
|
| 29 |
|
| 30 |
| Element | Value |
|
| 31 |
| ------------ | --------------------------------------------------------------------------------------------------------------- |
|
| 32 |
| `data()` | points at the first element of an allocated copy of the array whose first element is pointed at by `str.data()` |
|
| 33 |
| `size()` | `str.size()` |
|
| 34 |
| `capacity()` | a value at least as large as `size()` |
|
| 35 |
|
| 36 |
``` cpp
|
| 37 |
+
basic_string(const basic_string& str,
|
| 38 |
size_type pos, size_type n = npos,
|
| 39 |
const Allocator& a = Allocator());
|
| 40 |
```
|
| 41 |
|
| 42 |
*Requires:* `pos <= str.size()`
|
|
|
|
| 59 |
``` cpp
|
| 60 |
basic_string(const charT* s, size_type n,
|
| 61 |
const Allocator& a = Allocator());
|
| 62 |
```
|
| 63 |
|
| 64 |
+
*Requires:* `s` points to an array of at least `n` elements of `charT`.
|
| 65 |
|
| 66 |
*Effects:* Constructs an object of class `basic_string` and determines
|
| 67 |
its initial string value from the array of `charT` of length `n` whose
|
| 68 |
first element is designated by `s`, as indicated in
|
| 69 |
Table [[tab:strings.ctr.3]].
|
|
|
|
| 78 |
|
| 79 |
``` cpp
|
| 80 |
basic_string(const charT* s, const Allocator& a = Allocator());
|
| 81 |
```
|
| 82 |
|
| 83 |
+
*Requires:* `s` points to an array of at least `traits::length(s) + 1`
|
| 84 |
+
elements of `charT`.
|
| 85 |
|
| 86 |
*Effects:* Constructs an object of class `basic_string` and determines
|
| 87 |
its initial string value from the array of `charT` of length
|
| 88 |
`traits::length(s)` whose first element is designated by `s`, as
|
| 89 |
indicated in Table [[tab:strings.ctr.4]].
|
|
|
|
| 159 |
| `capacity()` | a value at least as large as `size()` |
|
| 160 |
| `get_allocator()` | `alloc` |
|
| 161 |
|
| 162 |
|
| 163 |
*Throws:* The second form throws nothing if
|
| 164 |
+
`alloc == str.get_allocator()`.
|
|
|
|
| 165 |
|
| 166 |
``` cpp
|
| 167 |
+
basic_string& operator=(const basic_string& str);
|
|
|
|
| 168 |
```
|
| 169 |
|
| 170 |
*Effects:* If `*this` and `str` are not the same object, modifies
|
| 171 |
`*this` as shown in Table [[tab:strings.op=]].
|
| 172 |
|
| 173 |
If `*this` and `str` are the same object, the member has no effect.
|
| 174 |
|
| 175 |
*Returns:* `*this`
|
| 176 |
|
| 177 |
+
**Table: `operator=(const basic_string&)` effects** <a id="tab:strings.op=">[tab:strings.op=]</a>
|
| 178 |
|
| 179 |
| Element | Value |
|
| 180 |
| ------------ | --------------------------------------------------------------------------------------------------------------- |
|
| 181 |
| `data()` | points at the first element of an allocated copy of the array whose first element is pointed at by `str.data()` |
|
| 182 |
| `size()` | `str.size()` |
|
| 183 |
| `capacity()` | a value at least as large as `size()` |
|
| 184 |
|
| 185 |
``` cpp
|
| 186 |
+
basic_string& operator=(basic_string&& str) noexcept;
|
|
|
|
| 187 |
```
|
| 188 |
|
| 189 |
*Effects:* If `*this` and `str` are not the same object, modifies
|
| 190 |
`*this` as shown in Table [[tab:strings.op=rv]]. A valid implementation
|
| 191 |
is `swap(str)`.
|
| 192 |
|
| 193 |
If `*this` and `str` are the same object, the member has no effect.
|
| 194 |
|
| 195 |
*Returns:* `*this`
|
| 196 |
|
| 197 |
+
**Table: `operator=(basic_string&&)` effects** <a id="tab:strings.op=rv">[tab:strings.op=rv]</a>
|
| 198 |
|
| 199 |
| Element | Value |
|
| 200 |
| ------------ | ---------------------------------------------------------------------- |
|
| 201 |
| `data()` | points at the array whose first element was pointed at by `str.data()` |
|
| 202 |
| `size()` | previous value of `str.size()` |
|
| 203 |
| `capacity()` | a value at least as large as `size()` |
|
| 204 |
|
| 205 |
``` cpp
|
| 206 |
+
basic_string& operator=(const charT* s);
|
|
|
|
| 207 |
```
|
| 208 |
|
| 209 |
+
*Returns:* `*this = basic_string(s)`.
|
| 210 |
|
| 211 |
*Remarks:* Uses `traits::length()`.
|
| 212 |
|
| 213 |
``` cpp
|
| 214 |
+
basic_string& operator=(charT c);
|
| 215 |
```
|
| 216 |
|
| 217 |
+
*Returns:* `*this = basic_string(1,c)`.
|
| 218 |
|
| 219 |
``` cpp
|
| 220 |
basic_string& operator=(initializer_list<charT> il);
|
| 221 |
```
|
| 222 |
|