lemon/concept/heap.h
changeset 1816 19ee9133a28c
parent 1494 ae55ba000ebb
child 1875 98698b69a902
equal deleted inserted replaced
1:cf8fbdd2f08b 2:842bba03b47c
    59       /// \param _iim should be given to the constructor, since it is used
    59       /// \param _iim should be given to the constructor, since it is used
    60       /// internally to handle the cross references. The value of the map
    60       /// internally to handle the cross references. The value of the map
    61       /// should be PRE_HEAP (-1) for each element.
    61       /// should be PRE_HEAP (-1) for each element.
    62       explicit Heap(ItemIntMap &_iim) {}
    62       explicit Heap(ItemIntMap &_iim) {}
    63 
    63 
    64       /// The number of items stored in the heap.
    64       /// \brief The number of items stored in the heap.
    65       ///
    65       ///
    66       /// \brief Returns the number of items stored in the heap.
    66       /// Returns the number of items stored in the heap.
    67       int size() const { return 0; }
    67       int size() const { return 0; }
       
    68 
    68       /// \brief Checks if the heap stores no items.
    69       /// \brief Checks if the heap stores no items.
    69       ///
    70       ///
    70       /// Returns \c true if and only if the heap stores no items.
    71       /// Returns \c true if and only if the heap stores no items.
    71       bool empty() const { return false; }
    72       bool empty() const { return false; }
       
    73 
       
    74       /// \brief Makes empty this heap.
       
    75       ///
       
    76       /// Makes this heap empty.
       
    77       void clear();
    72 
    78 
    73       /// \brief Insert an item into the heap with the given heap.
    79       /// \brief Insert an item into the heap with the given heap.
    74       ///    
    80       ///    
    75       /// Adds \c i to the heap with priority \c p. 
    81       /// Adds \c i to the heap with priority \c p. 
    76       /// \param i The item to insert.
    82       /// \param i The item to insert.
   187 	  state = heap.state(item);
   193 	  state = heap.state(item);
   188 
   194 
   189 	  state = _Heap::PRE_HEAP;
   195 	  state = _Heap::PRE_HEAP;
   190 	  state = _Heap::IN_HEAP;
   196 	  state = _Heap::IN_HEAP;
   191 	  state = _Heap::POST_HEAP;
   197 	  state = _Heap::POST_HEAP;
       
   198 
       
   199 	  heap.clear();
   192 	}
   200 	}
   193     
   201     
   194 	_Heap& heap;
   202 	_Heap& heap;
   195 	ItemIntMap& map;
   203 	ItemIntMap& map;
   196 
   204