.
authoralpar
Sun, 22 Feb 2004 12:51:34 +0000
changeset 1153d9681ef6116
parent 114 bb07dd5b2d67
child 116 a987c6013ea0
.
src/work/alpar/smart_graph.h
     1.1 --- a/src/work/alpar/smart_graph.h	Sun Feb 22 12:43:48 2004 +0000
     1.2 +++ b/src/work/alpar/smart_graph.h	Sun Feb 22 12:51:34 2004 +0000
     1.3 @@ -282,6 +282,7 @@
     1.4  	DynMapBase<NodeIt>(_G), container(_G.maxNodeId())
     1.5        {
     1.6  	//FIXME: What if there are empty Id's?
     1.7 +	//FIXME: Can I use 'this' in a constructor?
     1.8  	G->dyn_node_maps.push_back(this);
     1.9        }
    1.10        ~DynNodeMap()
    1.11 @@ -290,7 +291,12 @@
    1.12  	  std::vector<DynMapBase<NodeIt>* >::iterator i;
    1.13  	  for(i=G->dyn_node_maps.begin();
    1.14  	      i!=G->dyn_node_maps.end() && *i!=this; ++i) ;
    1.15 -	  if(*i==this) G->dyn_node_maps.erase(i); //FIXME: Way too slow...
    1.16 +	  //if(*i==this) G->dyn_node_maps.erase(i); //FIXME: Way too slow...
    1.17 +	  //A better way to do that: (Is this really important?)
    1.18 +	  if(*i==this) {
    1.19 +	    G->dyn_node_maps[i]=G->dyn_node_maps.back;
    1.20 +	    G->dyn_node_maps.pop_back();
    1.21 +	  }
    1.22  	}
    1.23        }
    1.24  
    1.25 @@ -324,7 +330,7 @@
    1.26  	DynMapBase<EdgeIt>(_G), container(_G.maxEdgeId())
    1.27        {
    1.28  	//FIXME: What if there are empty Id's?
    1.29 -	//FIXME: Can I do that? :
    1.30 +	//FIXME: Can I use 'this' in a constructor?
    1.31  	G->dyn_edge_maps.push_back(this);
    1.32        }
    1.33        ~DynEdgeMap()
    1.34 @@ -333,10 +339,15 @@
    1.35  	  std::vector<DynMapBase<EdgeIt>* >::iterator i;
    1.36  	  for(i=G->dyn_edge_maps.begin();
    1.37  	      i!=G->dyn_edge_maps.end() && *i!=this; ++i) ;
    1.38 -	  if(*i==this) G->dyn_edge_maps.erase(i); //FIXME: Way too slow...
    1.39 +	  //if(*i==this) G->dyn_edge_maps.erase(i); //Way too slow...
    1.40 +	  //A better way to do that: (Is this really important?)
    1.41 +	  if(*i==this) {
    1.42 +	    G->dyn_edge_maps[i]=G->dyn_edge_maps.back;
    1.43 +	    G->dyn_edge_maps.pop_back();
    1.44 +	  }
    1.45  	}
    1.46        }
    1.47 -
    1.48 +      
    1.49        void add(const EdgeIt k) 
    1.50        {
    1.51  	if(k.n>=int(container.size())) container.resize(k.n+1);