【发布时间】:2014-03-31 12:54:03
【问题描述】:
我对 c++ 和 boost 库还很陌生: 不确定我在以下代码中做错了什么: 我正在关注此处的示例http://www.richelbilderbeek.nl/CppBoostGraphExample4.htm
typedef boost::adjacency_list
<
//Store all edges as a std::vector
boost::vecS,
//Store all vertices in a std::vector
boost::vecS,
//Relations are both ways (in this example)
//(note: but you can freely change it to boost::directedS)
boost::undirectedS,
//All vertices are person names of type std::string
boost::property<boost::vertex_name_t,std::string>,
//All edges are weights equal to the encounter frequencies
boost::property<boost::edge_weight_t,double>,
//Graph itself has a std::string name
boost::property<boost::graph_name_t,std::string>
> Graph;
当我尝试编译我得到的代码时
错误:模板参数的数量错误(1,应该是 3) /usr/include/boost/pending/property.hpp:22 错误:为“tempate struct boost::property”提供
在我的代码中,错误指向这一行:
boost::property<boost::edge_weight_t,double>
我使用的是 1.55 版的库
【问题讨论】:
-
我在
boost::adjacency_list中计算了7 个模板参数,但您提供了6 个。认为您可能会错过EdgeList -
我仍然得到同样的错误提供一个额外的参数
listS