fork(1) download
  1. #include <iostream>
  2. #include <utility>
  3.  
  4. using namespace std;
  5.  
  6. pair<int, int> test() {
  7. return make_pair(13, 42);
  8. }
  9.  
  10. int main() {
  11. int a = 1, b = 2;
  12.  
  13. pair<int&, int&>(a, b) = test();
  14. // make_pair<int&, int&>(a, b) = test();
  15.  
  16. cout << a << ' ' << b << endl;
  17. }
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
13 42