On Nov 23, 2004, at 10:56 PM, TC MA wrote:
// create a tag for our new property
enum vertex_first_name_t { vertex_first_name }; namespace boost { BOOST_INSTALL_PROPERTY(vertex, first_name); }
You won't actually need the part above this any more.
struct vertexStruct { string name; };
template
void who_owes_who(EdgeIter first, EdgeIter last, const Graph& G) { // Access the propety acessor type for this graph typedef typename property_map ::const_type NamePA;
The compiler is actually giving a somewhat useful message here: add an '&' before the vertexStruct::name to form a pointer-to-member.
NamePA name = get(vertex_first_name, G);
Here again, you'll want to use a pointer-to-member, like this: NamePA name = get(&vertexStruct, G);
typedef typename boost::property_traits<NamePA>::value_type NameType;
NameType src_name, targ_name;
while (first != last) { src_name = boost::get(name, source(*first,G)); targ_name = boost::get(name, target(*first,G));
Now you can use the simpler: src_name = G[source(*first, G)].name; targ_name = G[target(*first, G)].name; Once you've replaced the original get calls with these lines, you can remove the definition of the "name" variable as well. Doug