#include "empty_class.h" #include #include #include #include template struct TrieT { struct Node : public BaseNode { Node() { std::ranges::fill(go, nullptr); } std::array go; }; explicit TrieT(int n) : node_count{1}, nodes(1 + n) {} Node *root() { return nodes.data(); } Node *extend(Node *p, int c) { if (p->go[c] == nullptr) { p->go[c] = new (nodes.data() + (node_count++)) Node(); } return p->go[c]; } protected: int node_count; std::vector nodes; };