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

Standard output is empty