]> granicus.if.org Git - graphviz/commitdiff
rephrase accumulate loop in Blocks::cost using a range-based for-loop
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 26 Jun 2021 18:38:26 +0000 (11:38 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 30 Jun 2021 04:28:45 +0000 (21:28 -0700)
lib/vpsc/blocks.cpp

index 3c2b97e7f03c56e52ebd0e51fd0ca57672503a9d..9ac99562061f1275b30d66f86d91656dba9011d9 100644 (file)
@@ -194,9 +194,8 @@ void Blocks::split(Block *b, Block *&l, Block *&r, Constraint *c) {
  */
 double Blocks::cost() {
        double c = 0;
-       for(set<Block*>::iterator i=begin();i!=end();i++) {
-               c += (*i)->cost();
+       for (Block *b : *this) {
+               c += b->cost();
        }
        return c;
 }
-