#pragma once
#include "finder.h"
#include "word_list.h"
#include <map>
class SearchTreeNode {
private:
WordRefList words_;
std::map<const char, SearchTreeNode> children_;
public:
void insert(std::string_view partial_word, const std::string *original_word);
const SearchTreeNode *find(std::string_view search_term) const;
WordRefList words() const;
};
class SearchTree : public SearchTreeNode {
SearchTree(const WordList &word_list);
class TreeFinder : public Finder {
SearchTree search_tree_;
TreeFinder(const WordList &word_list);
WordRefList find_prefix(std::string_view search_term) const override;