4 #include "wordsearch_solver/trie/node.hpp"
5 #include "wordsearch_solver/utility/flat_char_value_map.hpp"
8 #include <fmt/format.h>
9 #include <fmt/ostream.h>
10 #include <fmt/ranges.h>
14 #include <initializer_list>
18 #include <string_view>
20 #include <type_traits>
66 Trie& operator=(
const Trie&) =
delete;
68 Trie(
const std::initializer_list<std::string_view>& words);
69 Trie(
const std::initializer_list<std::string>& words);
70 Trie(
const std::initializer_list<const char*>& words);
72 template <
class Iterator1,
class Iterator2>
73 Trie(Iterator1 first,
const Iterator2 last);
77 template <
class Strings>
explicit Trie(Strings&& strings_in);
80 bool contains(std::string_view word)
const;
83 bool further(std::string_view word)
const;
86 template <
class OutputIterator>
88 const std::string_view suffixes,
89 OutputIterator contains_further_it)
const;
91 std::size_t size()
const;
94 friend std::ostream& operator<<(std::ostream& os,
const Trie& ct);
97 const Node*
search(std::string_view word)
const;
98 std::pair<Node*, bool>
insert(std::string_view word);
107 bool contains(
const Node& node, std::string_view word);
108 bool further(
const Node& node, std::string_view word);
114 #include "wordsearch_solver/trie/trie.tpp"
A vector of edges to child nodes, sorted by edge child node character value, and a bool indicating wh...
Definition: node.hpp:23
Recursive immutable node based trie.
Definition: trie.hpp:54
bool further(std::string_view word) const
Check if this dictionary might contain words with word as a prefix.
Definition: trie.cpp:49
void contains_further(const std::string_view stem, const std::string_view suffixes, OutputIterator contains_further_it) const
For each char in suffix appended to stem, check whether this dictionary contains this word and if it ...
Definition: trie.tpp:39
Trie(const Trie &)=delete
std::pair< Node *, bool > insert(std::string_view word)
Definition: trie.cpp:113
const Node * search(std::string_view word) const
Definition: trie.cpp:80
bool contains(std::string_view word) const
Check if this dictionary contains word.
Definition: trie.cpp:45
A small cache for each character of a word and an associated value, such as iterator into a trie for ...
Definition: flat_char_value_map.hpp:30
namespace trie
Definition: node.hpp:18