tmp/tmphy4_jb4q/{from.md → to.md}
RENAMED
|
@@ -4,15 +4,19 @@
|
|
| 4 |
and the corresponding constructor. **Rationale:** Improve efficiency of
|
| 5 |
operations on rvalues. **Effect on original feature:** Valid C++20 code
|
| 6 |
that created a substring by calling `substr` (or the corresponding
|
| 7 |
constructor) on an xvalue expression with type `S` that is a
|
| 8 |
specialization of `basic_string` may change meaning in this revision of
|
| 9 |
-
C++.
|
|
|
|
|
|
|
| 10 |
|
| 11 |
``` cpp
|
| 12 |
std::string s1 = "some long string that forces allocation", s2 = s1;
|
| 13 |
std::move(s1).substr(10, 5);
|
| 14 |
assert(s1 == s2); // unspecified, previously guaranteed to be true
|
| 15 |
std::string s3(std::move(s2), 10, 5);
|
| 16 |
assert(s1 == s2); // unspecified, previously guaranteed to be true
|
| 17 |
```
|
| 18 |
|
|
|
|
|
|
|
|
|
| 4 |
and the corresponding constructor. **Rationale:** Improve efficiency of
|
| 5 |
operations on rvalues. **Effect on original feature:** Valid C++20 code
|
| 6 |
that created a substring by calling `substr` (or the corresponding
|
| 7 |
constructor) on an xvalue expression with type `S` that is a
|
| 8 |
specialization of `basic_string` may change meaning in this revision of
|
| 9 |
+
C++.
|
| 10 |
+
|
| 11 |
+
[*Example 1*:
|
| 12 |
|
| 13 |
``` cpp
|
| 14 |
std::string s1 = "some long string that forces allocation", s2 = s1;
|
| 15 |
std::move(s1).substr(10, 5);
|
| 16 |
assert(s1 == s2); // unspecified, previously guaranteed to be true
|
| 17 |
std::string s3(std::move(s2), 10, 5);
|
| 18 |
assert(s1 == s2); // unspecified, previously guaranteed to be true
|
| 19 |
```
|
| 20 |
|
| 21 |
+
— *end example*]
|
| 22 |
+
|