Tree-like structures implemented in C++