Thanks, you are right. Now both the vertex property writer and edge property writer works. But I don't understand why "reference" will cause this problem? Isn't it just an alias of an object? -----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Douglas Gregor Sent: Friday, February 11, 2005 8:49 PM To: boost-users@lists.boost.org Subject: Re: [Boost-users] BGL problem,originally [Another C++inheritence/polymorphism problem] On Feb 11, 2005, at 6:00 PM, Welson Sun wrote:
template <typename Vertex> void operator()(std::ostream& out, Vertex& v) { out << "[label=\"" << g[v].toString() << "\"]"; [snip] template <typename Edge> void operator()(std::ostream& out, Edge& v) { out << "[label=\"" << "E" << "\"]"; }
I think it's a problem with the reference... typically, you just accept vertex and edge descriptors by-value (not by-reference), because they're small and cheap to copy. So the second operator() would start with: template<typename Edge> void operator()(std::ostream& out, Edge v) { Doug _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users