ok after careful consideration i realize that the segmentation fault is occuring because of the following code where i use a vector of strings which i have delcared in the Node class...I delcare it like this: vector <string> CityConnections
Also, worthy of note is that i'm using a map of nodes in the code below...could anyone detect how i'm accessing memory i'm not supposed to in this vector?
Code:
map <string, Node *>::iterator i = CityNode.find(thisNode->CityName);
for(int j=0; j < ((i->second)->CityConnections).size(); j++)
{
//IS THE SUCCESSOR OF thisNode THE PARENT OF thidNode?
if (thisNode == startNode)
{
map <string, Node *>::iterator k = CityNode.find((i->second)->CityConnections[j]); //ITERATOR POINTING TO THIS SUCCESSOR
newNode = new Node;
newNode -> CityName = (k->second)-> CityName;
newNode -> x = (k->second)-> x;
newNode -> y = (k->second)-> y;
newNode -> type = (k->second)-> type;
SUCCESSORS.push_back( newNode );
}
else if (!((i->second)->CityConnections[j] == thisNode->parent->CityName) )
{
map <string, Node *>::iterator k = CityNode.find((i->second)->CityConnections[j]); //ITERATOR POINTING TO THIS SUCCESSOR
newNode = new Node;
newNode -> CityName = (k->second)-> CityName;
newNode -> x = (k->second)-> x;
newNode -> y = (k->second)-> y;
newNode -> type = (k->second)-> type;
SUCCESSORS.push_back( newNode );
}
}
thanks!
Farooq