fork download
  1. #include <thread>
  2. #include <vector>
  3. #include <iostream>
  4. using namespace std;
  5.  
  6. void fun(vector<int> & v) {
  7. v.push_back(13);
  8. }
  9.  
  10. int main(){
  11. vector<int> v;
  12. thread t([&](){ fun(v); });
  13. t.join();
  14. cout << v.size();
  15. }
Success #stdin #stdout 0s 82816KB
stdin
Standard input is empty
stdout
1