fork(3) download
  1. #include <vector>
  2. #include <iostream>
  3. #include <functional>
  4.  
  5. int main()
  6. {
  7. int x = 5;
  8.  
  9. std::vector<std::reference_wrapper<int>> v;
  10. v.push_back(std::reference_wrapper<int>(x));
  11.  
  12. x = 6;
  13.  
  14. std::cout << v[0]; // 6
  15. }
Success #stdin #stdout 0s 3016KB
stdin
Standard input is empty
stdout
6