Some change on the clear
authordeba
Wed, 02 Nov 2005 15:26:04 +0000
changeset 175398d83dd56c1d
parent 1752 dce1f28ac595
child 1754 4bf5ceb49023
Some change on the clear
lemon/fib_heap.h
     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      }