Basic prefix trie data structure in C++