summaryrefslogtreecommitdiff
path: root/src/word_db.hh
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2014-10-28 19:23:02 +0000
committerMaxime Coste <frrrwww@gmail.com>2014-10-28 19:23:02 +0000
commitfa886ffaac83ff4f4e646ffe361fee355ea0cb10 (patch)
tree25e6243d39b7cc8ec5d60fb7a604f231d4400a82 /src/word_db.hh
parentc2c980c4843effe4c76271290d0d6dc6cf540766 (diff)
Refactor word_db, use an unordered map
Diffstat (limited to 'src/word_db.hh')
-rw-r--r--src/word_db.hh11
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>>;