Template Class Trie

Nested Relationships

Nested Types

Class Documentation

template<class V>
class Trie

a DICTIONARY of strings on a trie

Public Types

using Key = std::string

the type of the keys

using Value = V

the type of the values

using value_type = std::pair<std::string, const V&>
using size_type = std::size_t
using difference_type = std::ptrdiff_t
using reference = value_type
using const_reference = value_type
using const_iterator = detail::TrieIterator<Node, V, false>
using iterator = const_iterator

Public Functions

std::optional<V> lookup(std::string_view k) const
void insert(std::string_view k, const V &v)
Post:

k has the value v

void remove(std::string_view k)
Post:

k is not there

bool contains(std::string_view k) const
std::size_t size(void) const
std::vector<std::string> keysWithPrefix(std::string_view p) const

the keys that begin with p, in increasing order

std::size_t nodes(void) const

the number of nodes, the root included

inline const_iterator begin(void) const
inline const_iterator end(void) const
inline const_iterator cbegin(void) const
inline const_iterator cend(void) const