hi,

I'm having some trouble with a vector. I'm at a point where I need to remove and object from the vector and I inconsistently receive the error:

"vector iterator not dereferencable"

Although I'm not sure what the issue is here as I'm not dereferencing the iterator. If I break and debug it goes into the actual vector class and other built in stuff.

Code:
for (vector<Building>::iterator itBuilding = buildings.begin(); itBuilding != buildings.end(); itBuilding++) {
	if (itBuilding->isPointInObject(&downPoint)) {
		buildings.erase(itBuilding);
		break;
	}
}
Thanks