[ create a new paste ] login | about

Link: http://codepad.org/pMp2PuSI    [ raw code | fork ]

C++, pasted on May 10:
1
2
3
4
5
6
7
8
9
10
11
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); }


Create a new paste based on this one


Comments: