#include <iostream>
#include <set>
using namespace std;
void print (set<int, less<int> >& s)
{
set<int, less<int> >::iterator It;
for ( It = s.begin(); It != s.end(); It++ )
cout << *It << " ";
cout << endl;
}
//--------------------------------------------
int main ()
{
int ary[] = {1,2,3,2,3,4,8,2,5,6};
set<int, less<int> > s;
s.insert(ary,ary+10);
print(s);
// erase '2'
s.erase(2);
print(s);
set<int, less<int> >::iterator It;
It = s.find(5);
// erase '5'
s.erase(It);
print(s);
It = s.find(4);
// erase from It to the end of set
s.erase(It,s.end());
print(s);
getchar();
return 0;
}