【发布时间】:2018-06-10 04:51:11
【问题描述】:
在 Boost Graph Library (BGL) 中,如何以编程方式获取属性的类型,例如与 boost::edge_weight_t 关联的属性类型?
我搜索并找到了很多关于如何获取 property map 类型的示例,但没有找到 property 本身的类型。例如,下面的BGL documentation 具有edge_weight_t 的属性映射类型为property_map<DirectedGraph, edge_weight_t>::type:
typedef ... DirectedGraph;
DirectedGraph digraph(V);
{
..
property_map<DirectedGraph, edge_weight_t>::type
weight = get(edge_weight, digraph);
}
但是我如何获得边缘权重的类型? (float、int 等)
如何使用适当的类型表达式(下面的???)为边缘权重声明变量,以便例如从文件/流中读取这些权重值。
typedef ... DirectedGraph;
...
??? w;
input_s >> w;
【问题讨论】:
标签: c++ boost boost-graph