warning: passing ‘const DependencyGraph’ as ‘this’ argument of ‘const std::vector<int> DependencyGraph::get_head(int)’ discards qualifiers [-fpermissive]
vector<int> hg = graph.get_head(i);
vector<int> hg = graph.get_head(i);
在const变量上调用non const函数,会产生这样的报错。
其中DependencyGraph是const变量,get_head(int)是non const函数,改正方法是将get_head函数声明为const型
int get_head(int k) const{
.........
}