fork(2) download
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. using namespace std;
  5.  
  6. class X
  7. {
  8. public:
  9. int x;
  10. };
  11.  
  12.  
  13. typedef std::vector<X> v1;
  14. typedef std::vector<v1> v2;
  15. typedef std::vector<v2> v3;
  16.  
  17.  
  18. void foo(X& x)
  19. {
  20. x.x++;
  21. }
  22.  
  23. int main()
  24. {
  25. v3 myVec(1024,v2(1,v1(1024,X())));
  26. int constant=0;
  27.  
  28. for(int cycle=0;cycle<1000;cycle++) // do it 10 times
  29. {
  30. for(int i=0;i<myVec.size();i++)
  31. {
  32. for(int j=0;j<myVec[i][constant].size();j++)
  33. {
  34. foo(myVec[i][constant][j]);
  35. }
  36.  
  37. }
  38. }
  39.  
  40. return 0;
  41. }
Success #stdin #stdout 2.35s 2808KB
stdin
Standard input is empty
stdout
Standard output is empty