#include "matchings_trie.h" void MatchingsTrie::Reset() { ResetTree(root); root = make_shared(); } shared_ptr MatchingsTrie::GetRoot() const { return root; } void MatchingsTrie::ResetTree(shared_ptr root) { if (root != NULL) { for (auto child: root->children) { ResetTree(child.second); } if (root->suffix_link != NULL) { root->suffix_link.reset(); } root.reset(); } }