29 lines
1.1 KiB
Markdown
29 lines
1.1 KiB
Markdown
[move.iterators.general]
|
|
|
|
# 24 Iterators library [[iterators]](./#iterators)
|
|
|
|
## 24.5 Iterator adaptors [[predef.iterators]](predef.iterators#move.iterators.general)
|
|
|
|
### 24.5.4 Move iterators and sentinels [[move.iterators]](move.iterators#general)
|
|
|
|
#### 24.5.4.1 General [move.iterators.general]
|
|
|
|
[1](#1)
|
|
|
|
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L4760)
|
|
|
|
Class template move_iterator is an iterator adaptor
|
|
with the same behavior as the underlying iterator except that its
|
|
indirection operator implicitly converts the value returned by the
|
|
underlying iterator's indirection operator to an rvalue[.](#1.sentence-1)
|
|
|
|
Some generic algorithms can be called with move iterators to replace
|
|
copying with moving[.](#1.sentence-2)
|
|
|
|
[2](#2)
|
|
|
|
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L4768)
|
|
|
|
[*Example [1](#example-1)*: list<string> s;// populate the list s vector<string> v1(s.begin(), s.end()); // copies strings into v1 vector<string> v2(make_move_iterator(s.begin()),
|
|
make_move_iterator(s.end())); // moves strings into v2 â *end example*]
|