use iterator-based idiom for check-if-present-then-access

This commit is contained in:
Vern Paxson 2021-11-22 15:28:15 -08:00
parent 735d584d9f
commit 84423369b4
12 changed files with 86 additions and 59 deletions

View file

@ -52,8 +52,9 @@ template <class T> string CPPTracker<T>::KeyName(const T* key)
ASSERT(hash != 0);
auto rep = reps[hash];
if ( gi_s.count(rep) > 0 )
return gi_s[rep]->Name();
auto gi = gi_s.find(rep);
if ( gi != gi_s.end() )
return gi->second->Name();
auto index = map2[hash];