を返そうとしてVertex &います。コードは次のとおりです。
Vertex& Graph::getVertex(std::string v) { // gets the vertex
for (std::vector<Vertex>::iterator it = vertices.begin(); it != vertices.end(); it++) {
if ((it->getName()).compare(v) == 0)
return it; // if strings are the same return vertex
}
exit(1);
}
問題は、getVertex互換性がないというフラグがit付けられ、戻り値で型の参照Vertex &(非 const 修飾) が型の値で初期化できないというフラグが付けられることstd::vectorです...これらのエラーを修正するにはどうすればよいですか?