equal
deleted
inserted
replaced
114 /// Returns \c true if and only if the heap stores no items. |
114 /// Returns \c true if and only if the heap stores no items. |
115 bool empty() const { return num_items==0; } |
115 bool empty() const { return num_items==0; } |
116 |
116 |
117 /// \brief Make empty this heap. |
117 /// \brief Make empty this heap. |
118 /// |
118 /// |
119 /// Make empty this heap. |
119 /// Make empty this heap. It does not change the cross reference |
|
120 /// map. If you want to reuse a heap what is not surely empty you |
|
121 /// should first clear the heap and after that you should set the |
|
122 /// cross reference map for each item to \c PRE_HEAP. |
120 void clear() { |
123 void clear() { |
121 if (num_items != 0) { |
|
122 for (int i = 0; i < (int)container.size(); ++i) { |
|
123 iimap[container[i].name] = -2; |
|
124 } |
|
125 } |
|
126 container.clear(); minimum = 0; num_items = 0; |
124 container.clear(); minimum = 0; num_items = 0; |
127 } |
125 } |
128 |
126 |
129 /// \brief \c item gets to the heap with priority \c value independently |
127 /// \brief \c item gets to the heap with priority \c value independently |
130 /// if \c item was already there. |
128 /// if \c item was already there. |