diff --git a/src/bin/common_finput.cc b/src/bin/common_finput.cc index 82716cae3..94335564d 100644 --- a/src/bin/common_finput.cc +++ b/src/bin/common_finput.cc @@ -343,13 +343,14 @@ int job_processor::run() { int error = 0; - jobs_t::const_iterator i; - for (i = jobs.begin(); i != jobs.end() && !abort_run; ++i) + for (auto& j: jobs) { - if (!i->file_p) - error |= process_string(i->str); + if (!j.file_p) + error |= process_string(j.str); else - error |= process_file(i->str); + error |= process_file(j.str); + if (abort_run) + break; } return error; } diff --git a/src/bin/genltl.cc b/src/bin/genltl.cc index 9f36993b1..83c3ed15b 100644 --- a/src/bin/genltl.cc +++ b/src/bin/genltl.cc @@ -853,15 +853,14 @@ output_pattern(int pattern, int n) static void run_jobs() { - jobs_t::const_iterator i; - for (i = jobs.begin(); i != jobs.end(); ++i) + for (auto& j: jobs) { - int inc = (i->range.max < i->range.min) ? -1 : 1; - int n = i->range.min; + int inc = (j.range.max < j.range.min) ? -1 : 1; + int n = j.range.min; for (;;) { - output_pattern(i->pattern, n); - if (n == i->range.max) + output_pattern(j.pattern, n); + if (n == j.range.max) break; n += inc; } diff --git a/src/bin/ltlcross.cc b/src/bin/ltlcross.cc index 37eda3874..7dcad17f4 100644 --- a/src/bin/ltlcross.cc +++ b/src/bin/ltlcross.cc @@ -1161,16 +1161,12 @@ namespace unsigned c = m->scc_count(); for (unsigned n = 0; n < c; ++n) if (m->accepting(n)) - { - const std::list& l = m->states_of(n); - for (std::list::const_iterator i = l.begin(); - i != l.end(); ++i) - { - spot::state* x = aut->project_state(*i, sspace); - if (!s.insert(x).second) - x->destroy(); + for (auto i: m->states_of(n)) + { + spot::state* x = aut->project_state(i, sspace); + if (!s.insert(x).second) + x->destroy(); } - } } static bool @@ -1183,9 +1179,8 @@ namespace states_in_acc(pos, sspace, s); states_in_acc(neg, sspace, s); bool res = s.size() == states; - state_set::iterator it; - for (it = s.begin(); it != s.end(); ++it) - (*it)->destroy(); + for (auto i: s) + i->destroy(); return res; } diff --git a/src/bin/randltl.cc b/src/bin/randltl.cc index 9b69f3359..346b8419f 100644 --- a/src/bin/randltl.cc +++ b/src/bin/randltl.cc @@ -160,11 +160,10 @@ const spot::ltl::formula* GF_n(spot::ltl::atomic_prop_set& ap) { const spot::ltl::formula* res = 0; - spot::ltl::atomic_prop_set::const_iterator i; - for (i = ap.begin(); i != ap.end(); ++i) + for (auto v: ap) { const spot::ltl::formula* f = - spot::ltl::unop::instance(spot::ltl::unop::F, (*i)->clone()); + spot::ltl::unop::instance(spot::ltl::unop::F, v->clone()); f = spot::ltl::unop::instance(spot::ltl::unop::G, f); if (res) res = spot::ltl::multop::instance(spot::ltl::multop::And, f, res); @@ -406,11 +405,8 @@ main(int argc, char** argv) delete rf; // Cleanup the unicity table. - { - fset_t::const_iterator i; - for (i = unique_set.begin(); i != unique_set.end(); ++i) - (*i)->destroy(); - } + for (auto i: unique_set) + i->destroy(); // Cleanup the atomic_prop set. destroy_atomic_prop_set(aprops); return 0;