feat: use unordered_map instead of map

This commit is contained in:
mandlm 2024-03-22 15:37:13 +01:00
parent 8ca68b0e9a
commit 3f3ad0c765
Signed by: mandlm
GPG Key ID: 4AA25D647AA54CC7
4 changed files with 6 additions and 7 deletions

View File

@ -3,11 +3,11 @@
#include "finder.h" #include "finder.h"
#include "word_list.h" #include "word_list.h"
#include <map> #include <unordered_map>
class Bucket { class Bucket {
private: private:
std::map<char, WordRefList> directory_; std::unordered_map<char, WordRefList> directory_;
public: public:
void insert(const WordList &word_list, size_t first_index, size_t last_index); void insert(const WordList &word_list, size_t first_index, size_t last_index);

View File

@ -3,11 +3,11 @@
#include "finder.h" #include "finder.h"
#include "word_list.h" #include "word_list.h"
#include <map> #include <unordered_map>
class GroupedFinder : public Finder { class GroupedFinder : public Finder {
private: private:
std::map<char, WordRefList> groups_; std::unordered_map<char, WordRefList> groups_;
public: public:
GroupedFinder(const WordList &word_list); GroupedFinder(const WordList &word_list);

View File

@ -3,12 +3,12 @@
#include "finder.h" #include "finder.h"
#include "word_list.h" #include "word_list.h"
#include <map> #include <unordered_map>
class SearchTreeNode { class SearchTreeNode {
private: private:
WordRefList words_; WordRefList words_;
std::map<const char, SearchTreeNode> children_; std::unordered_map<char, SearchTreeNode> children_;
public: public:
void insert(std::string_view partial_word, const std::string *original_word); void insert(std::string_view partial_word, const std::string *original_word);

View File

@ -1,6 +1,5 @@
#include "grouped_finder.h" #include "grouped_finder.h"
#include <forward_list>
#include <mutex> #include <mutex>
#include <thread> #include <thread>
#include <vector> #include <vector>