/// \brief Returns size and total sum of symbols template <typename T> std::pair<size_t, size_t> total_size(trie<T> const & t) { size_t count = 0; size_t total_count = 0; t.for_each([&count, &total_count](std::vector<T> const & w) { ++count; total_count += w.size(); }); return {count, total_count}; }
/// \brief Flattens a trie \p t /// \returns an array of words (without the prefixes) template <typename T> std::vector<std::vector<T>> flatten(trie<T> const & t) { std::vector<std::vector<T>> ret; t.for_each([&ret](std::vector<T> const & w) { ret.push_back(w); }); return ret; }