fork(4) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. template <typename F, typename T1, typename T2>
  5. void flip2(F f, T1 &&t1, T2 &&t2)
  6. {
  7. f(std::forward<T2>(t2), t1);
  8. }
  9.  
  10. void g(int &&i, int &j)
  11. {
  12. cout << i << " " << j << endl;
  13. }
  14.  
  15. int main(void)
  16. {
  17. int i = 1;
  18. flip2(g, i, 42);
  19. }
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
42 1