mirror of
https://github.com/OlafvdSpek/ctemplate.git
synced 2025-09-28 19:05:49 +08:00
Use unordered_map/set
This commit is contained in:
parent
298a9b45ac
commit
02259b0928
|
@ -106,13 +106,7 @@ using std::list;
|
||||||
using std::vector;
|
using std::vector;
|
||||||
using std::pair;
|
using std::pair;
|
||||||
using std::binary_search;
|
using std::binary_search;
|
||||||
#ifdef HAVE_UNORDERED_MAP
|
|
||||||
using HASH_NAMESPACE::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 {
|
namespace ctemplate {
|
||||||
|
|
||||||
|
@ -618,7 +612,7 @@ static void WriteOneHeaderEntry(
|
||||||
MutexLock ml(&g_header_mutex);
|
MutexLock ml(&g_header_mutex);
|
||||||
|
|
||||||
// we use hash_map instead of hash_set just to keep the stl size down
|
// we use hash_map instead of hash_set just to keep the stl size down
|
||||||
static hash_map<string, bool, StringHash> vars_seen
|
static unordered_map<string, bool, StringHash> vars_seen
|
||||||
GUARDED_BY(g_header_mutex);
|
GUARDED_BY(g_header_mutex);
|
||||||
static string current_file GUARDED_BY(g_header_mutex);
|
static string current_file GUARDED_BY(g_header_mutex);
|
||||||
static string prefix GUARDED_BY(g_header_mutex);
|
static string prefix GUARDED_BY(g_header_mutex);
|
||||||
|
|
|
@ -65,13 +65,7 @@ using std::string;
|
||||||
using std::vector;
|
using std::vector;
|
||||||
using std::pair;
|
using std::pair;
|
||||||
using std::make_pair;
|
using std::make_pair;
|
||||||
#ifdef HAVE_UNORDERED_MAP
|
|
||||||
using HASH_NAMESPACE::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
|
static int kVerbosity = 0; // you can change this by hand to get vlogs
|
||||||
#define LOG(level) std::cerr << #level ": "
|
#define LOG(level) std::cerr << #level ": "
|
||||||
|
|
|
@ -42,13 +42,7 @@
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "base/util.h"
|
#include "base/util.h"
|
||||||
|
|
||||||
#ifdef HAVE_UNORDERED_MAP
|
|
||||||
using HASH_NAMESPACE::unordered_set;
|
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 {
|
namespace ctemplate {
|
||||||
|
|
||||||
|
@ -153,7 +147,7 @@ struct TemplateStringHasher {
|
||||||
namespace {
|
namespace {
|
||||||
Mutex mutex(base::LINKER_INITIALIZED);
|
Mutex mutex(base::LINKER_INITIALIZED);
|
||||||
|
|
||||||
typedef hash_set<TemplateString, TemplateStringHasher> TemplateStringSet;
|
typedef unordered_set<TemplateString, TemplateStringHasher> TemplateStringSet;
|
||||||
|
|
||||||
TemplateStringSet* template_string_set
|
TemplateStringSet* template_string_set
|
||||||
GUARDED_BY(mutex) PT_GUARDED_BY(mutex) = NULL;
|
GUARDED_BY(mutex) PT_GUARDED_BY(mutex) = NULL;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user