在boost图库中使用属性映射时出错

时间:2013-06-12 15:15:30

标签: boost-graph

我有以下代码

typedef property<symbol_t,string,property <message_t,string> > edge_properties;
typedef property<vertex_name_t,string> vertex_properties;
typedef adjacency_list<listS,listS,directedS,vertex_properties,edge_properties> Graph;

Graph automata;
property_map(Graph,vertex_name_t) :: type state_name_map = get(vertex_name_t,automata);

这应该可行,但我收到以下错误

error: ISO C++ forbids declaration of ‘property_map’ with no type [-fpermissive]
xml2automata.cpp:30:37: error: expected ‘;’ at end of member declaration
xml2automata.cpp:30:39: error: invalid use of template-name ‘boost::type’ without an 
argument list              

1 个答案:

答案 0 :(得分:1)

property_map(Graph,vertex_name_t) :: type state_name_map = 
      get(vertex_name_t,automata);

将圆括号更改为尖括号,因为这是一个模板。

property_map < Graph,vertex_name_t > :: type state_name_map = 
       get(vertex_name_t,automata);