Boost logo

Boost Users :

From: Welson Sun (welson_sun_at_[hidden])
Date: 2005-02-16 16:24:37


Well, it turns out that I made a small mistake:
 
//Class template of a vertex/edge property writer
template < typename Graph >
class property_writer {
public:
  property_writer(Graph _g) : g(_g) {}
                       
  template <typename Vertex_or_Edge>
  void operator()(std::ostream& out, const Vertex_or_Edge& v) {
    out << "[label=\""
        << g[v].toString()
        << "\"]";
  }
private:
  Graph& g;
};

Changing the argument of property_writer from "Graph _g" to be "Graph& _g"
solves this.
 
I started the property writer from the example in BGL documenation:
boost_1_32_0/libs/graph/doc/write-graphviz.html, so I suggest changing this
doc to be more efficient.

  _____

From: boost-users-bounces_at_[hidden]
[mailto:boost-users-bounces_at_[hidden]] On Behalf Of Welson Sun
Sent: Wednesday, February 16, 2005 1:43 PM
To: boost-users_at_[hidden]
Subject: [Boost-users] Program runs OK in Cygwin,but got "Segment Fault" in
Linux

Hi,
 
The program is really simple, it creates a graph and output to a .dot file
using the graphviz library in the BGL. It runs well in Cygwin, but in Linux,
it got a segment fault when outputing the vertex id.
 
Can you C++ gurus see what is going on? Thanks!
 
 
Welson



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net