Hi,
I am trying to use the BGL to model a simple directed graph with
internal edge properties. Following the example given in the
documentation[1], I have done the following (with question-irrelevant
padding removed):
-------------------------------
#include
#include
typedef boost::property EdgeProperties;
typedef boost::adjacency_list NetworkGraph;
typedef std::pair Edge;
NetworkGraph g(5);
boost::add_edge(0, 1, g);
boost::add_edge(0, 2, g);
boost::add_edge(1, 3, g);
boost::add_edge(2, 3, g);
boost::add_edge(3, 4, g);
boost::property_map::type weights
= boost::get(boost::edge_weight_t(), g);
weights[0] = 1.0;
weights[1] = 1.0;
weights[2] = 1.0;
weights[3] = 1.0;
weights[4] = 1.0;
-------------------------------
Which all looks fairly kosher. However, attempting to compile this
results in a error on each of the weights assignment lines:
"error: no match for 'operator[]' in 'weights[0]'
Using the syntax boost::put(weights, 0, 1.0) just moves this error
inside a parameter_set template definition. Can anybody shed any light
on this? For the record this is on MacOS X 10.5.1, with GCC 4.0.1
(i686-apple-darwin9-gcc-4.0.1).
Regards,
James Jackson.
[1] interior_property_map.cpp