Created
July 27, 2016 00:19
-
-
Save Charles0429/30306a0fb5b4acf964528ffc71230f71 to your computer and use it in GitHub Desktop.
C++ template programming
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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