set
- map은 key, value형태
- set은 value가 key인 형태
set<int> s;
s.insert(10);
s.insert(20);
s.insert(30);
s.insert(40);
s.insert(50);
s.erase(10);
s.erase(30);
s.erase(50);
set<int>::iterator findit = s.find(40);
if(findit == s.end())
{
// 못찾음
}
for(set<int>::iterator it = s.begin(); it != s.end(); ++it)
{
cout << (*it) << endl;
}
multiset
multiset<int> ms;
ms.insert(100);
ms.insert(100);
ms.insert(100);
ms.insert(200);
ms.insert(200);
multiset<int>::iterator findit = ms.find(100);
pair<multiset<int, int>::iterator, multiset<int, int>::iterator> itPair;
itPair = ms.equal_range(100);
for(multiset<int, int>::iterator it = itPair.first; it != itPair.second; ++it)
{
cout << it->first << " " << it->second << endl;
}