binary tree c++ template based implementation