[BGL] possible Bug in property handling

Hi,
I'm new to BGL (and generic programming) so this may well not be a bug
but I don't know how this could be intended. Consider the following
program:
#include <string>
#include <iostream>
#include

typedef property
VertexProp; //this crashes typedef adjacency_list < vecS, vecS, undirectedS,VertexProp, no_property > graph_t; //this doesn't //typedef adjacency_list < vecS, listS, undirectedS,VertexProp, no_property graph_t; typedef graph_traits < graph_t >::vertex_descriptor vertex_descriptor; typedef property_map
::type id_name_map_t; typedef graph_traits ::vertex_iterator vi_t; std::pair vi;
Try writing this using bundled properties: http://www.boost.org/doc/libs/1_39_0/libs/graph/doc/bundles.html Andrew Sutton andrew.n.sutton@gmail.com

Andrew Sutton wrote:
typedef property
VertexProp; //this crashes typedef adjacency_list < vecS, vecS, undirectedS,VertexProp, no_property > graph_t; //this doesn't //typedef adjacency_list < vecS, listS, undirectedS,VertexProp, no_property graph_t; typedef graph_traits < graph_t >::vertex_descriptor vertex_descriptor; typedef property_map
::type id_name_map_t; typedef graph_traits ::vertex_iterator vi_t; std::pair vi; Try writing this using bundled properties:
http://www.boost.org/doc/libs/1_39_0/libs/graph/doc/bundles.html
Okay, that's a nice thing I didn't know about, I will use that. But still what is wrong with the original code. Ralf

Try writing this using bundled properties:
http://www.boost.org/doc/libs/1_39_0/libs/graph/doc/bundles.html
Okay, that's a nice thing I didn't know about, I will use that. But still what is wrong with the original code.
I have no idea. It didn't look like anything is wrong. There may be an issue with overlapping usage of vertex_name_t, but I couldn't say for sure. Andrew Sutton andrew.n.sutton@gmail.com

On Fri, 28 Aug 2009, Ralf Goertz wrote:
Hi,
I'm new to BGL (and generic programming) so this may well not be a bug but I don't know how this could be intended. Consider the following program:
#include <string> #include <iostream> #include
#include #include using namespace boost;
typedef property
VertexProp; //this crashes typedef adjacency_list < vecS, vecS, undirectedS,VertexProp, no_property > graph_t; //this doesn't //typedef adjacency_list < vecS, listS, undirectedS,VertexProp, no_property > graph_t; typedef graph_traits < graph_t >::vertex_descriptor vertex_descriptor; typedef property_map ::type id_name_map_t; typedef graph_traits ::vertex_iterator vi_t; std::pair vi; int main(){ graph_t g; vertex_descriptor vd; id_name_map_t name_map; vd=add_vertex(g); put(name_map,vd,"foo"); for (vi=vertices(g); vi.first!=vi.second;++vi.first) { std::cout<
It appears that name_map is not initialized. You need to do something like: id_name_map_t name_map = get(vertex_name, g); to get the property map before you use it. -- Jeremiah Willcock
participants (3)
-
Andrew Sutton
-
Jeremiah Willcock
-
Ralf Goertz