Division_Euclidean_space.h错误:'vertex_t'不是类型

gsa*_*ras 1 c++ boost

我有这个类,但我只在BOOST情况下收到错误.

template<typename T>
class Division_Euclidean_space {
 public:
  typedef T FT;

#ifdef RKD_WITH_BOOST
 struct Vertex{ std::vector<FT> v;};
 typedef struct Vertex Vertex;

 typedef boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, Vertex > Graph;
 typename boost::graph_traits<Graph>::vertex_descriptor vertex_t;
#endif

#ifdef RKD_WITH_BOOST
  void insert(Graph& g, vertex_t& v) {
        for(int i = 0; i < g[v].v.size(); ++i)
            p.push_back(g[v].v[i]);
  }
#endif
...
Run Code Online (Sandbox Code Playgroud)

我实际上遇到了很多错误,但我相信如果我解决这个问题,我会很好的

Division_Euclidean_space.h:102:25: error: ‘vertex_t’ is not a type
Run Code Online (Sandbox Code Playgroud)

Jar*_*d42 6

typename boost::graph_traits<Graph>::vertex_descriptor vertex_t; 声明一个变量.

你可能意味着:

typedef typename boost::graph_traits<Graph>::vertex_descriptor vertex_t;
Run Code Online (Sandbox Code Playgroud)