lemon/bits/edge_set_extender.h
changeset 2037 32e4bebee616
parent 1999 2ff283124dfc
child 2046 66d160810c0a
equal deleted inserted replaced
3:d2b2bf30584b 4:e2f2ba5c7368
    99       NodeIt() {}
    99       NodeIt() {}
   100 
   100 
   101       NodeIt(Invalid i) : Node(i) { }
   101       NodeIt(Invalid i) : Node(i) { }
   102 
   102 
   103       explicit NodeIt(const Graph& _graph) : graph(&_graph) {
   103       explicit NodeIt(const Graph& _graph) : graph(&_graph) {
   104 	_graph.first(*static_cast<Node*>(this));
   104 	_graph.first(static_cast<Node&>(*this));
   105       }
   105       }
   106 
   106 
   107       NodeIt(const Graph& _graph, const Node& node) 
   107       NodeIt(const Graph& _graph, const Node& node) 
   108 	: Node(node), graph(&_graph) {}
   108 	: Node(node), graph(&_graph) {}
   109 
   109 
   122       EdgeIt() { }
   122       EdgeIt() { }
   123 
   123 
   124       EdgeIt(Invalid i) : Edge(i) { }
   124       EdgeIt(Invalid i) : Edge(i) { }
   125 
   125 
   126       explicit EdgeIt(const Graph& _graph) : graph(&_graph) {
   126       explicit EdgeIt(const Graph& _graph) : graph(&_graph) {
   127 	_graph.first(*static_cast<Edge*>(this));
   127 	_graph.first(static_cast<Edge&>(*this));
   128       }
   128       }
   129 
   129 
   130       EdgeIt(const Graph& _graph, const Edge& e) : 
   130       EdgeIt(const Graph& _graph, const Edge& e) : 
   131 	Edge(e), graph(&_graph) { }
   131 	Edge(e), graph(&_graph) { }
   132 
   132 
   233 	return operator=<EdgeMap>(cmap);
   233 	return operator=<EdgeMap>(cmap);
   234       }
   234       }
   235 
   235 
   236       template <typename CMap>
   236       template <typename CMap>
   237       EdgeMap& operator=(const CMap& cmap) {
   237       EdgeMap& operator=(const CMap& cmap) {
   238 	checkConcept<concept::ReadMap<Edge, _Value>, CMap>();
   238         Parent::operator=(cmap);
   239 	const typename Parent::Graph* graph = Parent::getGraph();
       
   240 	Edge it;
       
   241 	for (graph->first(it); it != INVALID; graph->next(it)) {
       
   242 	  Parent::set(it, cmap[it]);
       
   243 	}
       
   244 	return *this;
   239 	return *this;
   245       }
   240       }
       
   241 
   246     };
   242     };
   247 
   243 
   248 
   244 
   249     // Alteration extension
   245     // Alteration extension
   250 
   246 
   362       NodeIt() {}
   358       NodeIt() {}
   363 
   359 
   364       NodeIt(Invalid i) : Node(i) { }
   360       NodeIt(Invalid i) : Node(i) { }
   365 
   361 
   366       explicit NodeIt(const Graph& _graph) : graph(&_graph) {
   362       explicit NodeIt(const Graph& _graph) : graph(&_graph) {
   367 	_graph.first(*static_cast<Node*>(this));
   363 	_graph.first(static_cast<Node&>(*this));
   368       }
   364       }
   369 
   365 
   370       NodeIt(const Graph& _graph, const Node& node) 
   366       NodeIt(const Graph& _graph, const Node& node) 
   371 	: Node(node), graph(&_graph) {}
   367 	: Node(node), graph(&_graph) {}
   372 
   368 
   385       EdgeIt() { }
   381       EdgeIt() { }
   386 
   382 
   387       EdgeIt(Invalid i) : Edge(i) { }
   383       EdgeIt(Invalid i) : Edge(i) { }
   388 
   384 
   389       explicit EdgeIt(const Graph& _graph) : graph(&_graph) {
   385       explicit EdgeIt(const Graph& _graph) : graph(&_graph) {
   390 	_graph.first(*static_cast<Edge*>(this));
   386 	_graph.first(static_cast<Edge&>(*this));
   391       }
   387       }
   392 
   388 
   393       EdgeIt(const Graph& _graph, const Edge& e) : 
   389       EdgeIt(const Graph& _graph, const Edge& e) : 
   394 	Edge(e), graph(&_graph) { }
   390 	Edge(e), graph(&_graph) { }
   395 
   391 
   456       UEdgeIt() { }
   452       UEdgeIt() { }
   457 
   453 
   458       UEdgeIt(Invalid i) : UEdge(i) { }
   454       UEdgeIt(Invalid i) : UEdge(i) { }
   459 
   455 
   460       explicit UEdgeIt(const Graph& _graph) : graph(&_graph) {
   456       explicit UEdgeIt(const Graph& _graph) : graph(&_graph) {
   461 	_graph.first(*static_cast<UEdge*>(this));
   457 	_graph.first(static_cast<UEdge&>(*this));
   462       }
   458       }
   463 
   459 
   464       UEdgeIt(const Graph& _graph, const UEdge& e) : 
   460       UEdgeIt(const Graph& _graph, const UEdge& e) : 
   465 	UEdge(e), graph(&_graph) { }
   461 	UEdge(e), graph(&_graph) { }
   466 
   462 
   554 	return operator=<EdgeMap>(cmap);
   550 	return operator=<EdgeMap>(cmap);
   555       }
   551       }
   556 
   552 
   557       template <typename CMap>
   553       template <typename CMap>
   558       EdgeMap& operator=(const CMap& cmap) {
   554       EdgeMap& operator=(const CMap& cmap) {
   559 	checkConcept<concept::ReadMap<Edge, _Value>, CMap>();
   555         Parent::operator=(cmap);
   560 	const typename Parent::Graph* graph = Parent::getGraph();
       
   561 	Edge it;
       
   562 	for (graph->first(it); it != INVALID; graph->next(it)) {
       
   563 	  Parent::set(it, cmap[it]);
       
   564 	}
       
   565 	return *this;
   556 	return *this;
   566       }
   557       }
       
   558 
   567     };
   559     };
   568 
   560 
   569 
   561 
   570     template <typename _Value>
   562     template <typename _Value>
   571     class UEdgeMap 
   563     class UEdgeMap 
   574       typedef UEdgeSetExtender Graph;
   566       typedef UEdgeSetExtender Graph;
   575       typedef MapExtender<DefaultMap<Graph, UEdge, _Value> > Parent;
   567       typedef MapExtender<DefaultMap<Graph, UEdge, _Value> > Parent;
   576 
   568 
   577       UEdgeMap(const Graph& _g) 
   569       UEdgeMap(const Graph& _g) 
   578 	: Parent(_g) {}
   570 	: Parent(_g) {}
       
   571 
   579       UEdgeMap(const Graph& _g, const _Value& _v) 
   572       UEdgeMap(const Graph& _g, const _Value& _v) 
   580 	: Parent(_g, _v) {}
   573 	: Parent(_g, _v) {}
   581 
   574 
   582       UEdgeMap& operator=(const UEdgeMap& cmap) {
   575       UEdgeMap& operator=(const UEdgeMap& cmap) {
   583 	return operator=<UEdgeMap>(cmap);
   576 	return operator=<UEdgeMap>(cmap);
   584       }
   577       }
   585 
   578 
   586       template <typename CMap>
   579       template <typename CMap>
   587       UEdgeMap& operator=(const CMap& cmap) {
   580       UEdgeMap& operator=(const CMap& cmap) {
   588 	checkConcept<concept::ReadMap<UEdge, _Value>, CMap>();
   581         Parent::operator=(cmap);
   589 	const typename Parent::Graph* graph = Parent::getGraph();
       
   590 	UEdge it;
       
   591 	for (graph->first(it); it != INVALID; graph->next(it)) {
       
   592 	  Parent::set(it, cmap[it]);
       
   593 	}
       
   594 	return *this;
   582 	return *this;
   595       }
   583       }
       
   584 
   596     };
   585     };
   597 
   586 
   598 
   587 
   599     // Alteration extension
   588     // Alteration extension
   600 
   589