Check StaticGraphSkeleton, as well.
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) {
32 Int(int b = 5) : a(b) {}
33 Int(Invalid) : a(-1) {}
35 operator int() const { return a; }
37 bool valid() { return a != -1; }
40 typedef StdMap<Int,int> BaseMap2;
41 typedef IterableBoolMap<BaseMap2> TestBoolMap2;
53 cout << "Inserting 12 to class 2...\n";
58 cout << "Inserting 22 to class 2...\n";
62 cout << "Testing some map values:\n";
63 cout << " 12: " << int(test[12]) << endl;
65 cout << "Inserting 10 to class 0...\n";
69 cout << "Testing some map values:\n";
70 cout << " 12: " << int(test[12]) << endl;
72 cout << "Inserting 11 to class 1...\n";
76 cout << "Testing some map values:\n";
77 cout << " 12: " << int(test[12]) << endl;
78 cout << " 22: " << int(test[22]) << endl;
79 cout << " 10: " << int(test[10]) << endl;
80 cout << " 11: " << int(test[11]) << endl;
81 cout << " 42: " << int(test[42]) << endl;
83 cout << "Inserting 21 to class 1...\n";
87 cout << "Inserting 20 to class 1...\n";
91 cout << "Testing some map values:\n";
92 cout << " 12: " << int(test[12]) << endl;
93 cout << " 22: " << int(test[22]) << endl;
94 cout << " 10: " << int(test[10]) << endl;
95 cout << " 20: " << int(test[20]) << endl;
96 cout << " 11: " << int(test[11]) << endl;
97 cout << " 21: " << int(test[21]) << endl;
98 cout << " 42: " << int(test[42]) << endl;
100 cout << "Setting 20 to class 2...\n";
104 cout << "Setting 10 to class 1...\n";
108 cout << "Setting 11 to class 1...\n";
112 cout << "Setting 12 to class 1...\n";
116 cout << "Setting 21 to class 2...\n";
120 cout << "Setting 22 to class 2...\n";
124 cout << "Testing some map values:\n";
125 cout << " 12: " << int(test[12]) << endl;
126 cout << " 22: " << int(test[22]) << endl;
127 cout << " 10: " << int(test[10]) << endl;
128 cout << " 20: " << int(test[20]) << endl;
129 cout << " 11: " << int(test[11]) << endl;
130 cout << " 21: " << int(test[21]) << endl;
131 cout << " 42: " << int(test[42]) << endl;
135 cout << "\n\n\nTesting the IterableBoolMap...\n";
138 TestBoolMap test(base,true);
143 cout << "Inserting 12 to class true...\n";
144 test.insert(12,true);
148 cout << "Inserting 22 to class true...\n";
149 test.insert(22,true);
152 cout << "Testing some map values:\n";
153 cout << " 12: " << test[12] << endl;
155 cout << "Inserting 10 to class false...\n";
156 test.insert(10,false);
159 cout << "Testing some map values:\n";
160 cout << " 12: " << test[12] << endl;
162 cout << "Inserting 11 to class false...\n";
163 test.insert(11,false);
166 cout << "Testing some map values:\n";
167 cout << " 12: " << test[12] << endl;
168 cout << " 22: " << test[22] << endl;
169 cout << " 10: " << test[10] << endl;
170 cout << " 11: " << test[11] << endl;
171 cout << " 42: " << test[42] << endl;
173 cout << "Setting 10 to class true...\n";
177 cout << "Setting 11 to class true...\n";
181 cout << "Setting 12 to class false...\n";
185 cout << "Setting 22 to class false...\n";
189 cout << "Testing some map values:\n";
190 cout << " 12: " << test[12] << endl;
191 cout << " 22: " << test[22] << endl;
192 cout << " 10: " << test[10] << endl;
193 cout << " 11: " << test[11] << endl;
194 cout << " 42: " << test[42] << endl;
199 cout << "\n\n\nTest a masikfele iteralasra:\n";
202 TestBoolMap2 test(base,false);
204 cout << "Inserting 12 to class true...\n";
205 test.insert(12,true);
208 cout << "Inserting 22 to class true...\n";
209 test.insert(22,true);
212 cout << "Inserting 10 to class false...\n";
213 test.insert(10,false);
216 cout << "Testing some map values:\n";
217 cout << " 12: " << test[12] << endl;
218 cout << " 22: " << test[22] << endl;
219 cout << " 10: " << test[10] << endl;
220 cout << " 42: " << test[42] << endl;
222 cout << "The elements of the \"true\" class: ";
224 for(test.first(a, true); a.valid(); test.next(a)) {
229 cout << "Removing 10 from the map...\n";