Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
C++ template programming
#include <iostream>
template <typename F, typename T1, typename T2>
void flip2(F f, T1 &&t1, T2 &&t2)
{
f(t2, t1);
}
void g(int &&i, int &j)
{
cout << i << " " << j << endl;
}
int main(void)
{
int i = 1;
flip2(g, i, 42);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment