BGL: Bundled Properties with pointer type
Hi all, It's my first time submitting a question on a newsgroup so pardon me if I'm wrong in my way of doing. I have a graph of type BoostGraph_t defined like typedef boost::adjacency_list <vecS, vecS, undirectedS, NodeProperty*, EdgeProperty*> BoostGraph_t; with vertex and edge properties types defined as pointer on the following stuctures struct EdgeProperty { long m_id; double m_length; }; struct NodeProperty { long m_id; }; I'm now trying to use the dijkstra_shortest_paths() function with the edge length as parameter for the weigh_map function argument. But the call to the following function get(&EdgeProperty::m_length, m_graph); returns me the following errors ****** e:\Boost\boost\graph\properties.hpp(337) : error C2825: 'Bundle::*': cannot form a qualified name e:\Boost\boost\graph\properties.hpp(337) : error C2226: syntax error : unexpected type 'Graph' e:\Boost\boost\graph\properties.hpp(337) : error C2334: unexpected token(s) preceding ':'; skipping apparent function body e:\Boost\boost\graph\properties.hpp(342) : error C2825: 'Bundle::*': cannot form a qualified name e:\Boost\boost\graph\properties.hpp(342) : error C2657: '`global namespace'::*' found at the start of a statement (did you forget to specify a type?) e:\Boost\boost\graph\properties.hpp(342) : error C2653: 'operator``global namespace''' : is not a class or namespace name e:\Boost\boost\graph\properties.hpp(342) : error C2501: 'boost::bundle_property_map<Graph,Descriptor,Bundle,T>::pm' : missing storage-class or type specifiers with [ Graph=boost::adjacency_list<boost::vecS,boost::vecS, boost::undirectedS,NodeProperty *,EdgeProperty *>, Descriptor=boost::property_map<boost::adjacency_list<boost::vecS, boost::vecS,boost::undirectedS,NodeProperty *,EdgeProperty *>, double EdgeProperty::* >::descriptor, Bundle=boost::property_map<boost::adjacency_list<boost::vecS, boost::vecS,boost::undirectedS,NodeProperty *,EdgeProperty *>, double EdgeProperty::* >::actual_bundle, T=double ] ****** I know it's working correctly if I use NodeProperty and EdgeProperty for graph template arguments instead of pointers. But I would like to know if it's possible to do it in that way and how would be the correct syntax for the get() to work properly. Many thanks in advance for your help! ~Benoît
Hello Benoît, I am not a BGL expert at all and I am not sure about what you want to do. However, I will give you my humble opinion or advice, but it can be wrong... I think that it is wrong to pass a pointer to structure type as a bundle property template parameter and that it must be simply a structure. Why do you do that ? There's something special that you want to do ? Why don't you simply pass the structure type ? ( typedef boost::adjacency_list <vecS, vecS, undirectedS, NodeProperty, EdgeProperty> BoostGraph_t;) Camilo Benoît Dagon wrote:
Hi all,
It's my first time submitting a question on a newsgroup so pardon me if I'm wrong in my way of doing.
I have a graph of type BoostGraph_t defined like
typedef boost::adjacency_list <vecS, vecS, undirectedS, NodeProperty*, EdgeProperty*> BoostGraph_t;
with vertex and edge properties types defined as pointer on the following stuctures
struct EdgeProperty { long m_id; double m_length; };
struct NodeProperty { long m_id; };
I'm now trying to use the dijkstra_shortest_paths() function with the edge length as parameter for the weigh_map function argument. But the call to the following function
get(&EdgeProperty::m_length, m_graph);
returns me the following errors
****** e:\Boost\boost\graph\properties.hpp(337) : error C2825: 'Bundle::*': cannot form a qualified name e:\Boost\boost\graph\properties.hpp(337) : error C2226: syntax error : unexpected type 'Graph' e:\Boost\boost\graph\properties.hpp(337) : error C2334: unexpected token(s) preceding ':'; skipping apparent function body e:\Boost\boost\graph\properties.hpp(342) : error C2825: 'Bundle::*': cannot form a qualified name e:\Boost\boost\graph\properties.hpp(342) : error C2657: '`global namespace'::*' found at the start of a statement (did you forget to specify a type?) e:\Boost\boost\graph\properties.hpp(342) : error C2653: 'operator``global namespace''' : is not a class or namespace name e:\Boost\boost\graph\properties.hpp(342) : error C2501: 'boost::bundle_property_map<Graph,Descriptor,Bundle,T>::pm' : missing storage-class or type specifiers with [ Graph=boost::adjacency_list<boost::vecS,boost::vecS, boost::undirectedS,NodeProperty *,EdgeProperty *>, Descriptor=boost::property_map<boost::adjacency_list<boost::vecS, boost::vecS,boost::undirectedS,NodeProperty *,EdgeProperty *>, double EdgeProperty::* >::descriptor, Bundle=boost::property_map<boost::adjacency_list<boost::vecS, boost::vecS,boost::undirectedS,NodeProperty *,EdgeProperty *>, double EdgeProperty::* >::actual_bundle, T=double ] ******
I know it's working correctly if I use NodeProperty and EdgeProperty for graph template arguments instead of pointers. But I would like to know if it's possible to do it in that way and how would be the correct syntax for the get() to work properly.
Many thanks in advance for your help! ~Benoît
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Hello Camilo, Thanks for your answer. I think you're right. The reason why I was trying to use a pointer to structure as bundle property is because I wanted to access a vertex not only by its index but by its property. More precisely, I've a method which iterates over the vertices of the following prototype: NodeProperty* GraphWrapper::iterateNodes (NodeProperty* previousNode); Thus, I must be able to find the index of the previousNode to increment it and return the nextNode. My error was coming from the fact I was trying to use the boost::adjacency_list as a container for my data instead of a tool to "organize" the data and externalizing the storage. ~Benoît
participants (2)
-
Benoît Dagon
-
Camilo La Rota