Confusion with Vectors
The following code keeps telling me the "!=" isn't being used properly, but I don't understand why.
1 2 3 4 5 6 7 8 9 10 11 12
|
int getLeftMost(BWTA::Polygon subject) {
int leftMost = mapWidth - 1;
for(std::vector<Position*>::const_iterator i = subject.begin();
i != subject.end(); i++) {
if((*i)->x() < leftMost)
leftMost = (*i)->x();
}
return leftMost;
}
|
some notes, a Polygon is a vector of Positions, which are essentially just pairs of x and y values.
Thanks for any help!
Why not avoid confusion and use BWTA::Polygon::const_iterator
? I think that works OK.
Also note that you say that "Polygon is a vector of Positions", but your code uses a vector of POINTERS to Positions. This could be the issue.
Topic archived. No new replies allowed.