|
Boost Users : |
Subject: Re: [Boost-users] [BGL] problem about copy graph
From: Li Ning (Ning.c.Li_at_[hidden])
Date: 2009-06-08 06:12:16
Li Ning wrote:
>
> typedef adjacency_list<vecS, vecS, undirectedS, no_property, edge_ex>
> graph_t;
>
> typedef graph_traits<graph_t>::vertex_descriptor vertex_t;
> typedef graph_traits<graph_t>::edge_descriptor edge_t;
>
> struct edge_ex
> {
> //int index;
> bw_t az_capacity;
> bw_t za_capacity;
> int cost;
> vertex_t fake_source;
> };
> // init a graph g and assign edge_ex values, and get a std::pair<edge_t,
> bool> r when add_edge(5,6,g);
> graph_t g2 = g;
> std::pair<edge_t, bool> rr = edge(5,6,g2);
> g2[rr.first].cost = 1000;
>
> std::cout<<g[r.first].cost<<" "<<g2[r.first].cost<<" "<<g2[rr.first];
>
> //output is: old_value old_value 1000
>
> WHY??
> It seems a bug, g2[r.first] should be 1000 rather than the value assign to
> g even r.first is a descriptor that belongs to g
> OK, this is problematic usage, but... g2[r.first] works, it doesn't make
> sense.
>
Sorry, should be
std::cout<<g[r.first].cost<<" "<<g2[r.first].cost<<" "<<g2[rr.first].cost;
-- View this message in context: http://www.nabble.com/-BGL--problem-about-copy-graph-tp23921384p23921431.html Sent from the Boost - Users mailing list archive at Nabble.com.
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