在图中没有对boost::get的匹配函数调用



我正在根据boost中的示例geometry/07_a_graph_route_example对图进行建模。

我的图表如下:

typedef boost::adjacency_list<
boost::listS,
boost::vecS,
boost::directedS,
gG_vertex_property<string, double, pointClass>,
gG_edge_property<listClass, pointClass>
> graph_type;
graph_type Graph;

其中CCD_ 2和CCD_。

现在每次我尝试用呼叫dijkstra_shortest_path

boost::dijkstra_shortest_paths(Graph, endVert,                             // Graph Object, End of Search Object
&predecessors[0], &costs[0],                                             // Vectors to store predecessors and costs
boost::get(boost::edge_weight, Graph),
boost::get(boost::vertex_index, Graph),                                  // Vertex Index Map
std::less<double>(), std::plus<double>(),                                // Cost calculating operators
(std::numeric_limits<double>::max)(), double(),                          // limits
boost::dijkstra_visitor<boost::null_visitor>());                         // Visitior, does nothing at the moment

WeightMap所示:

错误:调用"get"boost::get(boost:;edge_weight,Graph(没有匹配函数

还有很多模板不适合我的用例。我是如何阅读文档的这是标准的方法。我的属性缺少什么吗?

我做错了什么?

谢谢你的帮助。

我猜gG_vertex_propertygG_edge_property是"捆绑的";属性(没有自定义属性(。如果是这样,你应该通过这些,而不是";boost::get(boost::edge_weight,Graph(",它试图访问";内部";属性,完全分离的东西。看见https://www.boost.org/doc/libs/1_77_0/libs/graph/doc/bundles.html。我想,如果属性是structs,并且边权重保持在gG_edge_property::weight中,那么正确的代码应该是这样的:

boost::dijkstra_shortest_paths(Graph, endVert,                             // Graph Object, End of Search Object
&predecessors[0], &costs[0],                                             // Vectors to store predecessors and costs
get(&gG_edge_property::weight, Graph), /*!!!!!!!!*/
boost::get(boost::vertex_index, Graph),                                  // Vertex Index Map
std::less<double>(), std::plus<double>(),                                // Cost calculating operators
(std::numeric_limits<double>::max)(), double(),                          // limits
boost::dijkstra_visitor<boost::null_visitor>());                         // Visitior, does nothing at the moment

最新更新