# HG changeset patch # User alpar # Date 1077454294 0 # Node ID 3d9681ef611664a74d3d1f5c0dda79d61223634a # Parent bb07dd5b2d670cc0d04860819ce4a25b8c33b270 . diff -r bb07dd5b2d67 -r 3d9681ef6116 src/work/alpar/smart_graph.h --- a/src/work/alpar/smart_graph.h Sun Feb 22 12:43:48 2004 +0000 +++ b/src/work/alpar/smart_graph.h Sun Feb 22 12:51:34 2004 +0000 @@ -282,6 +282,7 @@ DynMapBase(_G), container(_G.maxNodeId()) { //FIXME: What if there are empty Id's? + //FIXME: Can I use 'this' in a constructor? G->dyn_node_maps.push_back(this); } ~DynNodeMap() @@ -290,7 +291,12 @@ std::vector* >::iterator i; for(i=G->dyn_node_maps.begin(); i!=G->dyn_node_maps.end() && *i!=this; ++i) ; - if(*i==this) G->dyn_node_maps.erase(i); //FIXME: Way too slow... + //if(*i==this) G->dyn_node_maps.erase(i); //FIXME: Way too slow... + //A better way to do that: (Is this really important?) + if(*i==this) { + G->dyn_node_maps[i]=G->dyn_node_maps.back; + G->dyn_node_maps.pop_back(); + } } } @@ -324,7 +330,7 @@ DynMapBase(_G), container(_G.maxEdgeId()) { //FIXME: What if there are empty Id's? - //FIXME: Can I do that? : + //FIXME: Can I use 'this' in a constructor? G->dyn_edge_maps.push_back(this); } ~DynEdgeMap() @@ -333,10 +339,15 @@ std::vector* >::iterator i; for(i=G->dyn_edge_maps.begin(); i!=G->dyn_edge_maps.end() && *i!=this; ++i) ; - if(*i==this) G->dyn_edge_maps.erase(i); //FIXME: Way too slow... + //if(*i==this) G->dyn_edge_maps.erase(i); //Way too slow... + //A better way to do that: (Is this really important?) + if(*i==this) { + G->dyn_edge_maps[i]=G->dyn_edge_maps.back; + G->dyn_edge_maps.pop_back(); + } } } - + void add(const EdgeIt k) { if(k.n>=int(container.size())) container.resize(k.n+1);