增加,删除,查找,遍历,大小
Set
1 2 3 4 5 6 7 8 9 10 11 12 13
| set<int> s;
s.insert(1);
s.erase(1);
bool is_in = s.find(1) != s.end();
for(auto i : s){ cout<<i; }
s.size();
|
Map
1 2 3 4 5 6 7 8 9 10 11 12 13
| map<int,int>m;
map[1] = 1; map.insert(pair<int,int>(2,2));
m.erase(1);
bool is_in = s.find(1) != s.end();
for(auto i : m){ cout << i.first << i.second << endl; }
|