- C 标准库
- C 标准库
- C++ 标准库
- C++ 库 - 主页
- C++ 库 - <fstream>
- C++ 库 - <iomanip>
- C++ 库 - <ios>
- C++ 库 - <iosfwd>
- C++ 库 - <iostream>
- C++ 库 - <istream>
- C++ 库 - <ostream>
- C++ 库 - <sstream>
- C++ 库 - <streambuf>
- C++ 库 - <原子>
- C++ 库 - <复杂>
- C++ 库 - <异常>
- C++ 库 - <功能>
- C++ 库 - <限制>
- C++ 库 - <语言环境>
- C++ 库 - <内存>
- C++ 库 - <新>
- C++ 库 - <数字>
- C++ 库 - <正则表达式>
- C++ 库 - <stdexcept>
- C++ 库 - <字符串>
- C++ 库 - <线程>
- C++ 库 - <元组>
- C++ 库 - <类型信息>
- C++ 库 - <实用程序>
- C++ 库 - <valarray>
C++ 迭代器库 - make_move_iterator
描述
它从中构造一个 move_iterator 对象。
宣言
以下是 std::make_move_iterator 的声明。
C++11
template <class Iterator> move_iterator<Iterator> make_move_iterator (const Iterator& it);
参数
it - 它是一个迭代器。
返回值
它返回一个与它等效的 move_iterator ,但会在取消引用时移动。
例外情况
如果 x 在对其应用一元运算符& 时以某种方式抛出异常,则该函数永远不会抛出异常。
时间复杂度
随机访问迭代器的常量。
例子
以下示例显示了 std::make_move_iterator 的用法。
#include <iostream>
#include <iterator>
#include <vector>
#include <string>
#include <algorithm>
int main () {
std::vector<std::string> foo (3);
std::vector<std::string> bar {"tutorialspont","com","india"};
std::copy ( make_move_iterator(bar.begin()),
make_move_iterator(bar.end()),
foo.begin() );
// bar now contains unspecified values; clear it:
bar.clear();
std::cout << "foo:";
for (std::string& x : foo) std::cout << ' ' << x;
std::cout << '\n';
return 0;
}
让我们编译并运行上面的程序,这将产生以下结果 -
foo: tutorialspont com india
迭代器.htm