diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2014-10-28 19:23:02 +0000 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2014-10-28 19:23:02 +0000 |
| commit | fa886ffaac83ff4f4e646ffe361fee355ea0cb10 (patch) | |
| tree | 25e6243d39b7cc8ec5d60fb7a604f231d4400a82 /src/word_db.hh | |
| parent | c2c980c4843effe4c76271290d0d6dc6cf540766 (diff) | |
Refactor word_db, use an unordered map
Diffstat (limited to 'src/word_db.hh')
| -rw-r--r-- | src/word_db.hh | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/word_db.hh b/src/word_db.hh index ee4e6ab5..999d03b0 100644 --- a/src/word_db.hh +++ b/src/word_db.hh @@ -5,6 +5,7 @@ #include "interned_string.hh" #include <map> +#include <bitset> namespace Kakoune { @@ -14,12 +15,20 @@ class WordDB { public: WordDB(const Buffer& buffer); + WordDB(const WordDB&) { kak_assert(false); } + WordDB(WordDB&&) = default; std::vector<InternedString> find_prefix(StringView prefix); std::vector<InternedString> find_subsequence(StringView subsequence); int get_word_occurences(StringView word) const; - using WordList = std::map<InternedString, int>; + using UsedChars = std::bitset<64>; + struct WordInfo + { + UsedChars letters; + int refcount; + }; + using WordList = std::unordered_map<InternedString, WordInfo>; private: using LineToWords = std::vector<std::vector<InternedString>>; |
