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

时间:2014-12-25 00:25:24

标签: 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
...

我实际上遇到了很多错误,但我相信如果我解决这个问题,那我就没事了

Division_Euclidean_space.h:102:25: error: ‘vertex_t’ is not a type

1 个答案:

答案 0 :(得分:6)

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

你可能意味着:

typedef typename boost::graph_traits<Graph>::vertex_descriptor vertex_t;