1.1 --- a/src/lemon/concept/graph_component.h Mon Nov 22 17:50:26 2004 +0000
1.2 +++ b/src/lemon/concept/graph_component.h Thu Nov 25 14:48:24 2004 +0000
1.3 @@ -505,62 +505,66 @@
1.4 /// base class, the _selector is a additional template parameter. For
1.5 /// InEdgeIt you should instantiate it with character 'i' and for
1.6 /// OutEdgeIt with 'o'.
1.7 - /// \todo check the name of the concept GraphIncEdgeIterator
1.8 - template <typename _Graph, char _selector>
1.9 - class GraphIncEdgeIterator : public _Graph::Edge {
1.10 + /// \todo Is this a good name for this concept?
1.11 + template <typename Graph,
1.12 + typename Edge = typename Graph::Edge,
1.13 + char _selector = '0'>
1.14 + class GraphIncIterator : public Edge {
1.15 public:
1.16 /// Default constructor.
1.17
1.18 /// @warning The default constructor sets the iterator
1.19 /// to an undefined value.
1.20 - GraphIncEdgeIterator() {}
1.21 + GraphIncIterator() {}
1.22 /// Copy constructor.
1.23
1.24 /// Copy constructor.
1.25 ///
1.26 - GraphIncEdgeIterator(GraphIncEdgeIterator const&) {}
1.27 + GraphIncIterator(GraphIncIterator const&) {}
1.28 /// Sets the iterator to the first edge incoming into or outgoing from the node.
1.29
1.30 /// Sets the iterator to the first edge incoming into or outgoing from the node.
1.31 ///
1.32 - explicit GraphIncEdgeIterator(const _Graph&, const typename _Graph::Node&) {}
1.33 + explicit GraphIncIterator(const Graph&, const typename Graph::Node&) {}
1.34 /// Invalid constructor \& conversion.
1.35
1.36 /// This constructor initializes the item to be invalid.
1.37 /// \sa Invalid for more details.
1.38 - GraphIncEdgeIterator(Invalid) {}
1.39 + GraphIncIterator(Invalid) {}
1.40 /// Assign operator for nodes.
1.41
1.42 /// The nodes are assignable.
1.43 ///
1.44 - GraphIncEdgeIterator& operator=(GraphIncEdgeIterator const&) { return *this; }
1.45 + GraphIncIterator& operator=(GraphIncIterator const&) { return *this; }
1.46 /// Next edge.
1.47
1.48 /// Assign the iterator to the next node.
1.49 ///
1.50 - GraphIncEdgeIterator& operator++() { return *this; }
1.51 + GraphIncIterator& operator++() { return *this; }
1.52 +
1.53 // Node operator*() const { return INVALID; }
1.54 +
1.55 /// Equality operator
1.56
1.57 /// Two iterators are equal if and only if they point to the
1.58 /// same object or both are invalid.
1.59 - bool operator==(const GraphIncEdgeIterator&) const { return true;}
1.60 + bool operator==(const GraphIncIterator&) const { return true;}
1.61 +
1.62 /// Inequality operator
1.63
1.64 /// \sa operator==(Node n)
1.65 ///
1.66 - bool operator!=(const GraphIncEdgeIterator&) const { return true;}
1.67 + bool operator!=(const GraphIncIterator&) const { return true;}
1.68
1.69 - template <typename _GraphIncEdgeIterator>
1.70 + template <typename _GraphIncIterator>
1.71 struct Constraints {
1.72 - typedef typename _Graph::Node Node;
1.73 - typedef typename _Graph::Edge Edge;
1.74 + typedef typename Graph::Node Node;
1.75 void constraints() {
1.76 - checkConcept<GraphItem<'e'>, _GraphIncEdgeIterator>();
1.77 - _GraphIncEdgeIterator it1(graph, node);
1.78 + checkConcept<GraphItem<'e'>, _GraphIncIterator>();
1.79 + _GraphIncIterator it1(graph, node);
1.80 /// \todo Do we need OutEdgeIt(Edge) kind of constructor?
1.81 - // _GraphIncEdgeIterator it2(edge);
1.82 - _GraphIncEdgeIterator it2;
1.83 + // _GraphIncIterator it2(edge);
1.84 + _GraphIncIterator it2;
1.85
1.86 it2 = ++it1;
1.87 ++it2 = it1;
1.88 @@ -571,9 +575,11 @@
1.89
1.90 Edge& edge;
1.91 Node& node;
1.92 - _Graph& graph;
1.93 + Graph& graph;
1.94 };
1.95 };
1.96 +
1.97 +
1.98 /// An empty iterable base graph class.
1.99
1.100 /// This class provides beside the core graph features
1.101 @@ -602,12 +608,12 @@
1.102
1.103 /// This iterator goes trough the \e inccoming edges of a certain node
1.104 /// of a graph.
1.105 - typedef GraphIncEdgeIterator<Graph, 'i'> InEdgeIt;
1.106 + typedef GraphIncIterator<Graph, Edge, 'i'> InEdgeIt;
1.107 /// This iterator goes trough the outgoing edges of a node.
1.108
1.109 /// This iterator goes trough the \e outgoing edges of a certain node
1.110 /// of a graph.
1.111 - typedef GraphIncEdgeIterator<Graph, 'o'> OutEdgeIt;
1.112 + typedef GraphIncIterator<Graph, Edge, 'o'> OutEdgeIt;
1.113 };
1.114
1.115 template <typename _Graph>
1.116 @@ -617,8 +623,8 @@
1.117
1.118 checkConcept<GraphIterator<_Graph, typename _Graph::Edge>, typename _Graph::EdgeIt >();
1.119 checkConcept<GraphIterator<_Graph, typename _Graph::Node>, typename _Graph::NodeIt >();
1.120 - checkConcept<GraphIncEdgeIterator<_Graph, 'i'>, typename _Graph::InEdgeIt >();
1.121 - checkConcept<GraphIncEdgeIterator<_Graph, 'o'>, typename _Graph::OutEdgeIt >();
1.122 + checkConcept<GraphIncIterator<_Graph>, typename _Graph::InEdgeIt >();
1.123 + checkConcept<GraphIncIterator<_Graph>, typename _Graph::OutEdgeIt >();
1.124 }
1.125 };
1.126