Skip to content

Commit

Permalink
fix iterator misuse
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Dyer authored and Chris Dyer committed Nov 11, 2013
1 parent 5b3f31d commit 7f90414
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions utils/atools.cc
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,16 @@ struct RefineCommand : public Command {
bool keep_going = !p.empty();
while (keep_going) {
keep_going = false;
for (set<pair<int, int> >::iterator pi = p.begin();
pi != p.end(); ++pi) {
set<pair<int, int> > added;
for (set<pair<int, int> >::iterator pi = p.begin(); pi != p.end(); ++pi) {
if ((this->*pred)(pi->first, pi->second)) {
Align(pi->first, pi->second);
p.erase(pi);
added.insert(make_pair(pi->first, pi->second));
keep_going = true;
}
}
for (set<pair<int, int> >::iterator ai = added.begin(); ai != added.end(); ++ai)
p.erase(*ai);
}
}
Array2D<bool> res_; // refined alignment
Expand Down

0 comments on commit 7f90414

Please sign in to comment.