fork(1) download
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5. struct S;
  6.  
  7. vector<S> v;
  8.  
  9. struct S {
  10. int value;
  11. void f() {
  12. v.push_back({2});
  13. value = 3;
  14. }
  15. };
  16.  
  17. int main() {
  18. v.push_back({1});
  19. v[0].f();
  20.  
  21. for (S s : v)
  22. cout << s.value << endl;
  23. }
Runtime error #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
Standard output is empty