standard C++ implementation of a trie