Boost logo

Boost Users :

Subject: Re: [Boost-users] How to access a GRAPH property? - simple
From: Caligula (caligulaemperorofrome_at_[hidden])
Date: 2010-08-15 03:07:17


Thanks Cedric & Jeremiah, I tried a bunch of stuff template < typename Graph > void test_graph_property( Graph & g ) { //get_property(graph_properties, bobo); //g[graph_properties].bobo; //g[graph_bundle].bobo; //g[bobo]; //get(bobo,g); //get(g, graph_properties); //cout << g[g].bobo << endl; //get_property(g.graph_properties, bobo); get_property(g, bobo); } But nothing works. For "get_property(g, bobo);" I get In function ‘void test_graph_property(Graph&)’: error: ‘bobo’ was not declared in this scope The doc pages you refered me to only mention property_maps, as far as I can tell. Maybe I need to declare a property_map such as property_map < graph_t, int >::type capacity = get(bobo, g); I would hope that I could avoid this using bundled properties. Thanks ________________________________ From: Jeremiah Willcock <jewillco_at_[hidden]> To: boost-users_at_[hidden] Sent: Sat, August 14, 2010 12:05:25 PM Subject: Re: [Boost-users] How to access a GRAPH property? - simple On Fri, 13 Aug 2010, Mike Douglass wrote: > I have > > struct vertex_properties > { > blah blah > } > > struct edge_properties > { > blah blah > } > > struct graph_properties > { > > int bobo; > > } > > > typedef adjacency_list < vecS, vecS, bidirectionalS, > property< vertex_predecessor_t, vertex_t, vertex_properties >, > property< edge_reverse_t, edge_t, edge_properties >, > graph_properties > > graph_t; > > graph_t g; > > But how can I access bobo? > > g.bobo; does not compile (otherwise compiles OK). To get the graph property, you can use the get_property() function, documented at http://www.boost.org/doc/libs/1_43_0/libs/graph/doc/adjacency_list.html> (near the bottom). Bundled graph properties are new (just added to the trunk in the past few weeks); I believe the syntax for those is "g[graph_bundle].bobo". -- Jeremiah Willcock



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