v e c t o r vector vector
vector<int>v3;
//插入
v3.insert(v3.begin(),3);//迭代器+值
//删除
v3.erase(v3.begin()+2);//删除第2个元素,从0开始计数
v3.erase(v3.begin()+1,v3.begin()+3);//删除第1个到第3个元素区间的所有元素
v3.pop_back();
//清空
v2.clear();
if(v2.empty()) cout<<"v2经过使用clear()方法后为空\n";
//反向
reverse(v3.begin(),v3.end());//全部反向排列
m a p map map
map<int ,int >map1;
//删除
map1.erase(x);
//遍历
for (map<int, string>::iterator it=map1.begin(); it!=map1.end(); it++)
{
cout << it->first << ":" << it->second << endl;
}
//计数
map1.count(x); //返回指定元素出现的次数
//查找
map1.lower_bound();
auto pos=map1.find('a'); //也是用来查找'a'的,返回位置,如果没有,就是a.end()
s e t set set
set<int > st;
//统计
st.count(x); // 用来查找set中某个某个键值出现的次数
//删除
st.erase(iterator); //删除定位器iterator指向的值
st.erase(first,second); //删除定位器first和second之间的值
st.erase(key_value); //删除键值key_value的值
//查找
set<int>::iterator iter;
if((iter = s.find(2)) != s.end()) cout<<*iter<<endl;
//插入
st.insert(key_value);
st.inset(first,second); //将定位器first到second之间的元素插入到set中
//查找
st.lower_bound(key_value); //返回第一个大于等于key_value的定位器
st.upper_bound(key_value); //返回最后一个大于等于key_value的定位器