1: //set03.cpp
3: #include <iostream>
4: #include <iomanip>
5: #include <set>
6: using namespace std;
8: int main()
9: {
10: cout << "\nHere are the maximum sizes of several sets "
11: "of different component types:\n\n";
13: set<int> s1;
14: set<double> s2;
15: set<char> s3;
16: set<string> s4;
18: //Just something that takes up a lot of space
19: struct BigThing
20: {
21: double first[10000];
22: double second[1000000];
23: };
24: set<BigThing> s5;
25: //Interstingly, we can declare a set of BigThing and ask for its
26: //maximum size, even though operator< is not defined for BigThing.
28: cout << "Maximum size of a set<int> .........."
29: << setw(11) << s1.max_size() << "\n"
31: << "Maximum size of a set<double> ......."
32: << setw(11) << s2.max_size() << "\n"
34: << "Maximum size of a set<char> ........."
35: << setw(11) << s3.max_size() << "\n"
37: << "Maximum size of a set<string> ......."
38: << setw(11) << s4.max_size() << "\n"
40: << "Maximum size of a set<BigThing> ....."
41: << setw(11) << s5.max_size() << "\n\n";
43: cout << "Press Enter to continue ... "; cin.ignore(80, '\n');
44: }