- /*
- set 集合基本用法
- */
- #include<iostream>
- #include<set>
- using namespace std;
- //set<T>a;
- void IteratorUsage()
- set<int>a;
- int main(){
- //T n;
- //sample
- // 插入
- int n;
- a.insert(n);
- // 删除
- a.erase(n);
- // 查找
- cout<<a.count(n)<<endl;
- // 返回 1 or 0
- // 清空
- a.clear();
- return 0;
- }
来源: http://www.bubuko.com/infodetail-3379085.html