I have a class with a std::vector data member e.g.
class foo{
public:
const std::vector<int> getVec(){return myVec;} //other stuff omitted
private:
std::vector<int> myVec;
};
Now at some part of my main code I am trying to iterate through the vector like this:
std::vector<int>::const_iterator i = myFoo.getVec().begin();
while( i != myFoo.getVec().end())
{
//do stuff
++i;
}
The moment I reach this loop, I get the aforementioned error.
See Question&Answers more detail:os