fork download
  1. #include <iostream>
  2.  
  3. template <unsigned long size>
  4. struct BigObject
  5. {
  6. unsigned long array[size * size];
  7. BigObject<size - 1> object;
  8. };
  9.  
  10.  
  11. template <>
  12. struct BigObject<0>
  13. {
  14. unsigned long array[1];
  15. };
  16.  
  17. BigObject<900>& recurse(BigObject<900>& object1, unsigned long n)
  18. {
  19. if (n == 0)
  20. {
  21. return object1;
  22. }
  23.  
  24. BigObject<900> object;
  25.  
  26. return recurse(object, n);
  27. }
  28.  
  29. int main(int argc, char const *argv[])
  30. {
  31. BigObject<900> object;
  32. recurse(object, 20);
  33.  
  34. std::cout << sizeof(object) << std::endl;
  35. return 0;
  36. }
Runtime error #stdin #stdout 0s 3292KB
stdin
Standard input is empty
stdout
Standard output is empty