lemon/bucket_heap.h
changeset 2079 7fe378247fea
parent 2042 bdc953f2a449
child 2089 fce8db723736
equal deleted inserted replaced
1:66ce1a517fce 2:1a375f20a8eb
    88     /// Returns \c true if and only if the heap stores no items.
    88     /// Returns \c true if and only if the heap stores no items.
    89     bool empty() const { return data.empty(); }
    89     bool empty() const { return data.empty(); }
    90 
    90 
    91     /// \brief Make empty this heap.
    91     /// \brief Make empty this heap.
    92     /// 
    92     /// 
    93     /// Make empty this heap.
    93     /// Make empty this heap. It does not change the cross reference
       
    94     /// map.  If you want to reuse a heap what is not surely empty you
       
    95     /// should first clear the heap and after that you should set the
       
    96     /// cross reference map for each item to \c PRE_HEAP.
    94     void clear() { 
    97     void clear() { 
    95       for (int i = 0; i < (int)data.size(); ++i) {
       
    96 	index[data[i].item] = -2;
       
    97       }
       
    98       data.clear(); first.clear(); minimal = 0;
    98       data.clear(); first.clear(); minimal = 0;
    99     }
    99     }
   100 
   100 
   101   private:
   101   private:
   102 
   102 
   347 
   347 
   348     int size() const { return data.size(); }
   348     int size() const { return data.size(); }
   349     bool empty() const { return data.empty(); }
   349     bool empty() const { return data.empty(); }
   350 
   350 
   351     void clear() { 
   351     void clear() { 
   352       for (int i = 0; i < (int)data.size(); ++i) {
       
   353 	index[data[i].item] = -2;
       
   354       }
       
   355       data.clear(); first.clear(); maximal = -1; 
   352       data.clear(); first.clear(); maximal = -1; 
   356     }
   353     }
   357 
   354 
   358   private:
   355   private:
   359 
   356