tmp/tmpgl4klb3b/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### General <a id="move.iterators.general">[[move.iterators.general]]</a>
|
| 2 |
+
|
| 3 |
+
Class template `move_iterator` is an iterator adaptor with the same
|
| 4 |
+
behavior as the underlying iterator except that its indirection operator
|
| 5 |
+
implicitly converts the value returned by the underlying iterator’s
|
| 6 |
+
indirection operator to an rvalue. Some generic algorithms can be called
|
| 7 |
+
with move iterators to replace copying with moving.
|
| 8 |
+
|
| 9 |
+
[*Example 1*:
|
| 10 |
+
|
| 11 |
+
``` cpp
|
| 12 |
+
list<string> s;
|
| 13 |
+
// populate the list s
|
| 14 |
+
vector<string> v1(s.begin(), s.end()); // copies strings into v1
|
| 15 |
+
vector<string> v2(make_move_iterator(s.begin()),
|
| 16 |
+
make_move_iterator(s.end())); // moves strings into v2
|
| 17 |
+
```
|
| 18 |
+
|
| 19 |
+
— *end example*]
|
| 20 |
+
|