IterableMap with template ValueType. IterableBoolMap as a specialization.
Range checking warnings...
11 typedef StdMap<int,int> BaseMap;
12 typedef IterableMap<BaseMap, N> TestMap;
13 typedef IterableBoolMap<BaseMap> TestBoolMap;
17 void print(TM const& m, int N = 3) {
18 cout << "Size of the map: " << m.size() << endl;
19 for(int i=0; i<N; ++i) {
20 cout << " Class " << i << ". (size=" << m.size(i) << "): " << flush;
22 for(typename TM::iterator j = m.begin(i); j!=m.end(i); ++j) {
40 cout << "Inserting 12 to class 2...\n";
45 cout << "Inserting 22 to class 2...\n";
49 cout << "Testing some map values:\n";
50 cout << " 12: " << int(test[12]) << endl;
52 cout << "Inserting 10 to class 0...\n";
56 cout << "Testing some map values:\n";
57 cout << " 12: " << int(test[12]) << endl;
59 cout << "Inserting 11 to class 1...\n";
63 cout << "Testing some map values:\n";
64 cout << " 12: " << int(test[12]) << endl;
65 cout << " 22: " << int(test[22]) << endl;
66 cout << " 10: " << int(test[10]) << endl;
67 cout << " 11: " << int(test[11]) << endl;
68 cout << " 42: " << int(test[42]) << endl;
70 cout << "Inserting 21 to class 1...\n";
74 cout << "Inserting 20 to class 1...\n";
78 cout << "Testing some map values:\n";
79 cout << " 12: " << int(test[12]) << endl;
80 cout << " 22: " << int(test[22]) << endl;
81 cout << " 10: " << int(test[10]) << endl;
82 cout << " 20: " << int(test[20]) << endl;
83 cout << " 11: " << int(test[11]) << endl;
84 cout << " 21: " << int(test[21]) << endl;
85 cout << " 42: " << int(test[42]) << endl;
87 cout << "Setting 20 to class 2...\n";
91 cout << "Setting 10 to class 1...\n";
95 cout << "Setting 11 to class 1...\n";
99 cout << "Setting 12 to class 1...\n";
103 cout << "Setting 21 to class 2...\n";
107 cout << "Setting 22 to class 2...\n";
111 cout << "Testing some map values:\n";
112 cout << " 12: " << int(test[12]) << endl;
113 cout << " 22: " << int(test[22]) << endl;
114 cout << " 10: " << int(test[10]) << endl;
115 cout << " 20: " << int(test[20]) << endl;
116 cout << " 11: " << int(test[11]) << endl;
117 cout << " 21: " << int(test[21]) << endl;
118 cout << " 42: " << int(test[42]) << endl;
122 cout << "Testing the IterableBoolMap...\n";
125 TestBoolMap test(base);
130 cout << "Inserting 12 to class true...\n";
131 test.insert(12,true);
135 cout << "Inserting 22 to class true...\n";
136 test.insert(22,true);
139 cout << "Testing some map values:\n";
140 cout << " 12: " << test[12] << endl;
142 cout << "Inserting 10 to class false...\n";
143 test.insert(10,false);
146 cout << "Testing some map values:\n";
147 cout << " 12: " << test[12] << endl;
149 cout << "Inserting 11 to class false...\n";
150 test.insert(11,false);
153 cout << "Testing some map values:\n";
154 cout << " 12: " << test[12] << endl;
155 cout << " 22: " << test[22] << endl;
156 cout << " 10: " << test[10] << endl;
157 cout << " 11: " << test[11] << endl;
158 cout << " 42: " << test[42] << endl;
160 cout << "Inserting 21 to class 1...\n";
164 cout << "Inserting 20 to class 1...\n";
168 cout << "Testing some map values:\n";
169 cout << " 12: " << test[12] << endl;
170 cout << " 22: " << test[22] << endl;
171 cout << " 10: " << test[10] << endl;
172 cout << " 20: " << test[20] << endl;
173 cout << " 11: " << test[11] << endl;
174 cout << " 21: " << test[21] << endl;
175 cout << " 42: " << test[42] << endl;
177 cout << "Setting 20 to class 2...\n";
181 cout << "Setting 10 to class 1...\n";
185 cout << "Setting 11 to class 1...\n";
189 cout << "Setting 12 to class 1...\n";
193 cout << "Setting 21 to class 2...\n";
197 cout << "Setting 22 to class 2...\n";
201 cout << "Testing some map values:\n";
202 cout << " 12: " << test[12] << endl;
203 cout << " 22: " << test[22] << endl;
204 cout << " 10: " << test[10] << endl;
205 cout << " 20: " << test[20] << endl;
206 cout << " 11: " << test[11] << endl;
207 cout << " 21: " << test[21] << endl;
208 cout << " 42: " << test[42] << endl;