From 6373338c50a9431de7440b9274a079b4dc6c5755 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 7 Mar 2017 00:30:54 +0000 Subject: [PATCH] Replace uses of UnorderedMap with HashMap --- src/command_manager.cc | 32 ++++++++++++++++---------------- src/command_manager.hh | 4 ++-- src/commands.cc | 4 ++-- src/face_registry.cc | 14 +++++++------- src/face_registry.hh | 4 ++-- src/file.cc | 2 +- src/hash_map.cc | 3 ++- src/hash_map.hh | 13 ++++++++----- src/highlighters.cc | 4 ++-- src/input_handler.cc | 6 +++--- src/insert_completer.cc | 6 +++--- src/json_ui.cc | 6 +++--- src/keymap_manager.cc | 14 +++++++------- src/keymap_manager.hh | 4 ++-- src/ncurses_ui.cc | 20 ++++++++++---------- src/ncurses_ui.hh | 6 +++--- src/register_manager.cc | 4 ++-- src/register_manager.hh | 6 +++--- src/shared_string.cc | 13 ++++++------- src/shared_string.hh | 4 ++-- src/unordered_map.hh | 23 ----------------------- src/value.hh | 4 ++-- src/word_db.cc | 12 ++++++------ src/word_db.hh | 4 ++-- 24 files changed, 96 insertions(+), 116 deletions(-) delete mode 100644 src/unordered_map.hh diff --git a/src/command_manager.cc b/src/command_manager.cc index d8c5bc58..e3aea006 100644 --- a/src/command_manager.cc +++ b/src/command_manager.cc @@ -437,13 +437,13 @@ void CommandManager::execute_single_command(CommandParameters params, try { ParametersParser parameter_parser(param_view, - command_it->second.param_desc); - command_it->second.command(parameter_parser, context, shell_context); + command_it->value.param_desc); + command_it->value.command(parameter_parser, context, shell_context); } catch (runtime_error& error) { throw runtime_error(format("{}:{}: '{}' {}", pos.line+1, pos.column+1, - command_it->first, error.what())); + command_it->key, error.what())); } } @@ -507,11 +507,11 @@ Optional CommandManager::command_info(const Context& context, Strin return {}; CommandInfo res; - res.name = cmd->first; - if (not cmd->second.docstring.empty()) - res.info += cmd->second.docstring + "\n"; + res.name = cmd->key; + if (not cmd->value.docstring.empty()) + res.info += cmd->value.docstring + "\n"; - if (cmd->second.helper) + if (cmd->value.helper) { Vector params; for (auto it = tokens.begin() + cmd_idx + 1; @@ -523,7 +523,7 @@ Optional CommandManager::command_info(const Context& context, Strin it->type() == Token::Type::RawEval) params.push_back(it->content()); } - String helpstr = cmd->second.helper(context, params); + String helpstr = cmd->value.helper(context, params); if (not helpstr.empty()) { if (helpstr.back() != '\n') @@ -533,13 +533,13 @@ Optional CommandManager::command_info(const Context& context, Strin } String aliases; - for (auto& alias : context.aliases().aliases_for(cmd->first)) + for (auto& alias : context.aliases().aliases_for(cmd->key)) aliases += " " + alias; if (not aliases.empty()) res.info += "Aliases:" + aliases + "\n"; - auto& switches = cmd->second.param_desc.switches; + auto& switches = cmd->value.param_desc.switches; if (not switches.empty()) { res.info += "Switches:\n"; @@ -553,8 +553,8 @@ Completions CommandManager::complete_command_name(const Context& context, StringView query, bool with_aliases) const { auto commands = m_commands - | filter([](const CommandMap::value_type& cmd) { return not (cmd.second.flags & CommandFlags::Hidden); }) - | transform(std::mem_fn(&CommandMap::value_type::first)); + | filter([](const CommandMap::Item& cmd) { return not (cmd.value.flags & CommandFlags::Hidden); }) + | transform(std::mem_fn(&CommandMap::Item::key)); if (not with_aliases) return {0, query.length(), Kakoune::complete(query, query.length(), commands)}; @@ -636,7 +636,7 @@ Completions CommandManager::complete(const Context& context, auto command_it = find_command(context, command_name); if (command_it == m_commands.end() or - not command_it->second.completer) + not command_it->value.completer) return Completions(); Vector params; @@ -644,7 +644,7 @@ Completions CommandManager::complete(const Context& context, params.push_back(it->content()); if (tok_idx == tokens.size()) params.emplace_back(""); - Completions completions = offset_pos(command_it->second.completer( + Completions completions = offset_pos(command_it->value.completer( context, flags, params, tok_idx - cmd_idx - 1, cursor_pos_in_token), start); @@ -683,8 +683,8 @@ Completions CommandManager::complete(const Context& context, } auto command_it = find_command(context, command_name); - if (command_it != m_commands.end() and command_it->second.completer) - return command_it->second.completer( + if (command_it != m_commands.end() and command_it->value.completer) + return command_it->value.completer( context, flags, params.subrange(1), token_to_complete-1, pos_in_token); } diff --git a/src/command_manager.hh b/src/command_manager.hh index 7ef10f2c..5269ca39 100644 --- a/src/command_manager.hh +++ b/src/command_manager.hh @@ -10,7 +10,7 @@ #include "string.hh" #include "optional.hh" #include "utils.hh" -#include "unordered_map.hh" +#include "hash_map.hh" #include #include @@ -123,7 +123,7 @@ private: CommandHelper helper; CommandCompleter completer; }; - using CommandMap = UnorderedMap; + using CommandMap = HashMap; CommandMap m_commands; String m_last_complete_command; int m_command_depth = 0; diff --git a/src/commands.cc b/src/commands.cc index fd6b7552..943f843a 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -1780,7 +1780,7 @@ const CommandDesc prompt_cmd = { (event == PromptEvent::Change and on_change.empty())) return; - auto& text = sc.env_vars["text"] = str.str(); + auto& text = sc.env_vars["text"_sv] = str.str(); auto clear_password = on_scope_end([&] { if (flags & PromptFlags::Password) memset(text.data(), 0, (int)text.length()); @@ -1872,7 +1872,7 @@ const CommandDesc on_key_cmd = { CapturedShellContext sc{shell_context}; context.input_handler().on_next_key( KeymapMode::None, [=](Key key, Context& context) mutable { - sc.env_vars["key"] = key_to_str(key); + sc.env_vars["key"_sv] = key_to_str(key); ScopedSetBool disable_history{context.history_disabled()}; CommandManager::instance().execute(command, context, sc); diff --git a/src/face_registry.cc b/src/face_registry.cc index 8fb95a56..d0d15c10 100644 --- a/src/face_registry.cc +++ b/src/face_registry.cc @@ -48,9 +48,9 @@ Face FaceRegistry::operator[](const String& facedesc) auto it = m_aliases.find(facedesc); while (it != m_aliases.end()) { - if (it->second.alias.empty()) - return it->second.face; - it = m_aliases.find(it->second.alias); + if (it->value.alias.empty()) + return it->value.face; + it = m_aliases.find(it->value.alias); } return parse_face(facedesc); } @@ -75,11 +75,11 @@ void FaceRegistry::register_alias(const String& name, const String& facedesc, { while (it != m_aliases.end()) { - if (it->second.alias.empty()) + if (it->value.alias.empty()) break; - if (it->second.alias == name) + if (it->value.alias == name) throw runtime_error("face cycle detected"); - it = m_aliases.find(it->second.alias); + it = m_aliases.find(it->value.alias); } alias.alias = facedesc; @@ -95,7 +95,7 @@ CandidateList FaceRegistry::complete_alias_name(StringView prefix, ByteCount cursor_pos) const { return complete(prefix, cursor_pos, - m_aliases | transform(std::mem_fn(&AliasMap::value_type::first))); + m_aliases | transform(std::mem_fn(&AliasMap::Item::key))); } FaceRegistry::FaceRegistry() diff --git a/src/face_registry.hh b/src/face_registry.hh index 27879a85..1d493b0b 100644 --- a/src/face_registry.hh +++ b/src/face_registry.hh @@ -4,7 +4,7 @@ #include "face.hh" #include "utils.hh" #include "completion.hh" -#include "unordered_map.hh" +#include "hash_map.hh" namespace Kakoune { @@ -29,7 +29,7 @@ private: FaceOrAlias(Face face = Face{}) : face(face) {} }; - using AliasMap = UnorderedMap; + using AliasMap = HashMap; AliasMap m_aliases; }; diff --git a/src/file.cc b/src/file.cc index f5704d71..585c309a 100644 --- a/src/file.cc +++ b/src/file.cc @@ -477,7 +477,7 @@ CandidateList complete_command(StringView prefix, ByteCount cursor_pos) TimeSpec mtim = {}; Vector commands; }; - static UnorderedMap command_cache; + static HashMap command_cache; Vector matches; for (auto dir : StringView{getenv("PATH")} | split(':')) diff --git a/src/hash_map.cc b/src/hash_map.cc index bc2d6ce2..131dc615 100644 --- a/src/hash_map.cc +++ b/src/hash_map.cc @@ -6,6 +6,7 @@ #include "unit_tests.hh" #include +#include namespace Kakoune { @@ -148,7 +149,7 @@ void profile_hash_maps() { for (auto i : { 1000, 10000, 100000, 1000000, 10000000 }) { - do_profile>(i, "UnorderedMap"); + do_profile>(i, "UnorderedMap"); do_profile>(i, " HashMap "); } } diff --git a/src/hash_map.hh b/src/hash_map.hh index 6e4e1899..bbe9f1f9 100644 --- a/src/hash_map.hh +++ b/src/hash_map.hh @@ -128,14 +128,17 @@ private: Vector m_entries; }; +template +struct HashItem +{ + Key key; + Value value; +}; + template struct HashMap { - struct Item - { - Key key; - Value value; - }; + using Item = HashItem; HashMap() = default; diff --git a/src/highlighters.cc b/src/highlighters.cc index 358387e9..fe16f6c3 100644 --- a/src/highlighters.cc +++ b/src/highlighters.cc @@ -1425,7 +1425,7 @@ private: { size_t timestamp = 0; Vector matches; - UnorderedMap regions; + HashMap regions; }; BufferSideCache m_cache; @@ -1471,7 +1471,7 @@ private: auto it = cache.regions.find(range); if (it != cache.regions.end()) - return it->second; + return it->value; RegionList& regions = cache.regions[range]; diff --git a/src/input_handler.cc b/src/input_handler.cc index 30851fdb..6cac4b27 100644 --- a/src/input_handler.cc +++ b/src/input_handler.cc @@ -11,7 +11,7 @@ #include "normal.hh" #include "regex.hh" #include "register_manager.hh" -#include "unordered_map.hh" +#include "hash_map.hh" #include "user_interface.hh" #include "utf8.hh" #include "window.hh" @@ -944,7 +944,7 @@ private: PromptFlags m_flags; using History = Vector; - static UnorderedMap ms_history; + static HashMap ms_history; History::iterator m_history_it; void history_push(History& history, StringView entry) @@ -959,7 +959,7 @@ private: history.push_back(entry.str()); } }; -UnorderedMap Prompt::ms_history; +HashMap Prompt::ms_history; class NextKey : public InputMode { diff --git a/src/insert_completer.cc b/src/insert_completer.cc index 1bc30ea4..d54b85e3 100644 --- a/src/insert_completer.cc +++ b/src/insert_completer.cc @@ -91,7 +91,7 @@ InsertCompletion complete_word(const SelectionList& sels, const OptionManager& o BufferCoord word_begin; StringView prefix; - UnorderedMap sel_word_counts; + HashMap sel_word_counts; for (int i = 0; i < sels.size(); ++i) { Utf8It end{buffer.iterator_at(sels[i].cursor()), buffer}; @@ -136,8 +136,8 @@ InsertCompletion complete_word(const SelectionList& sels, const OptionManager& o // Remove words that are being edited for (auto& word_count : sel_word_counts) { - if (get_word_db(buffer).get_word_occurences(word_count.first) <= word_count.second) - unordered_erase(matches, word_count.first); + if (get_word_db(buffer).get_word_occurences(word_count.key) <= word_count.value) + unordered_erase(matches, word_count.key); } if (other_buffers) diff --git a/src/json_ui.cc b/src/json_ui.cc index f49807cc..1dada266 100644 --- a/src/json_ui.cc +++ b/src/json_ui.cc @@ -348,16 +348,16 @@ void JsonUI::eval_json(const Value& json) throw runtime_error("json request is not an object"); const JsonObject& object = json.as(); - auto json_it = object.find("jsonrpc"); + auto json_it = object.find("jsonrpc"_sv); if (json_it == object.end() or json_it->value.as() != "2.0") throw runtime_error("invalid json rpc request"); - auto method_it = object.find("method"); + auto method_it = object.find("method"_sv); if (method_it == object.end()) throw runtime_error("invalid json rpc request (method missing)"); StringView method = method_it->value.as(); - auto params_it = object.find("params"); + auto params_it = object.find("params"_sv); if (params_it == object.end()) throw runtime_error("invalid json rpc request (params missing)"); const JsonArray& params = params_it->value.as(); diff --git a/src/keymap_manager.cc b/src/keymap_manager.cc index ba6d16ed..4f332b20 100644 --- a/src/keymap_manager.cc +++ b/src/keymap_manager.cc @@ -11,27 +11,27 @@ namespace Kakoune void KeymapManager::map_key(Key key, KeymapMode mode, KeyList mapping, String docstring) { - m_mapping[{key, mode}] = {std::move(mapping), std::move(docstring)}; + m_mapping[KeyAndMode{key, mode}] = {std::move(mapping), std::move(docstring)}; } void KeymapManager::unmap_key(Key key, KeymapMode mode) { - m_mapping.erase({key, mode}); + m_mapping.unordered_remove(KeyAndMode{key, mode}); } bool KeymapManager::is_mapped(Key key, KeymapMode mode) const { - return m_mapping.find({key, mode}) != m_mapping.end() or + return m_mapping.find(KeyAndMode{key, mode}) != m_mapping.end() or (m_parent and m_parent->is_mapped(key, mode)); } const KeymapManager::KeyMapInfo& KeymapManager::get_mapping(Key key, KeymapMode mode) const { - auto it = m_mapping.find({key, mode}); + auto it = m_mapping.find(KeyAndMode{key, mode}); if (it != m_mapping.end()) - return it->second; + return it->value; kak_assert(m_parent); return m_parent->get_mapping(key, mode); } @@ -43,8 +43,8 @@ KeymapManager::KeyList KeymapManager::get_mapped_keys(KeymapMode mode) const res = m_parent->get_mapped_keys(mode); for (auto& map : m_mapping) { - if (map.first.second == mode) - res.emplace_back(map.first.first); + if (map.key.second == mode) + res.emplace_back(map.key.first); } std::sort(res.begin(), res.end()); res.erase(std::unique(res.begin(), res.end()), res.end()); diff --git a/src/keymap_manager.hh b/src/keymap_manager.hh index f2782ecb..3d89ed99 100644 --- a/src/keymap_manager.hh +++ b/src/keymap_manager.hh @@ -5,7 +5,7 @@ #include "keys.hh" #include "hash.hh" #include "string.hh" -#include "unordered_map.hh" +#include "hash_map.hh" #include "vector.hh" namespace Kakoune @@ -51,7 +51,7 @@ private: KeymapManager* m_parent; using KeyAndMode = std::pair; - UnorderedMap m_mapping; + HashMap m_mapping; }; } diff --git a/src/ncurses_ui.cc b/src/ncurses_ui.cc index 49044bf2..a6e0d31a 100644 --- a/src/ncurses_ui.cc +++ b/src/ncurses_ui.cc @@ -132,7 +132,7 @@ int NCursesUI::get_color(Color color) { auto it = m_colors.find(color); if (it != m_colors.end()) - return it->second; + return it->value; else if (m_change_colors and can_change_color() and COLORS > 16) { kak_assert(color.color == Color::RGB); @@ -171,7 +171,7 @@ int NCursesUI::get_color_pair(const Face& face) ColorPair colors{face.fg, face.bg}; auto it = m_colorpairs.find(colors); if (it != m_colorpairs.end()) - return it->second; + return it->value; else { init_pair(m_next_pair, get_color(face.fg), get_color(face.bg)); @@ -214,7 +214,7 @@ void on_term_resize(int) EventManager::instance().force_signal(0); } -static const std::initializer_list> +static const std::initializer_list::Item> default_colors = { { Color::Default, -1 }, { Color::Black, COLOR_BLACK }, @@ -1005,7 +1005,7 @@ void NCursesUI::enable_mouse(bool enabled) void NCursesUI::set_ui_options(const Options& options) { { - auto it = options.find("ncurses_assistant"); + auto it = options.find("ncurses_assistant"_sv); if (it == options.end() or it->value == "clippy") m_assistant = assistant_clippy; else if (it->value == "cat") @@ -1015,19 +1015,19 @@ void NCursesUI::set_ui_options(const Options& options) } { - auto it = options.find("ncurses_status_on_top"); + auto it = options.find("ncurses_status_on_top"_sv); m_status_on_top = it != options.end() and (it->value == "yes" or it->value == "true"); } { - auto it = options.find("ncurses_set_title"); + auto it = options.find("ncurses_set_title"_sv); m_set_title = it == options.end() or (it->value == "yes" or it->value == "true"); } { - auto it = options.find("ncurses_change_colors"); + auto it = options.find("ncurses_change_colors"_sv); auto value = it == options.end() or (it->value == "yes" or it->value == "true"); @@ -1045,16 +1045,16 @@ void NCursesUI::set_ui_options(const Options& options) } { - auto enable_mouse_it = options.find("ncurses_enable_mouse"); + auto enable_mouse_it = options.find("ncurses_enable_mouse"_sv); enable_mouse(enable_mouse_it == options.end() or enable_mouse_it->value == "yes" or enable_mouse_it->value == "true"); - auto wheel_up_it = options.find("ncurses_wheel_up_button"); + auto wheel_up_it = options.find("ncurses_wheel_up_button"_sv); m_wheel_up_button = wheel_up_it != options.end() ? str_to_int_ifp(wheel_up_it->value).value_or(4) : 4; - auto wheel_down_it = options.find("ncurses_wheel_down_button"); + auto wheel_down_it = options.find("ncurses_wheel_down_button"_sv); m_wheel_down_button = wheel_down_it != options.end() ? str_to_int_ifp(wheel_down_it->value).value_or(5) : 5; } diff --git a/src/ncurses_ui.hh b/src/ncurses_ui.hh index 379d8a33..521d8020 100644 --- a/src/ncurses_ui.hh +++ b/src/ncurses_ui.hh @@ -6,7 +6,7 @@ #include "face.hh" #include "user_interface.hh" #include "array_view.hh" -#include "unordered_map.hh" +#include "hash_map.hh" namespace Kakoune { @@ -77,8 +77,8 @@ private: DisplayCoord m_dimensions; using ColorPair = std::pair; - UnorderedMap m_colors; - UnorderedMap m_colorpairs; + HashMap m_colors; + HashMap m_colorpairs; int m_next_color = 16; int m_next_pair = 1; int m_active_pair = -1; diff --git a/src/register_manager.cc b/src/register_manager.cc index 635d05bc..d2133e95 100644 --- a/src/register_manager.cc +++ b/src/register_manager.cc @@ -35,10 +35,10 @@ Register& RegisterManager::operator[](Codepoint c) const if (it == m_registers.end()) throw runtime_error(format("no such register: '{}'", c)); - return *(it->second); + return *(it->value); } -void RegisterManager::add_register(char c, std::unique_ptr reg) +void RegisterManager::add_register(Codepoint c, std::unique_ptr reg) { auto& reg_ptr = m_registers[c]; kak_assert(not reg_ptr); diff --git a/src/register_manager.hh b/src/register_manager.hh index 548f012f..9ee9d9f8 100644 --- a/src/register_manager.hh +++ b/src/register_manager.hh @@ -4,7 +4,7 @@ #include "array_view.hh" #include "exception.hh" #include "utils.hh" -#include "unordered_map.hh" +#include "hash_map.hh" #include "string.hh" #include "vector.hh" @@ -100,10 +100,10 @@ class RegisterManager : public Singleton public: Register& operator[](StringView reg) const; Register& operator[](Codepoint c) const; - void add_register(char c, std::unique_ptr reg); + void add_register(Codepoint c, std::unique_ptr reg); protected: - UnorderedMap, MemoryDomain::Registers> m_registers; + HashMap, MemoryDomain::Registers> m_registers; }; } diff --git a/src/shared_string.cc b/src/shared_string.cc index 6cf270c2..eb12ca27 100644 --- a/src/shared_string.cc +++ b/src/shared_string.cc @@ -25,19 +25,18 @@ StringDataPtr StringData::Registry::intern(StringView str) { auto it = m_strings.find(str); if (it != m_strings.end()) - return StringDataPtr{it->second}; + return StringDataPtr{it->value}; auto data = StringData::create(str); data->refcount |= interned_flag; - m_strings.emplace(data->strview(), data.get()); + m_strings.insert({data->strview(), data.get()}); return data; } void StringData::Registry::remove(StringView str) { - auto it = m_strings.find(str); - kak_assert(it != m_strings.end()); - m_strings.erase(it); + kak_assert(m_strings.contains(str)); + m_strings.unordered_remove(str); } void StringData::Registry::debug_stats() const @@ -48,8 +47,8 @@ void StringData::Registry::debug_stats() const size_t count = m_strings.size(); for (auto& st : m_strings) { - total_refcount += st.second->refcount - 1; - total_size += (int)st.second->length; + total_refcount += st.value->refcount - 1; + total_size += (int)st.value->length; } write_to_debug_buffer(format(" data size: {}, mean: {}", total_size, (float)total_size/count)); write_to_debug_buffer(format(" refcounts: {}, mean: {}", total_refcount, (float)total_refcount/count)); diff --git a/src/shared_string.hh b/src/shared_string.hh index b3906ea3..a2c0345a 100644 --- a/src/shared_string.hh +++ b/src/shared_string.hh @@ -4,7 +4,7 @@ #include "string.hh" #include "ref_ptr.hh" #include "utils.hh" -#include "unordered_map.hh" +#include "hash_map.hh" #include @@ -53,7 +53,7 @@ public: void remove(StringView str); private: - UnorderedMap m_strings; + HashMap m_strings; }; static Ptr create(ArrayView strs); diff --git a/src/unordered_map.hh b/src/unordered_map.hh deleted file mode 100644 index 23897c85..00000000 --- a/src/unordered_map.hh +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef unordered_map_hh_INCLUDED -#define unordered_map_hh_INCLUDED - -#include "hash.hh" -#include "memory.hh" - -#include -#include - -namespace Kakoune -{ - -template::domain()> -using UnorderedMap = std::unordered_map, std::equal_to, - Allocator, domain>>; - -template::domain()> -using UnorderedSet = std::unordered_set, std::equal_to, - Allocator>; - -} - -#endif // unordered_map_hh_INCLUDED diff --git a/src/value.hh b/src/value.hh index 941c3ffb..df952434 100644 --- a/src/value.hh +++ b/src/value.hh @@ -1,7 +1,7 @@ #ifndef value_hh_INCLUDED #define value_hh_INCLUDED -#include "unordered_map.hh" +#include "hash_map.hh" #include "units.hh" #include @@ -76,7 +76,7 @@ inline ValueId get_free_value_id() return (ValueId)(next++); } -using ValueMap = UnorderedMap; +using ValueMap = HashMap; } diff --git a/src/word_db.cc b/src/word_db.cc index 3fc9daf6..cb4dc669 100644 --- a/src/word_db.cc +++ b/src/word_db.cc @@ -45,7 +45,7 @@ void WordDB::add_words(StringView line) { auto it = m_words.find(w); if (it != m_words.end()) - ++it->second.refcount; + ++it->value.refcount; else { auto word = intern(w); @@ -60,9 +60,9 @@ void WordDB::remove_words(StringView line) for (auto& w : get_words(line, get_extra_word_chars(*m_buffer))) { auto it = m_words.find(w); - kak_assert(it != m_words.end() and it->second.refcount > 0); - if (--it->second.refcount == 0) - m_words.erase(it); + kak_assert(it != m_words.end() and it->value.refcount > 0); + if (--it->value.refcount == 0) + m_words.unordered_remove(it->key); } } @@ -159,7 +159,7 @@ int WordDB::get_word_occurences(StringView word) const { auto it = m_words.find(word); if (it != m_words.end()) - return it->second.refcount; + return it->value.refcount; return 0; } @@ -170,7 +170,7 @@ RankedMatchList WordDB::find_matching(StringView query) RankedMatchList res; for (auto&& word : m_words) { - if (RankedMatch match{word.first, word.second.letters, query, letters}) + if (RankedMatch match{word.key, word.value.letters, query, letters}) res.push_back(match); } diff --git a/src/word_db.hh b/src/word_db.hh index 07b56f34..23c77695 100644 --- a/src/word_db.hh +++ b/src/word_db.hh @@ -3,7 +3,7 @@ #include "buffer.hh" #include "shared_string.hh" -#include "unordered_map.hh" +#include "hash_map.hh" #include "vector.hh" #include "ranked_match.hh" @@ -39,7 +39,7 @@ private: UsedLetters letters; int refcount; }; - using WordToInfo = UnorderedMap; + using WordToInfo = HashMap; using Lines = Vector; SafePtr m_buffer;