1
Fork 0
mirror of https://github.com/Jaxan/hybrid-ads.git synced 2025-04-27 15:07:45 +02:00
hybrid-ads/lib/trie.cpp
2015-04-20 10:09:07 +02:00

17 lines
411 B
C++

#include "trie.hpp"
std::vector<std::vector<size_t>> flatten(const trie & t) {
std::vector<std::vector<size_t>> ret;
t.for_each([&ret](auto && w) { ret.push_back(w); });
return ret;
}
std::pair<size_t, size_t> total_size(const trie & t) {
size_t count = 0;
size_t total_count = 0;
t.for_each([&count, &total_count](auto && w) {
++count;
total_count += w.size();
});
return {count, total_count};
}