struct Tree {Tree* right; Tree* left;};
template <Tree* Tree::*one, Tree* Tree::*other>
void funcX(Tree* tree)
{
tree->*one = tree->*other;
tree->*one->*one = tree->*other->*other;
}
void func1(Tree* tree) { funcX<&Tree::left, &Tree::right>(tree); }
void func2(Tree* tree) { funcX<&Tree::right, &Tree::left>(tree); }