]> granicus.if.org Git - graphviz/commitdiff
replace manual iteration in Blocks::dfsVisit with range-based for loop
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 12 Jun 2021 19:32:11 +0000 (12:32 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 19 Jun 2021 19:24:07 +0000 (12:24 -0700)
This C++11 syntax does the same thing.

lib/vpsc/blocks.cpp

index 47ae790e613f8bf260aac3dae851da785826eefc..f8b09e5cc8b70b02bb9364c4f48fe8c8ffa8c274 100644 (file)
@@ -70,9 +70,7 @@ list<Variable*> *Blocks::totalOrder() {
 // onto the front of the list when we finish searching them
 void Blocks::dfsVisit(Variable *v, list<Variable*> &order) {
        v->visited=true;
-       vector<Constraint*>::iterator it=v->out.begin();
-       for(;it!=v->out.end();it++) {
-               Constraint *c=*it;
+       for (Constraint *c : v->out) {
                if(!c->right->visited) {
                        dfsVisit(c->right, order);
                }