[Lemon-commits] [lemon_svn] klao: r1320 - hugo/branches/graph_factory/src/lemon

Lemon SVN svn at lemon.cs.elte.hu
Mon Nov 6 20:44:35 CET 2006


Author: klao
Date: Wed Oct 27 16:52:42 2004
New Revision: 1320

Modified:
   hugo/branches/graph_factory/src/lemon/iterable_graph_extender.h

Log:
Minor changes to iteratable_graph_extender.
 * Safety fence around the first(...) methods.


Modified: hugo/branches/graph_factory/src/lemon/iterable_graph_extender.h
==============================================================================
--- hugo/branches/graph_factory/src/lemon/iterable_graph_extender.h	(original)
+++ hugo/branches/graph_factory/src/lemon/iterable_graph_extender.h	Wed Oct 27 16:52:42 2004
@@ -14,8 +14,6 @@
 
   public:
 
-    IterableGraphExtender() {}
-
     typedef typename Parent::Node Node;
     typedef typename Parent::Edge Edge;
 
@@ -29,7 +27,7 @@
       NodeIt(Invalid i) : Node(i) { }
 
       NodeIt(const Graph& _graph) : Node(), graph(&_graph) {
-	graph->first(*this);
+	_graph.first(*static_cast<Node*>(this));
       }
 
       NodeIt(const Graph& _graph, const Node& node) 
@@ -42,10 +40,9 @@
 
     };
 
-    class EdgeIt : public Edge { 
 
+    class EdgeIt : public Edge { 
       const Graph* graph;
-
     public:
 
       EdgeIt() { }
@@ -53,7 +50,7 @@
       EdgeIt(Invalid i) : Edge(i) { }
 
       EdgeIt(const Graph& _graph) : Edge(), graph(&_graph) {
-	graph->first(*this);
+	_graph.first(*static_cast<Edge*>(this));
       }
 
       EdgeIt(const Graph& _graph, const Edge& e) : 
@@ -66,10 +63,9 @@
 
     };
 
-    class OutEdgeIt : public Edge { 
 
+    class OutEdgeIt : public Edge { 
       const Graph* graph;
-
     public:
 
       OutEdgeIt() { }
@@ -78,7 +74,7 @@
 
       OutEdgeIt(const Graph& _graph, const Node& node) 
 	: Edge(), graph(&_graph) {
-	graph->firstOut(*this, node);
+	_graph.firstOut(*this, node);
       }
 
       OutEdgeIt(const Graph& _graph, const Edge& edge) 
@@ -91,10 +87,9 @@
 
     };
 
-    class InEdgeIt : public Edge { 
 
+    class InEdgeIt : public Edge { 
       const Graph* graph;
-
     public:
 
       InEdgeIt() { }
@@ -103,7 +98,7 @@
 
       InEdgeIt(const Graph& _graph, const Node& node) 
 	: Edge(), graph(&_graph) {
-	graph->firstIn(*this, node);
+	_graph.firstIn(*this, node);
       }
 
       InEdgeIt(const Graph& _graph, const Edge& edge) : 
@@ -115,8 +110,20 @@
       }
 
     };
-   
-    
+
+    using Parent::first;
+
+  private:
+
+    /// \todo When (and if) we change the iterators concept to use operator*,
+    /// then the following shadowed methods will become superfluous.
+    /// But for now these are important safety measures.
+
+    void first(NodeIt &) const;
+    void first(EdgeIt &) const;
+    void first(OutEdgeIt &) const;
+    void first(InEdgeIt &) const;
+
   };
   
 }



More information about the Lemon-commits mailing list