diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2002-04-30 18:00:14 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2002-04-30 18:00:14 (GMT) |
commit | ec4331d2737f882e5f2f23360987f30364095506 (patch) | |
tree | 42105cc033a30d0c1b7ab5f71ab6696d71f594c3 /Source/cmCacheManager.cxx | |
parent | fd22157e554a3f71eceec83dde1070ce76071e0d (diff) | |
download | CMake-ec4331d2737f882e5f2f23360987f30364095506.zip CMake-ec4331d2737f882e5f2f23360987f30364095506.tar.gz CMake-ec4331d2737f882e5f2f23360987f30364095506.tar.bz2 |
ENH: do not use count, find for map lookup
Diffstat (limited to 'Source/cmCacheManager.cxx')
-rw-r--r-- | Source/cmCacheManager.cxx | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index ba4f76f..3d848c7 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -443,31 +443,34 @@ void cmCacheManager::OutputHelpString(std::ofstream& fout, void cmCacheManager::RemoveCacheEntry(const char* key) { - if(m_Cache.count(key)) - { - m_Cache.erase(key); - } + CacheEntryMap::iterator i = m_Cache.find(key); + if(i != m_Cache.end()) + { + m_Cache.erase(i); + } else - { - std::cerr << "Failed to remove entry" << std::endl; - } + { + std::cerr << "Failed to remove entry:" << key << std::endl; + } } cmCacheManager::CacheEntry *cmCacheManager::GetCacheEntry(const char* key) { - if(m_Cache.count(key)) + CacheEntryMap::iterator i = m_Cache.find(key); + if(i != m_Cache.end()) { - return &(m_Cache.find(key)->second); + return &i->second; } return 0; } const char* cmCacheManager::GetCacheValue(const char* key) const { - if(m_Cache.count(key)) + CacheEntryMap::const_iterator i = m_Cache.find(key); + if(i != m_Cache.end()) { - return m_Cache.find(key)->second.m_Value.c_str(); + return i->second.m_Value.c_str(); } return 0; } |