Graph::iterator has been renamed to Graph::vertex_iterator

for/release
Denes Matetelki 12 years ago
parent 4745047b60
commit 056381483d

@ -66,21 +66,21 @@ public:
std::vector<Edge> edges() const; std::vector<Edge> edges() const;
// iterators // iterators
class iterator : public std::iterator<std::forward_iterator_tag, class vertex_iterator : public std::iterator<std::forward_iterator_tag,
value_type, value_type,
difference_type, difference_type,
pointer, pointer,
reference> reference>
{ {
public: public:
typedef iterator self_type; typedef vertex_iterator self_type;
typedef iterator& reference_self_type; typedef vertex_iterator& reference_self_type;
typedef const iterator& const_reference_self_type; typedef const vertex_iterator& const_reference_self_type;
iterator() : m_it() {} vertex_iterator() : m_it() {}
iterator(typename std::vector<Vertex>::iterator it) : m_it(it) {} vertex_iterator(typename std::vector<Vertex>::iterator it) : m_it(it) {}
~iterator() {} ~vertex_iterator() {}
iterator(const_reference_self_type o) : m_it(o.m_it) {} vertex_iterator(const_reference_self_type o) : m_it(o.m_it) {}
reference_self_type operator=(const_reference_self_type o) reference_self_type operator=(const_reference_self_type o)
{ if (this != &o) { m_it = o.m_it; } return *this; } { if (this != &o) { m_it = o.m_it; } return *this; }
@ -98,8 +98,8 @@ public:
typename std::vector<Vertex>::iterator m_it; typename std::vector<Vertex>::iterator m_it;
}; };
iterator begin() { return iterator(m_vertices.begin()); } vertex_iterator begin() { return vertex_iterator(m_vertices.begin()); }
iterator end() { return iterator(m_vertices.begin()); } vertex_iterator end() { return vertex_iterator(m_vertices.begin()); }
private: private:

@ -61,7 +61,7 @@ int main()
g.addVertex(c); g.addVertex(c);
int vertices_array[] = {2, 5, 13, 1}; int vertices_array[] = {2, 5, 13, 1};
std::vector<int> v(vertices_array, vertices_array + sizeof(vertices_array) / sizeof(int) ); std::vector<int> v(vertices_array, vertices_array + sizeof(vertices_array) / sizeof(int) );
Graph<int>::iterator g_it; Graph<int>::vertex_iterator g_it;
std::vector<int>::iterator v_it; std::vector<int>::iterator v_it;
for (g_it = g.begin(), v_it = v.begin(); for (g_it = g.begin(), v_it = v.begin();
g_it != g.end(); g_it != g.end();

Loading…
Cancel
Save