From baf858f88533e18fd1d26e41de0a6723e53b4b7e Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Fri, 7 May 2021 20:27:05 -0700 Subject: [PATCH] use range-based for loops to abbreviate some code in constraintGraphIsCyclic --- lib/vpsc/solve_VPSC.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/vpsc/solve_VPSC.cpp b/lib/vpsc/solve_VPSC.cpp index 420f5b37f..f683de8e0 100644 --- a/lib/vpsc/solve_VPSC.cpp +++ b/lib/vpsc/solve_VPSC.cpp @@ -313,13 +313,13 @@ bool VPSC::constraintGraphIsCyclic(const unsigned n, Variable *vs[]) { varmap[vs[i]]=u; } for(unsigned i=0;i::iterator c=vs[i]->in.begin();c!=vs[i]->in.end();c++) { - Variable *l=(*c)->left; + for(Constraint *c : vs[i]->in) { + Variable *l=c->left; varmap[vs[i]]->in.insert(varmap[l]); } - for(vector::iterator c=vs[i]->out.begin();c!=vs[i]->out.end();c++) { - Variable *r=(*c)->right; + for(Constraint *c : vs[i]->out) { + Variable *r=c->right; varmap[vs[i]]->out.insert(varmap[r]); } } @@ -337,8 +337,7 @@ bool VPSC::constraintGraphIsCyclic(const unsigned n, Variable *vs[]) { return true; } else { graph.erase(i); - for(set::iterator j=u->out.begin();j!=u->out.end();j++) { - node *v=*j; + for(node *v : u->out) { v->in.erase(u); } delete u; -- 2.50.1