4 #include <boost/container/small_vector.hpp>
6 #include <fmt/format.h>
7 #include <fmt/ostream.h>
14 #include <string_view>
15 #include <type_traits>
31 std::unique_ptr<Node> child;
38 using Edges = boost::container::small_vector<Edge, 4>;
40 using EdgesIterator = Edges::const_iterator;
43 Node(
bool is_end_of_word);
49 void set_is_end_of_word(
bool is_end_of_word);
51 const Node*
test(
const char c)
const;
53 bool is_end_of_word()
const;
55 friend std::ostream& operator<<(std::ostream& os,
const Node& node);
62 const Edges& edges()
const;
78 const Node* search(
const Node& node, std::string_view word);
A vector of edges to child nodes, sorted by edge child node character value, and a bool indicating wh...
Definition: node.hpp:23
const Node * test(const char c) const
Test if a node has an edge containing the character c.
Definition: node.cpp:68
Node * add_char(char c)
Inserts a child node corresponding to the character c if it doesn't exist, and returns a pointer to t...
Definition: node.cpp:43
namespace trie
Definition: node.hpp:18