Bug 1337358 - Converts for(...; ...; ...) loops to use the new range-based loops in C++11 in tools/ r?froydnj draft
authorSylvestre Ledru <sledru@mozilla.com>
Wed, 08 Feb 2017 12:04:50 +0100
changeset 482830 68412374347bb796119a2a0cc419f25d76ec273b
parent 482829 0f29c4e569b6246cd59d1ec9b6abd1ae60948d1e
child 482831 9f657693145931ef5d322b2379a29b9b41ad52c4
push id45175
push userbmo:sledru@mozilla.com
push dateMon, 13 Feb 2017 14:41:08 +0000
reviewersfroydnj
bugs1337358
milestone54.0a1
Bug 1337358 - Converts for(...; ...; ...) loops to use the new range-based loops in C++11 in tools/ r?froydnj MozReview-Commit-ID: GdeCzDXjzzg
tools/power/rapl.cpp
--- a/tools/power/rapl.cpp
+++ b/tools/power/rapl.cpp
@@ -714,18 +714,18 @@ Finish()
   //
   // where |x| is the sum variable, |m| is the mean, and |n| is the
   // population size.
   //
   // This is different from the *sample* standard deviation, which divides by
   // |n - 1|, and would be appropriate if we were using a random sample of a
   // larger population.
   double sumOfSquaredDeviations = 0;
-  for (auto iter = gTotals_W.begin(); iter != gTotals_W.end(); ++iter) {
-    double deviation = (*iter - mean);
+  for (double & iter : gTotals_W) {
+    double deviation = (iter - mean);
     sumOfSquaredDeviations += deviation * deviation;
   }
   double popStdDev = sqrt(sumOfSquaredDeviations / n);
 
   // Sort so that percentiles can be determined. We use the "Nearest Rank"
   // method of determining percentiles, which is simplest to compute and which
   // chooses values from those that appear in the input set.
   std::sort(gTotals_W.begin(), gTotals_W.end());