Boost logo

Boost-Commit :

From: asutton_at_[hidden]
Date: 2008-05-30 08:19:44


Author: asutton
Date: 2008-05-30 08:19:43 EDT (Fri, 30 May 2008)
New Revision: 45940
URL: http://svn.boost.org/trac/boost/changeset/45940

Log:
Renamed value iterator to simple iterator and propagated changes.

Added:
   sandbox/SOC/2008/graphs/boost/graphs/adjacency_list/es/simple_edge_iterator.hpp
      - copied, changed from r45935, /sandbox/SOC/2008/graphs/boost/graphs/adjacency_list/es/value_edge_iterator.hpp
Removed:
   sandbox/SOC/2008/graphs/boost/graphs/adjacency_list/es/value_edge_iterator.hpp
Text files modified:
   sandbox/SOC/2008/graphs/boost/graphs/adjacency_list/es/edge_list.hpp | 4
   sandbox/SOC/2008/graphs/boost/graphs/adjacency_list/es/edge_set.hpp | 4
   sandbox/SOC/2008/graphs/boost/graphs/adjacency_list/es/simple_edge_iterator.hpp | 102 +++++++++++++++++++++++++++++----------
   3 files changed, 80 insertions(+), 30 deletions(-)

Modified: sandbox/SOC/2008/graphs/boost/graphs/adjacency_list/es/edge_list.hpp
==============================================================================
--- sandbox/SOC/2008/graphs/boost/graphs/adjacency_list/es/edge_list.hpp (original)
+++ sandbox/SOC/2008/graphs/boost/graphs/adjacency_list/es/edge_list.hpp 2008-05-30 08:19:43 EDT (Fri, 30 May 2008)
@@ -4,7 +4,7 @@
 
 #include <list>
 
-#include <boost/graphs/adjacency_list/es/value_edge_iterator.hpp>
+#include <boost/graphs/adjacency_list/es/simple_edge_iterator.hpp>
 
 namespace boost {
 namespace graphs {
@@ -57,7 +57,7 @@
     typedef typename edge_type::properties_type edge_properties;
 
     typedef std::list<edge_type, Alloc<edge_type> > edge_store;
- typedef value_edge_iterator<edge_store> edge_iterator;
+ typedef simple_edge_iterator<edge_store> edge_iterator;
     typedef typename edge_store::size_type edges_size_type;
 
     // FIXME:

Modified: sandbox/SOC/2008/graphs/boost/graphs/adjacency_list/es/edge_set.hpp
==============================================================================
--- sandbox/SOC/2008/graphs/boost/graphs/adjacency_list/es/edge_set.hpp (original)
+++ sandbox/SOC/2008/graphs/boost/graphs/adjacency_list/es/edge_set.hpp 2008-05-30 08:19:43 EDT (Fri, 30 May 2008)
@@ -4,7 +4,7 @@
 
 #include <set>
 
-#include <boost/graphs/adjacency_list/es/value_edge_iterator.hpp>
+#include <boost/graphs/adjacency_list/es/simple_edge_iterator.hpp>
 
 namespace boost {
 namespace graphs {
@@ -66,7 +66,7 @@
     typedef typename edge_type::vertex_descriptor vertex_descriptor;
 
     typedef std::set<edge_type, Compare<edge_type>, Alloc<edge_type> > edge_store;
- typedef value_edge_iterator<edge_store> edge_iterator;
+ typedef simple_edge_iterator<edge_store> edge_iterator;
     typedef typename edge_store::size_type edges_size_type;
 
     // FIXME:

Copied: sandbox/SOC/2008/graphs/boost/graphs/adjacency_list/es/simple_edge_iterator.hpp (from r45935, /sandbox/SOC/2008/graphs/boost/graphs/adjacency_list/es/value_edge_iterator.hpp)
==============================================================================
--- /sandbox/SOC/2008/graphs/boost/graphs/adjacency_list/es/value_edge_iterator.hpp (original)
+++ sandbox/SOC/2008/graphs/boost/graphs/adjacency_list/es/simple_edge_iterator.hpp 2008-05-30 08:19:43 EDT (Fri, 30 May 2008)
@@ -1,6 +1,6 @@
 
-#ifndef BOOST_GRAPHS_ADJACENCY_LIST_VALUE_EDGE_ITERATOR_HPP
-#define BOOST_GRAPHS_ADJACENCY_LIST_VALUE_EDGE_ITERATOR_HPP
+#ifndef BOOST_GRAPHS_ADJACENCY_LIST_SIMPLE_EDGE_ITERATOR_HPP
+#define BOOST_GRAPHS_ADJACENCY_LIST_SIMPLE_EDGE_ITERATOR_HPP
 
 namespace boost {
 namespace graphs {
@@ -10,49 +10,99 @@
  * The value edge iterator provides a edge iterator unique associative
  * containers and sequences that don't invalidate memory on insertions
  * (lists).
+ *
+ * By virtue of the fact that the underlying store is not a vector, this
+ * iterator is bidirectional but not random access.
  */
 template <typename Store>
-class value_edge_iterator
+class simple_edge_iterator
 {
     typedef typename Store::const_iterator iterator;
 public:
     typedef typename Store::value_type edge_type;
     typedef typename edge_type::descriptor_type edge_descriptor;
 
+ typedef typename iterator::iterator_category iterator_category;
+ typedef typename iterator::difference_type difference_type;
     typedef edge_descriptor value_type;
     typedef edge_descriptor reference;
     typedef edge_descriptor pointer;
 
- value_edge_iterator()
- : iter()
- { }
-
- value_edge_iterator(value_edge_iterator const& x)
- : iter(x.iter)
- { }
-
- value_edge_iterator(iterator const& x)
- : iter(x)
- { }
-
- value_edge_iterator& operator++()
- {
- ++iter;
- return *this;
- }
+ inline simple_edge_iterator();
+ inline simple_edge_iterator(simple_edge_iterator const& x);
+ inline simple_edge_iterator(iterator const& x);
 
- reference operator*()
- { return &const_cast<edge_type&>(*iter); }
+ inline simple_edge_iterator& operator=(simple_edge_iterator const& x);
+ inline simple_edge_iterator& operator++();
+ inline simple_edge_iterator& operator--();
 
- bool operator==(value_edge_iterator const& x) const
- { return iter == x.iter; }
+ inline reference operator*();
 
- bool operator!=(value_edge_iterator const& x) const
- { return iter != x.iter; }
+ inline bool operator==(simple_edge_iterator const& x) const;
+ inline bool operator!=(simple_edge_iterator const& x) const;
 
+private:
     iterator iter;
 };
 
+template <typename S>
+simple_edge_iterator<S>::simple_edge_iterator()
+ : iter()
+{ }
+
+template <typename S>
+simple_edge_iterator<S>::simple_edge_iterator(simple_edge_iterator const& x)
+ : iter(x.iter)
+{ }
+
+template <typename S>
+simple_edge_iterator<S>::simple_edge_iterator(iterator const& x)
+ : iter(x)
+{ }
+
+template <typename S>
+simple_edge_iterator<S>&
+simple_edge_iterator<S>::operator=(simple_edge_iterator<S> const& x)
+{
+ iter = x.iter;
+ return *this;
+}
+
+template <typename S>
+simple_edge_iterator<S>&
+simple_edge_iterator<S>::operator++()
+{
+ ++iter;
+ return *this;
+}
+
+template <typename S>
+simple_edge_iterator<S>&
+simple_edge_iterator<S>::operator--()
+{
+ --iter;
+ return *this;
+}
+
+template <typename S>
+typename simple_edge_iterator<S>::reference
+simple_edge_iterator<S>::operator*()
+{
+ return &const_cast<edge_type&>(*iter);
+}
+
+template <typename S>
+bool
+simple_edge_iterator<S>::operator==(simple_edge_iterator const& x) const
+{ return iter == x.iter; }
+
+template <typename S>
+bool
+simple_edge_iterator<S>::operator!=(simple_edge_iterator const& x) const
+{
+ return iter != x.iter;
+}
+
 } /* namespace adj_list */
 } /* namespace graphs */
 } /* namespace boost */

Deleted: sandbox/SOC/2008/graphs/boost/graphs/adjacency_list/es/value_edge_iterator.hpp
==============================================================================
--- sandbox/SOC/2008/graphs/boost/graphs/adjacency_list/es/value_edge_iterator.hpp 2008-05-30 08:19:43 EDT (Fri, 30 May 2008)
+++ (empty file)
@@ -1,60 +0,0 @@
-
-#ifndef BOOST_GRAPHS_ADJACENCY_LIST_VALUE_EDGE_ITERATOR_HPP
-#define BOOST_GRAPHS_ADJACENCY_LIST_VALUE_EDGE_ITERATOR_HPP
-
-namespace boost {
-namespace graphs {
-namespace adj_list {
-
-/**
- * The value edge iterator provides a edge iterator unique associative
- * containers and sequences that don't invalidate memory on insertions
- * (lists).
- */
-template <typename Store>
-class value_edge_iterator
-{
- typedef typename Store::const_iterator iterator;
-public:
- typedef typename Store::value_type edge_type;
- typedef typename edge_type::descriptor_type edge_descriptor;
-
- typedef edge_descriptor value_type;
- typedef edge_descriptor reference;
- typedef edge_descriptor pointer;
-
- value_edge_iterator()
- : iter()
- { }
-
- value_edge_iterator(value_edge_iterator const& x)
- : iter(x.iter)
- { }
-
- value_edge_iterator(iterator const& x)
- : iter(x)
- { }
-
- value_edge_iterator& operator++()
- {
- ++iter;
- return *this;
- }
-
- reference operator*()
- { return &const_cast<edge_type&>(*iter); }
-
- bool operator==(value_edge_iterator const& x) const
- { return iter == x.iter; }
-
- bool operator!=(value_edge_iterator const& x) const
- { return iter != x.iter; }
-
- iterator iter;
-};
-
-} /* namespace adj_list */
-} /* namespace graphs */
-} /* namespace boost */
-
-#endif


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk