From 02259b0928b3038898ce2a6ef78ae53f93ab4251 Mon Sep 17 00:00:00 2001 From: Olaf van der Spek Date: Mon, 30 Jan 2017 13:36:32 +0100 Subject: [PATCH] Use unordered_map/set --- src/template.cc | 8 +------- src/template_cache.cc | 6 ------ src/template_string.cc | 8 +------- 3 files changed, 2 insertions(+), 20 deletions(-) diff --git a/src/template.cc b/src/template.cc index d5b5bdf..79ca535 100755 --- a/src/template.cc +++ b/src/template.cc @@ -106,13 +106,7 @@ using std::list; using std::vector; using std::pair; using std::binary_search; -#ifdef HAVE_UNORDERED_MAP using HASH_NAMESPACE::unordered_map; -// This is totally cheap, but minimizes the need for #ifdef's below... -#define hash_map unordered_map -#else -using HASH_NAMESPACE::hash_map; -#endif namespace ctemplate { @@ -618,7 +612,7 @@ static void WriteOneHeaderEntry( MutexLock ml(&g_header_mutex); // we use hash_map instead of hash_set just to keep the stl size down - static hash_map vars_seen + static unordered_map vars_seen GUARDED_BY(g_header_mutex); static string current_file GUARDED_BY(g_header_mutex); static string prefix GUARDED_BY(g_header_mutex); diff --git a/src/template_cache.cc b/src/template_cache.cc index 819a0b6..644f53b 100644 --- a/src/template_cache.cc +++ b/src/template_cache.cc @@ -65,13 +65,7 @@ using std::string; using std::vector; using std::pair; using std::make_pair; -#ifdef HAVE_UNORDERED_MAP using HASH_NAMESPACE::unordered_map; -// This is totally cheap, but minimizes the need for #ifdef's below... -#define hash_map unordered_map -#else -using HASH_NAMESPACE::hash_map; -#endif static int kVerbosity = 0; // you can change this by hand to get vlogs #define LOG(level) std::cerr << #level ": " diff --git a/src/template_string.cc b/src/template_string.cc index e5c7e5d..d937952 100644 --- a/src/template_string.cc +++ b/src/template_string.cc @@ -42,13 +42,7 @@ #include "base/macros.h" #include "base/util.h" -#ifdef HAVE_UNORDERED_MAP using HASH_NAMESPACE::unordered_set; -// This is totally cheap, but minimizes the need for #ifdef's below... -#define hash_set unordered_set -#else -using HASH_NAMESPACE::hash_set; -#endif namespace ctemplate { @@ -153,7 +147,7 @@ struct TemplateStringHasher { namespace { Mutex mutex(base::LINKER_INITIALIZED); -typedef hash_set TemplateStringSet; +typedef unordered_set TemplateStringSet; TemplateStringSet* template_string_set GUARDED_BY(mutex) PT_GUARDED_BY(mutex) = NULL;