| 84 | |
| 85 | /** Iterate through the out-edges. */ |
| 86 | class out_edge_iterator |
| 87 | : public std::iterator<std::input_iterator_tag, edge_descriptor> |
| 88 | { |
| 89 | typedef typename Edges::const_iterator const_iterator; |
| 90 | |
| 91 | public: |
| 92 | out_edge_iterator() { } |
| 93 | out_edge_iterator(const const_iterator& it, |
| 94 | vertex_descriptor src) : m_it(it), m_src(src) { } |
| 95 | |
| 96 | edge_descriptor operator *() const |
| 97 | { |
| 98 | return edge_descriptor(m_src, m_it->target()); |
| 99 | } |
| 100 | |
| 101 | bool operator ==(const out_edge_iterator& it) const |
| 102 | { |
| 103 | return m_it == it.m_it; |
| 104 | } |
| 105 | |
| 106 | bool operator !=(const out_edge_iterator& it) const |
| 107 | { |
| 108 | return m_it != it.m_it; |
| 109 | } |
| 110 | |
| 111 | out_edge_iterator& operator ++() { ++m_it; return *this; } |
| 112 | out_edge_iterator operator ++(int) |
| 113 | { |
| 114 | out_edge_iterator it = *this; |
| 115 | ++*this; |
| 116 | return it; |
| 117 | } |
| 118 | |
| 119 | const edge_property_type& get_property() const |
| 120 | { |
| 121 | return m_it->get_property(); |
| 122 | } |
| 123 | |
| 124 | private: |
| 125 | const_iterator m_it; |
| 126 | vertex_descriptor m_src; |
| 127 | }; |
| 128 | |
| 129 | /** Iterate through adjacent vertices. */ |
| 130 | class adjacency_iterator : public Edges::const_iterator |