Prefixtree implementation in C++