#include <set>
#include <iostream>
#include <string>
using namespace std;
template <class T>
void print(T& c){
for( typename T::iterator i = c.begin(); i != c.end(); i++ ){
std::cout << *i << endl;
}
}
int main()
{
set<string> first;
first.insert("r");
first.insert("T");
first.insert("s");
cout << first.size() << endl;
set<string> second (first); // Copy constructor
second.insert("r");
second.insert("K");
second.insert("S");
second.insert("b");
cout << second.size() << endl;
set<string> third = first;
print(first);
print(second);
print(third);
set<string> set2(first);
set2.insert("l");
print(set2);
}
|