simple m-ary tree implementation in C++