diff options
Diffstat (limited to 'search/stats_cache.hpp')
-rw-r--r-- | search/stats_cache.hpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/search/stats_cache.hpp b/search/stats_cache.hpp index 946e12a7c7..db04e4878c 100644 --- a/search/stats_cache.hpp +++ b/search/stats_cache.hpp @@ -1,30 +1,33 @@ #pragma once + #include "base/logging.hpp" -#include "std/unordered_map.hpp" -#include "std/utility.hpp" +#include <cstddef> +#include <string> +#include <unordered_map> +#include <utility> namespace search { template <class TKey, class TValue> class Cache { - unordered_map<TKey, TValue> m_map; + std::unordered_map<TKey, TValue> m_map; /// query statistics size_t m_accesses; size_t m_misses; - size_t m_emptyQueriesCount; /// empty queries count at a row - string m_name; /// cache name for print functions + std::size_t m_emptyQueriesCount; /// empty queries count at a row + std::string m_name; /// cache name for print functions public: - explicit Cache(string const & name) + explicit Cache(std::string const & name) : m_accesses(0), m_misses(0), m_emptyQueriesCount(0), m_name(name) { } - pair<TValue &, bool> Get(TKey const & key) + std::pair<TValue &, bool> Get(TKey const & key) { auto r = m_map.insert(make_pair(key, TValue())); @@ -32,7 +35,7 @@ public: if (r.second) ++m_misses; - return pair<TValue &, bool>(r.first->second, r.second); + return std::pair<TValue &, bool>(r.first->second, r.second); } void Clear() @@ -59,5 +62,4 @@ public: } } }; - } // namespace search |