|
Boost Users : |
From: Welson Sun (welson_sun_at_[hidden])
Date: 2005-02-12 20:48:41
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_at_[hidden]
[mailto:boost-users-bounces_at_[hidden]] On Behalf Of Douglas Gregor
Sent: Friday, February 11, 2005 8:49 PM
To: boost-users_at_[hidden]
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_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
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