Boost logo

Boost Users :

Subject: [Boost-users] BGL: Get a bundled property for a particular edge_descriptor
From: David Doria (daviddoria_at_[hidden])
Date: 2011-06-22 16:32:54


Consider this setup:

struct MyProperty
{
  int MyIntProperty;
};

typedef adjacency_list<vecS, vecS, undirectedS, MyProperty, MyProperty> Graph;

Graph g;

Graph::vertex_descriptor v0 = add_vertex(g);
Graph::vertex_descriptor v1 = add_vertex(g);
Graph::vertex_descriptor v2 = add_vertex(g);

std::pair<Graph::edge_descriptor, bool> e01 = add_edge(v0, v1, g);

Now I want to get the bundled propery corresponding to e01. I tried this:

property_map<Graph, int MyProperty::*>::type MyIntPropertyMap =
get(&MyProperty::MyIntProperty, g);
cout << MyIntPropertyMap[e01.first];

but the compiler complains about no matching operator[].

Any suggestions? I thought I had examples of all of these simple
things, but I guess I'm missing at least one :)

David


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