
On Tue, 10 Nov 2009, Stephen Karmann wrote:
Hello dear mailing list members,
i'm new to this mailing list and hope i'm right here and that my english is not too annoying.
I have to to some distance calculation and decided to use the boost::graph-framework to do this as i have to develop a C++ application using Visual C++ Express Edition 2008. I have to include some background details information in the vertices and edges of my graph and chose to append such meta info objects to the vertices and edges with the help of properties. I defined the following types in the Header-Class:
[code] struct vtx_ref_t { typedef boost::vertex_property_tag kind; }; struct edge_ref_t { typedef boost::edge_property_tag kind; };
// VtxMetaClass and EdgeMetaClass are some Classes containing some // infos needed for calculation typedef boost::property<vtx_ref_t, VtxMetaClass*> VtxProperty; typedef boost::property<edge_ref_t, EdgeMetaClass*> EdgeProperty; typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, VtxProperty, EdgeProperty> MyGraphType;
typedef boost::graph_traits<MyGraphType>::vertex_descriptor vertex_t; typedef boost::graph_traits<MyGraphType>::edge_descriptor edge_t; [/code]
In the Main-Method i tried to use the function boost::put to append such a meta class object infoobj to a vertex (whose vertex descriptor vtx i only have) i have created somewhere else where i cannot append the infoobject cause i don't know at that time which one to append.
[code] MyGraphType graph(100); vertex_t vtx = boost::add_vertex(graph); VtxMetaClass* infoobj; ... boost::property_map<MyGraphType, vtx_ref_t>::type vtxref = get(vtx_ref_t(), graph); boost::put(vtxref, graph, vtx, infoobj); [/code]
But i only get a compilation error telling me that: 1>e:\development\VC++\project\include\boost/pending/property.hpp(46) : error C2039: 'kind': is no element of 'boost::vec_adj_list_vertex_property_map<Graph,GraphPtr,ValueType,Reference,Tag>'
You are adding the graph to the put() call when you already have a property map. Try changing it to either: boost::put(vtxref, vtx, infoobj); or: boost::put(vtx_ref_t(), graph, vtx, infoobj); -- Jeremiah Willcock