Masikfele iteralas, Node-hoz alkalmazkodva...
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) {
38 cout << "Inserting 12 to class 2...\n";
43 cout << "Inserting 22 to class 2...\n";
47 cout << "Testing some map values:\n";
48 cout << " 12: " << int(test[12]) << endl;
50 cout << "Inserting 10 to class 0...\n";
54 cout << "Testing some map values:\n";
55 cout << " 12: " << int(test[12]) << endl;
57 cout << "Inserting 11 to class 1...\n";
61 cout << "Testing some map values:\n";
62 cout << " 12: " << int(test[12]) << endl;
63 cout << " 22: " << int(test[22]) << endl;
64 cout << " 10: " << int(test[10]) << endl;
65 cout << " 11: " << int(test[11]) << endl;
66 cout << " 42: " << int(test[42]) << endl;
68 cout << "Inserting 21 to class 1...\n";
72 cout << "Inserting 20 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 << " 20: " << int(test[20]) << endl;
81 cout << " 11: " << int(test[11]) << endl;
82 cout << " 21: " << int(test[21]) << endl;
83 cout << " 42: " << int(test[42]) << endl;
85 cout << "Setting 20 to class 2...\n";
89 cout << "Setting 10 to class 1...\n";
93 cout << "Setting 11 to class 1...\n";
97 cout << "Setting 12 to class 1...\n";
101 cout << "Setting 21 to class 2...\n";
105 cout << "Setting 22 to class 2...\n";
109 cout << "Testing some map values:\n";
110 cout << " 12: " << int(test[12]) << endl;
111 cout << " 22: " << int(test[22]) << endl;
112 cout << " 10: " << int(test[10]) << endl;
113 cout << " 20: " << int(test[20]) << endl;
114 cout << " 11: " << int(test[11]) << endl;
115 cout << " 21: " << int(test[21]) << endl;
116 cout << " 42: " << int(test[42]) << endl;
120 cout << "\n\n\nTesting the IterableBoolMap...\n";
123 TestBoolMap test(base,true);
128 cout << "Inserting 12 to class true...\n";
129 test.insert(12,true);
133 cout << "Inserting 22 to class true...\n";
134 test.insert(22,true);
137 cout << "Testing some map values:\n";
138 cout << " 12: " << test[12] << endl;
140 cout << "Inserting 10 to class false...\n";
141 test.insert(10,false);
144 cout << "Testing some map values:\n";
145 cout << " 12: " << test[12] << endl;
147 cout << "Inserting 11 to class false...\n";
148 test.insert(11,false);
151 cout << "Testing some map values:\n";
152 cout << " 12: " << test[12] << endl;
153 cout << " 22: " << test[22] << endl;
154 cout << " 10: " << test[10] << endl;
155 cout << " 11: " << test[11] << endl;
156 cout << " 42: " << test[42] << endl;
158 cout << "Setting 10 to class true...\n";
162 cout << "Setting 11 to class true...\n";
166 cout << "Setting 12 to class false...\n";
170 cout << "Setting 22 to class false...\n";
174 cout << "Testing some map values:\n";
175 cout << " 12: " << test[12] << endl;
176 cout << " 22: " << test[22] << endl;
177 cout << " 10: " << test[10] << endl;
178 cout << " 11: " << test[11] << endl;
179 cout << " 42: " << test[42] << endl;