11 typedef BinHeap<string, double, string_int_map> StrDoubleHeap;
13 class string_int_map : public map<string,int> {
15 int get(const string &s) {
16 // Bocs, ez igy gaaaany, de nem volt kedvem utananezni, hogy
17 // hogy is mukodik ez a map :)
19 operator[](s) = StrDoubleHeap::PRE_HEAP;
23 void put(const string &s, int i) {
34 cout << "testing string_int_map default value:\n";
35 cout << " alma: " << sim.get("alma") << endl;
37 cout << "creating the heap\n";
38 StrDoubleHeap heap(sim);
40 cout << "heap.push(\"alma\", 15);\n";
41 heap.push("alma", 15);
43 cout << "heap.put(\"korte\", 3.4);\n";
44 heap.put("korte", 3.4);
46 cout << "heap.get(\"alma\") = "
50 cout << "heap.top() = "
51 << heap.top() << endl;
52 cout << "heap.topValue() = "
53 << heap.topValue() << endl;
55 cout << "heap.decrease(\"alma\", 1.2);\n";
56 heap.put("alma", 1.2);
58 cout << "heap.top() = "
59 << heap.top() << endl;
60 cout << "heap.topValue() = "
61 << heap.topValue() << endl;
63 cout << "heap.put(\"alma\", 22);\n";
66 cout << "heap.top() = "
67 << heap.top() << endl;
68 cout << "heap.topValue() = "
69 << heap.topValue() << endl;
71 cout << "heap.size() = "
72 << heap.size() << endl;
73 cout << "heap.pop();\n";
76 cout << "heap.top() = "
77 << heap.top() << endl;
78 cout << "heap.topValue() = "
79 << heap.topValue() << endl;
81 cout << "heap.size() = "
82 << heap.size() << endl;
83 cout << "heap.pop();\n";
86 cout << "heap.size() = "
87 << heap.size() << endl;
88 cout << "heap.empty() = "
89 << (heap.empty()?"true":"false") << endl;