RB-tree transformed to template