lemon/bin_heap.h
changeset 2256 b22dfb6c5ff3
parent 1956 a055123339d5
child 2258 741995f3dbc4
equal deleted inserted replaced
7:243744614c20 8:8265da153815
   110     /// Returns \c true if and only if the heap stores no items.
   110     /// Returns \c true if and only if the heap stores no items.
   111     bool empty() const { return data.empty(); }
   111     bool empty() const { return data.empty(); }
   112 
   112 
   113     /// \brief Make empty this heap.
   113     /// \brief Make empty this heap.
   114     /// 
   114     /// 
   115     /// Make empty this heap.
   115     /// Make empty this heap. It does not change the cross reference map.
       
   116     /// If you want to reuse what is not surely empty you should first clear
       
   117     /// the heap and after that you should set the cross reference map for
       
   118     /// each item to \c PRE_HEAP.
   116     void clear() { 
   119     void clear() { 
   117       for (int i = 0; i < (int)data.size(); ++i) {
       
   118 	iim.set(data[i].first, POST_HEAP);
       
   119       }
       
   120       data.clear(); 
   120       data.clear(); 
   121     }
   121     }
   122 
   122 
   123   private:
   123   private:
   124     static int parent(int i) { return (i-1)/2; }
   124     static int parent(int i) { return (i-1)/2; }