Boost logo

Boost :

From: Jeremy Siek (jsiek_at_[hidden])
Date: 2002-11-05 12:49:12


Hi Helge,

Thanks for the patch! I've checked in your changes (minus the assert).

Cheers,
Jeremy

On Wed, 30 Oct 2002, Helge Jensen wrote:

jensen> adjecency_matrix has a fatal error: the line
jensen>
jensen> EdgeProxy set_edge_exists(EdgeProxy edge_proxy, bool flag)
jensen>
jensen> is passing by value, instead of reference, so add_edge(...) doesn't work :)
jensen>
jensen> A proposed patch (You may want to remove the "assert" that I inserted to
jensen> diagnose the problem:
jensen>
jensen> [jensen_at_ikaros:...boost/boost/graph]$ cvs -z3 diff -u adjacency_matrix.hpp
jensen> Index: adjacency_matrix.hpp
jensen> ===================================================================
jensen> RCS file: /cvsroot/boost/boost/boost/graph/adjacency_matrix.hpp,v
jensen> retrieving revision 1.23
jensen> diff -u -r1.23 adjacency_matrix.hpp
jensen> --- adjacency_matrix.hpp 15 Jan 2002 03:33:26 -0000 1.23
jensen> +++ adjacency_matrix.hpp 30 Oct 2002 22:27:33 -0000
jensen> @@ -79,7 +79,7 @@
jensen> return edge_proxy;
jensen> }
jensen> template <typename EdgeProxy>
jensen> - EdgeProxy set_edge_exists(EdgeProxy edge_proxy, bool flag) {
jensen> + EdgeProxy& set_edge_exists(EdgeProxy& edge_proxy, bool flag) {
jensen> edge_proxy = flag;
jensen> return edge_proxy; // just to avoid never used warning
jensen> }
jensen> @@ -104,11 +104,11 @@
jensen> stored_edge.second = ep;
jensen> }
jensen>
jensen> - const no_property& get_property(const char&) {
jensen> + inline const no_property& get_property(const char&) {
jensen> static no_property s_prop;
jensen> return s_prop;
jensen> }
jensen> - no_property& get_property(char&) {
jensen> + inline no_property& get_property(char&) {
jensen> static no_property s_prop;
jensen> return s_prop;
jensen> }
jensen> @@ -579,6 +579,7 @@
jensen> if (detail::get_edge_exists(g.get_edge(u,v)) == false) {
jensen> detail::set_property(g.get_edge(u,v), ep);
jensen> detail::set_edge_exists(g.get_edge(u,v), true);
jensen> + assert(detail::get_edge_exists(g.get_edge(u,v)));
jensen> return std::make_pair
jensen> (edge_descriptor(true, u, v,
jensen> &detail::get_property(g.get_edge(u,v))),
jensen> true);
jensen>
jensen> --
jensen> Helge
jensen>
jensen> _______________________________________________
jensen> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
jensen>

----------------------------------------------------------------------
 Jeremy Siek http://php.indiana.edu/~jsiek/
 Ph.D. Student, Indiana Univ. B'ton email: jsiek_at_[hidden]
 C++ Booster (http://www.boost.org) office phone: (812) 855-3608
----------------------------------------------------------------------


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