halcheck 1.0
Loading...
Searching...
No Matches
halcheck::lib::trie< K, V, Hash > Class Template Reference

An implementation of a trie. Semantically, this corresponds to a function \(K^* \to V\). More...

#include <trie.hpp>

Classes

class  iterator
 Represents a pointer to a child trie. More...
 

Public Member Functions

 trie ()=default
 Constructs a trie where every node is assigned the same value.
 
template<typename I >
 trie (V value, I first, I last)
 Constructs a trie with a given value and set of children.
 
template<typename R >
 trie (V value, R &&range)
 Constructs a trie with a given value and set of children.
 
const V & operator* () const
 Gets the value associated with the root node of this trie.
 
template<typename R >
const V & operator[] (const R &range) const
 Gets the value associated with a specific node.
 
template<typename R >
trie drop (const R &range) const
 Gets a specific subtree.
 
template<typename I >
trie drop (I first, I last) const
 Gets a specific subtree.
 
trie drop (const K &key) const
 Gets a specific subtree.
 
template<typename I >
trie set (I first, I last, V value) const
 Constructs a new trie with a specific value replaced.
 
template<typename R >
trie set (const R &range, V value) const
 Constructs a new trie with a specific value replaced.
 
iterator begin () const
 Returns an iterator to the first child.
 
iterator end () const
 Returns an iterator to one past the last child.
 
std::size_t size () const
 Returns the number of children in this trie.
 
bool empty () const
 Determines whether this trie has any children.
 
iterator find (const K &key) const
 Gets an iterator to the child indicated by the given key.
 

Detailed Description

template<typename K, typename V, typename Hash = std::hash<K>>
class halcheck::lib::trie< K, V, Hash >

An implementation of a trie. Semantically, this corresponds to a function \(K^* \to V\).

See also
https://en.wikipedia.org/wiki/Trie
Template Parameters
KThe type used to index child nodes.
VThe type of value stored in each node.

The documentation for this class was generated from the following file: