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