Boost logo

Boost :

From: Helge Jensen (jensen_at_[hidden])
Date: 2002-10-30 17:43:09


adjecency_matrix has a fatal error: the line

   EdgeProxy set_edge_exists(EdgeProxy edge_proxy, bool flag)

is passing by value, instead of reference, so add_edge(...) doesn't work :)

A proposed patch (You may want to remove the "assert" that I inserted to
diagnose the problem:

[jensen_at_ikaros:...boost/boost/graph]$ cvs -z3 diff -u adjacency_matrix.hpp
Index: adjacency_matrix.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/graph/adjacency_matrix.hpp,v
retrieving revision 1.23
diff -u -r1.23 adjacency_matrix.hpp
--- adjacency_matrix.hpp 15 Jan 2002 03:33:26 -0000 1.23
+++ adjacency_matrix.hpp 30 Oct 2002 22:27:33 -0000
@@ -79,7 +79,7 @@
        return edge_proxy;
      }
      template <typename EdgeProxy>
- EdgeProxy set_edge_exists(EdgeProxy edge_proxy, bool flag) {
+ EdgeProxy& set_edge_exists(EdgeProxy& edge_proxy, bool flag) {
        edge_proxy = flag;
        return edge_proxy; // just to avoid never used warning
      }
@@ -104,11 +104,11 @@
        stored_edge.second = ep;
      }

- const no_property& get_property(const char&) {
+ inline const no_property& get_property(const char&) {
        static no_property s_prop;
        return s_prop;
      }
- no_property& get_property(char&) {
+ inline no_property& get_property(char&) {
        static no_property s_prop;
        return s_prop;
      }
@@ -579,6 +579,7 @@
      if (detail::get_edge_exists(g.get_edge(u,v)) == false) {
        detail::set_property(g.get_edge(u,v), ep);
        detail::set_edge_exists(g.get_edge(u,v), true);
+ assert(detail::get_edge_exists(g.get_edge(u,v)));
        return std::make_pair
          (edge_descriptor(true, u, v,
&detail::get_property(g.get_edge(u,v))),
           true);

-- 
Helge

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk