📄 insertion_iterator.cpp
字号:
#include <iostream>
#include <string>
#include <iterator>
#include <vector>
using namespace std;
int main()
{
string string1[4] = {"This", "is", "a", "test"};
string string2[2] = {"not", "really"};
string string3[3] = {"yes", "it", "is"};
vector<string> text(4);
copy(string1, string1 + 4, text.begin());
ostream_iterator<string, char> out(cout, " ");
copy (text.begin(), text.end(), out);
cout << endl;
copy(string2, string1, insert_iterator<vector<string> >(text, text.begin() + 2));
copy (text.begin(), text.end(), out);
cout << endl;
copy(string3, string2, back_insert_iterator<vector<string> >(text));
copy (text.begin(), text.end(), out);
cout << endl;
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -