1
0
mirror of https://github.com/OlafvdSpek/ctemplate.git synced 2025-09-28 19:05:49 +08:00

Use std::unordered_map

This commit is contained in:
Olaf van der Spek 2016-05-29 21:22:39 +02:00
parent 057f80ddfc
commit d17dd5d192
6 changed files with 15 additions and 15 deletions

View File

@ -19,13 +19,13 @@
#define GOOGLE_NAMESPACE ctemplate
/* the location of <unordered_map> or <hash_map> */
#define HASH_MAP_H <hash_map>
#define HASH_MAP_H <unordered_map>
/* the namespace of hash_map/hash_set */
#define HASH_NAMESPACE stdext
#define HASH_NAMESPACE std
/* the location of <unordered_set> or <hash_set> */
#define HASH_SET_H <hash_set>
#define HASH_SET_H <unordered_set>
/* Define to 1 if you have the <byteswap.h> header file. */
#undef HAVE_BYTESWAP_H

View File

@ -45,7 +45,7 @@
#include <stdlib.h> // for NULL
#include <string.h> // for strcmp
#include <sys/types.h>
#include <hash_map>
#include <unordered_map>
#include <ctemplate/template_string.h> // for StringHash
// NOTE: if you are statically linking the template library into your binary
@ -131,12 +131,12 @@ class CTEMPLATE_DLL_DECL PerExpandData {
private:
#ifdef _MSC_VER
typedef stdext::hash_map<const char*, const void*, StringHash> DataMap;
typedef std::unordered_map<const char*, const void*, StringHash> DataMap;
#else
struct DataEq {
bool operator()(const char* s1, const char* s2) const;
};
typedef stdext::hash_map<const char*, const void*, StringHash, DataEq>
typedef std::unordered_map<const char*, const void*, StringHash, DataEq>
DataMap;
#endif

View File

@ -34,7 +34,7 @@
#ifndef TEMPLATE_TEMPLATE_CACHE_H_
#define TEMPLATE_TEMPLATE_CACHE_H_
#include <hash_map> // for stdext::hash_map<>
#include <unordered_map> // for std::unordered_map<>
#include <string> // for string
#include <utility> // for pair
#include <vector> // for vector<>
@ -288,9 +288,9 @@ class CTEMPLATE_DLL_DECL TemplateCache {
public:
typedef std::pair<TemplateId, int> TemplateCacheKey;
private:
typedef stdext::hash_map<TemplateCacheKey, CachedTemplate, TemplateCacheHash>
typedef std::unordered_map<TemplateCacheKey, CachedTemplate, TemplateCacheHash>
TemplateMap;
typedef stdext::hash_map<RefcountedTemplate*, int, RefTplPtrHash> TemplateCallMap;
typedef std::unordered_map<RefcountedTemplate*, int, RefTplPtrHash> TemplateCallMap;
// Where to search for files.
typedef std::vector<std::string> TemplateSearchPath;

View File

@ -40,7 +40,7 @@
#define TEMPLATE_TEMPLATE_NAMELIST_H_
#include <time.h> // for time_t
#include <hash_set>
#include <unordered_set>
#include <string>
#include <vector>
#include <ctemplate/template_enums.h> // for Strip
@ -87,7 +87,7 @@ class CTEMPLATE_DLL_DECL TemplateNamelist {
// thing you should do with them is call size() and/or iterate
// between begin() and end(), and the only operations we promise
// the iterators will support are operator* and operator++.
typedef stdext::hash_set<std::string, StringHash> NameListType;
typedef std::unordered_set<std::string, StringHash> NameListType;
typedef std::vector<std::string> MissingListType;
typedef std::vector<std::string> SyntaxListType;

View File

@ -34,7 +34,7 @@
#define TEMPLATE_TEMPLATE_STRING_H_
#include <string.h> // for memcmp() and size_t
#include <hash_map>
#include <unordered_map>
#include <string>
#include <vector>
@ -142,7 +142,7 @@ struct CTEMPLATE_DLL_DECL StaticTemplateString {
} do_not_use_directly_;
// This class is a good hash_compare functor to pass in as the third
// argument to stdext::hash_map<>, when creating a map whose keys are
// argument to std::unordered_map<>, when creating a map whose keys are
// StaticTemplateString. NOTE: This class isn't that safe to use,
// because it requires that StaticTemplateStringInitializer has done
// its job. Unfortunately, even when you use the STS_INIT macro

View File

@ -99,8 +99,8 @@ template class __declspec(dllexport) std::vector<std::string>;\n\
-e "s!@ac_windows_dllexport_defines@!$MY_DLLDEF_DEFINES!g" \
-e "s!@ac_cv_cxx_hash_map@!$HASH_MAP_H!g" \
-e "s!@ac_cv_cxx_hash_set@!$HASH_SET_H!g" \
-e "s!@ac_cv_cxx_hash_map_class@!$HASH_NAMESPACE::hash_map!g" \
-e "s!@ac_cv_cxx_hash_set_class@!$HASH_NAMESPACE::hash_set!g" \
-e "s!@ac_cv_cxx_hash_map_class@!$HASH_NAMESPACE::unordered_map!g" \
-e "s!@ac_cv_cxx_hash_set_class@!$HASH_NAMESPACE::unordered_set!g" \
-e "s!@ac_google_attribute@!${HAVE___ATTRIBUTE__:-0}!g" \
-e "s!@ac_google_end_namespace@!$_END_GOOGLE_NAMESPACE_!g" \
-e "s!@ac_google_namespace@!$GOOGLE_NAMESPACE!g" \