diff options
Diffstat (limited to 'stoc/source/inspect/introspection.cxx')
-rw-r--r-- | stoc/source/inspect/introspection.cxx | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/stoc/source/inspect/introspection.cxx b/stoc/source/inspect/introspection.cxx index 02706a6258de..53e045c6dc2b 100644 --- a/stoc/source/inspect/introspection.cxx +++ b/stoc/source/inspect/introspection.cxx @@ -1505,12 +1505,10 @@ public: typename Map::size_type const MAX = 100; assert(map_.size() <= MAX); if (map_.size() == MAX) { - typename Map::iterator del(map_.begin()); - for (typename Map::iterator i(map_.begin()); i != map_.end(); ++i) { - if (i->second.hits < del->second.hits) { - del = i; - } - } + typename Map::iterator del = std::min_element(map_.begin(), map_.end(), + [](const typename Map::value_type& a, const typename Map::value_type& b) { + return a.second.hits < b.second.hits; + }); map_.erase(del); } bool ins = map_.emplace(key, Data(access)).second; |