lemon/fib_heap.h
changeset 1753 98d83dd56c1d
parent 1717 75fe24093ded
child 1834 0a14e1ae45a1
     1.1 --- a/lemon/fib_heap.h	Wed Nov 02 15:25:13 2005 +0000
     1.2 +++ b/lemon/fib_heap.h	Wed Nov 02 15:26:04 2005 +0000
     1.3 @@ -116,9 +116,11 @@
     1.4      /// \brief Make empty this heap.
     1.5      /// 
     1.6      /// Make empty this heap.
     1.7 -    void clear() { 
     1.8 -      for (int i = 0; i < (int)container.size(); ++i) {
     1.9 -	iimap[container[i].name] = -2;
    1.10 +    void clear() {
    1.11 +      if (num_items != 0) {
    1.12 +	for (int i = 0; i < (int)container.size(); ++i) {
    1.13 +	  iimap[container[i].name] = -2;
    1.14 +	}
    1.15        }
    1.16        container.clear(); minimum = 0; num_items = 0;
    1.17      }