Trie Class

(QmlJS::PersistentTrie::Trie)

The Trie class implements a trie that is persistent (not on disk but in memory). More...

Header: #include <Trie>

Detailed Description

This means that several versions can coexist, as adding an element is non-destructive, and as much as possible is shared.

The trie is only partially ordered. It preserves the order of the inserted elements as much as possible. This makes some operations a bit slower, but is considered a feature. This means the order in which you insert the elements matters.

An important use case for this is completions, and several strategies are available. Results order can be improved by using the matching strength.

All const operations are threadsafe, and copy is cheap (only a QSharedPointer copy).

Assigning a shared pointer is not threadsafe, so updating the head is not threadsafe, and should be done only on a local instance (shared pointer used only from a single thread), or protected with locks.

This is a two-level implementation, based on a fully functional implementation (PersistentTrie::Trie), which could be private but was left public because deemed useful.

Would gain from some memory optimization, or direct string implementation.