A
Adam Hartshorne
Hi All,
I was wondering if anybody can tell me what is wrong with the following
code,
in a .h file I have
std::list<std::vector<Site> > positions ;
std::list<std::vector<Site> >::iterator itSteps ;
then in the .cpp file
void RmfSystem::step() {
if (itSteps == positions.end()) {
itSteps = positions.begin() ;
} else {
itSteps++ ;
}
}
where step gets called by an animate function in another file. The idea
that I have a vector of vector of positions and I want on each call of
step that the iterator points at another set of positions. Then when the
end of the list (well vector) is reached it loops around to the start.
As it stands my program crashes, as itStep == positions.end() never
seems to be found to be true.
Any ideas what I am doing wrong?
Adam
I was wondering if anybody can tell me what is wrong with the following
code,
in a .h file I have
std::list<std::vector<Site> > positions ;
std::list<std::vector<Site> >::iterator itSteps ;
then in the .cpp file
void RmfSystem::step() {
if (itSteps == positions.end()) {
itSteps = positions.begin() ;
} else {
itSteps++ ;
}
}
where step gets called by an animate function in another file. The idea
that I have a vector of vector of positions and I want on each call of
step that the iterator points at another set of positions. Then when the
end of the list (well vector) is reached it loops around to the start.
As it stands my program crashes, as itStep == positions.end() never
seems to be found to be true.
Any ideas what I am doing wrong?
Adam