Continue to my own discussion:
For a trie implementation now in Code completion plugin, the search tree achitecture was designed by Rick22, and it is mainly something like:
To record many Token with the same name, we usually use a TokenIndex structure.(which is a map<Index to Token>).
Here is the belief SearchTree structure steps:
1, we know that a Token is allocated from a memory pool, and its address was recorded in a
vector<Token*> structure.
2, From the step 1, we can refer to any Token by a
index in the
vector<Token*>3, For some Tokens which were different types but have the "same" name, such as:
int abc;
int abc();
class abc{
XXXXX
}
All of the three Tokens above have its name "abc", so, we use a
set<index> which contains all the Token index share the same Token names.
4, Our search tree is just something like
map<wxString, set<index>>, which the key is a wxString. So, actually, we choose a memory efficient data structure called trie, it is like
trie<wxString, set<index>5, given the trie, we can query any Tokens in this trie by its name, or by a pre-fix names.
My question is:
Why do we need a vector<Token*>, is it necessary?
I think we can just skip the step 1,2,3, and directly use
trie<wxString, set<Token*>>Any comments about my suggestion? Thanks.