|
Boost : |
From: Wang Weiwei (wwwang_at_[hidden])
Date: 2006-07-12 09:51:02
Hello,
I'm constructing an undirected graph using the following graph, but the last line failed to compile.
I'm using two property maps to associate a char type and a std::string type of properties to the
vertices and edges of the graph, respectively.
std::map<elem_id_t, char> vmap;
std::map<edge_id_t, std::string> emap;
typedef boost::associative_property_map< std::map<elem_id_t, char> > vpmap_t;
typedef boost::associative_property_map< std::map<edge_id_t, std::string> > epmap_t;
vpmap_t vpmap(vmap);
epmap_t epmap(emap);
typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, vpmap_t, epmap_t> graph_t;
typedef boost::graph_traits<graph_t>::vertex_descriptor vertex_descriptor;
typedef boost::graph_traits<graph_t>::edge_descriptor edge_descriptor;
graph_t g;
vertex_descriptor v[5];
v[0] = add_vertex(g); put(vpmap, v[0], '0');
//vpmap[v[0]] = '0'; // this line also does not work
v[1] = add_vertex(g); put(vpmap, v[1], '1');
v[2] = add_vertex(g); put(vpmap, v[2], '2');
v[3] = add_vertex(g); put(vpmap, v[3], '3');
v[4] = add_vertex(g); put(vpmap, v[4], '4');
edge_descriptor e;
bool inserted;
boost::tie(e, inserted) = add_edge(v[0], v[1], g);
// this line failed to be compiled
put(epmap, e, std::string("01"));
What's wrong? Any help will be appriciated.
min2max
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk