我找不到为什么我的程序抛出一个SIGBART错误的原因。
我已经收窄,当这个函数被调用。
bool Node::isEdgeConnected(Node vertex1, Node vertex2){
//I'm not sure if this is the right way to copy this vector <list>
vector<list<Node> > myEdgeList = *edgeList;//edgeList is a private data member of Node
vector<list<Node> >::iterator it;
cout << myEdgeList.size();
for (it = myEdgeList.begin(); it != myEdgeList.end(); it++) {
list<Node> edge;
edge = *it;
Node placeNode = edge.front();
cout <<placeNode.getNodeId()<<endl;
list<Node>::iterator eIt;
for (eIt = edge.begin(); eIt != edge.end(); eIt++) {
Node placeNode1, placeNode2;
placeNode1 = edge.front();
placeNode2 = *eIt;
cout << placeNode1.getNodeId() << " " << placeNode2.getNodeId()<<endl;
if(placeNode1.getNodeId() == vertex1.getNodeId() &&
placeNode2.getNodeId() == vertex2.getNodeId()){
return true;
}
}
}
return false;
}
任何帮助,将不胜感激。