UnionFindEnum: one remaining bug; removing commented out code
authorklao
Fri, 10 Mar 2006 18:17:37 +0000
changeset 2004b8f10207e3d6
parent 2003 cf012a7c7f69
child 2005 84ec2948eb1f
UnionFindEnum: one remaining bug; removing commented out code
lemon/unionfind.h
     1.1 --- a/lemon/unionfind.h	Fri Mar 10 18:06:26 2006 +0000
     1.2 +++ b/lemon/unionfind.h	Fri Mar 10 18:17:37 2006 +0000
     1.3 @@ -300,7 +300,7 @@
     1.4        
     1.5        IIter clit = _find(m[comp]);
     1.6        ItemList &c = *clit->my_class;
     1.7 -      c.push_back(ItemType(a,0));
     1.8 +      c.push_back(ItemType(a,CIter()));
     1.9        IIter ai = c.end();
    1.10        --ai;
    1.11        ai->parent = clit;
    1.12 @@ -347,7 +347,6 @@
    1.13  	alist.splice(alist.end(),*cb->my_class);
    1.14  
    1.15  	classes.erase(cb->my_class);
    1.16 -	// ehem: cb->my_class = 0;
    1.17        }
    1.18        else {
    1.19  
    1.20 @@ -358,7 +357,6 @@
    1.21  	blist.splice(blist.end(),*ca->my_class);
    1.22  
    1.23  	classes.erase(ca->my_class);
    1.24 -	// ehem: ca->my_class = 0;
    1.25        }
    1.26  
    1.27        return true;
    1.28 @@ -420,7 +418,6 @@
    1.29        if (la == ia) return;
    1.30  
    1.31        ia->my_class = la->my_class;
    1.32 -      // ehem: la->my_class = 0;
    1.33  
    1.34        ia->size = la->size;
    1.35  
    1.36 @@ -478,7 +475,6 @@
    1.37        }
    1.38  
    1.39        ai->parent = clit;
    1.40 -      // ehem: ai->my_class = 0;
    1.41        ++clit->size;
    1.42  
    1.43        return true;
    1.44 @@ -496,13 +492,11 @@
    1.45      void erase(const T &a) {
    1.46  
    1.47        IIter ma = m[a];
    1.48 -      // ehem: if (ma == 0) return;
    1.49  
    1.50        IIter la = _find(ma);
    1.51        if (la == ma) {
    1.52  	if (ma -> size == 1){
    1.53  	  classes.erase(ma->my_class);
    1.54 -	  // ehem: m.set(a,0);
    1.55  	  return;
    1.56  	}
    1.57  	++la;
    1.58 @@ -516,7 +510,6 @@
    1.59  
    1.60        la->size--;
    1.61        la->my_class->erase(ma);
    1.62 -      // ehem: m.set(a,0);
    1.63      }
    1.64  
    1.65      /**
    1.66 @@ -529,12 +522,6 @@
    1.67  
    1.68      void eraseClass(const T &a) {
    1.69        IIter ma = m[a];
    1.70 -      // ehem: if (ma == 0) return;
    1.71 -// #     ifdef DEBUG
    1.72 -//       CIter c = _find(ma)->my_class;
    1.73 -//       for (IIter i=c->begin(); i!=c->end(); ++i)
    1.74 -// 	m.set(i->me, 0);
    1.75 -// #     endif
    1.76        classes.erase(_find(ma)->my_class);
    1.77      }
    1.78  
    1.79 @@ -581,16 +568,6 @@
    1.80  
    1.81        // obsoleted:
    1.82        bool valid() const { return l!=0 && i!=l->end(); }
    1.83 -    private:
    1.84 -      //void first(const ClassList &l) { i = l.begin(); validate(l); }
    1.85 -//       void next(const ClassList &l) {
    1.86 -// 	++i; 
    1.87 -// 	validate(l);
    1.88 -//       }
    1.89 -//       void validate(const ClassList &l) {
    1.90 -// 	if ( i == l.end() ) 
    1.91 -// 	  i = 0;
    1.92 -//       }
    1.93      };
    1.94  
    1.95      /**
    1.96 @@ -661,13 +638,13 @@
    1.97        }
    1.98        
    1.99        operator const T& () const { return i->me; }
   1.100 -      bool operator == (ItemIt it) const {
   1.101 +      bool operator == (ItemIt const &it) const {
   1.102  	return (l==it.l && i==it.i) || (!valid() && !it.valid());
   1.103        }
   1.104 -      bool operator != (ItemIt it) const {
   1.105 +      bool operator != (ItemIt const &it) const {
   1.106  	return !(*this == it);
   1.107        }
   1.108 -      bool operator < (ItemIt it) const {
   1.109 +      bool operator < (ItemIt const &it) const {
   1.110  	return (i < it.i);
   1.111        }
   1.112  
   1.113 @@ -685,16 +662,6 @@
   1.114  
   1.115        // obsoleted:
   1.116        bool valid() const { return l!=0 && i!=l->end(); }
   1.117 -    private:
   1.118 -//       void first(const ItemList &il) { l=&il; i = l->begin(); validate(); }
   1.119 -//       void next() {
   1.120 -// 	++i; 
   1.121 -// 	validate();
   1.122 -//       }
   1.123 -//       void validate() {
   1.124 -// 	if ( i == l->end() ) 
   1.125 -// 	  i = 0;
   1.126 -//       }
   1.127      };
   1.128  
   1.129