summaryrefslogtreecommitdiff
path: root/src/lib/timer.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-02-28 21:50:09 +0100
committerCarl Hetherington <cth@carlh.net>2021-02-28 21:50:09 +0100
commite7440b69bf0dc486314544b0e1fb5ac2d45a9a8d (patch)
tree6704ca9b9473505ce7ccd13b50c4d5aae0244d88 /src/lib/timer.cc
parentded500fef3fcae71f03594c2be5ea9196d21b039 (diff)
C++11 tweaks.
Diffstat (limited to 'src/lib/timer.cc')
-rw-r--r--src/lib/timer.cc16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/lib/timer.cc b/src/lib/timer.cc
index e4e7bdfdc..8e4d44547 100644
--- a/src/lib/timer.cc
+++ b/src/lib/timer.cc
@@ -113,24 +113,24 @@ StateTimer::~StateTimer ()
unset ();
int longest = 0;
- for (map<string, Counts>::iterator i = _counts.begin(); i != _counts.end(); ++i) {
- longest = max (longest, int(i->first.length()));
+ for (auto const& i: _counts) {
+ longest = max (longest, int(i.first.length()));
}
list<pair<double, string> > sorted;
- for (map<string, Counts>::iterator i = _counts.begin(); i != _counts.end(); ++i) {
- string name = i->first + string(longest + 1 - i->first.size(), ' ');
+ for (auto const& i: _counts) {
+ string name = i.first + string(longest + 1 - i.first.size(), ' ');
char buffer[64];
- snprintf (buffer, 64, "%.4f", i->second.total_time);
+ snprintf (buffer, 64, "%.4f", i.second.total_time);
string total_time (buffer);
- sorted.push_back (make_pair(i->second.total_time, String::compose("\t%1%2 %3 %4", name, total_time, i->second.number, (i->second.total_time / i->second.number))));
+ sorted.push_back (make_pair(i.second.total_time, String::compose("\t%1%2 %3 %4", name, total_time, i.second.number, (i.second.total_time / i.second.number))));
}
sorted.sort (compare);
cout << _name << N_(":\n");
- for (list<pair<double, string> >::iterator i = sorted.begin(); i != sorted.end(); ++i) {
- cout << N_("\t") << i->second << "\n";
+ for (auto const& i: sorted) {
+ cout << N_("\t") << i.second << "\n";
}
}