C++典型实现补充

This commit is contained in:
Estom
2021-09-03 06:42:58 +08:00
parent 2d9a1a3b53
commit 4922bbf1eb
18 changed files with 719 additions and 11 deletions

29
code_segment/test2.cpp Normal file
View File

@@ -0,0 +1,29 @@
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
using namespace std;
int main()
{
vector<int> vec{1,2,3,4,5};
auto beg = vec.begin();
auto temp = beg+2;
cout<<boolalpha<<(temp>beg)<<endl;
cout<<*temp<<endl;
map<int,int> m;
m[1]=1;
m[2]=2;
m[3]=3;
cout<<"map:"<<endl;
for(auto beg1 = m.begin();beg1<m.end();beg1++){
cout<<(beg1->second)<<endl;
}
auto iter = m.begin();
auto temp2 = ++iter;
// cout<<(iter
// m.end())<<endl;
cout<<temp2->second<<endl;
return 0;
}