From 3ba95dbf3e25ea7fedb472efff1b4b0edbcce7a9 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 18 Jun 2018 10:05:44 -0700 Subject: [PATCH] Represent tag name map as a std::map This doesn't seem to affect performance, and unordered_map requires C++11. --- src/tag.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/tag.h b/src/tag.h index 429ebb2..da9420c 100644 --- a/src/tag.h +++ b/src/tag.h @@ -1,8 +1,8 @@ #include -#include +#include using std::string; -using std::unordered_map; +using std::map; enum TagType { AREA, @@ -137,8 +137,8 @@ enum TagType { }; -static const unordered_map get_tag_map() { - unordered_map result; +static const map get_tag_map() { + map result; #define TAG(name) result[#name] = name TAG(AREA); TAG(BASE); @@ -269,7 +269,7 @@ static const unordered_map get_tag_map() { return result; } -static const unordered_map TAG_TYPES_BY_TAG_NAME = get_tag_map(); +static const map TAG_TYPES_BY_TAG_NAME = get_tag_map(); static const TagType TAG_TYPES_NOT_ALLOWED_IN_PARAGRAPHS[] = { ADDRESS, @@ -368,7 +368,7 @@ struct Tag { } static inline Tag for_name(const string &name) { - unordered_map::const_iterator type = TAG_TYPES_BY_TAG_NAME.find(name); + map::const_iterator type = TAG_TYPES_BY_TAG_NAME.find(name); if (type != TAG_TYPES_BY_TAG_NAME.end()) { return Tag(type->second, string()); } else {