fork download
  1. #include <iostream>
  2. #include <cstring>
  3. #include <cstddef>
  4.  
  5. const size_t CHONK_SIZE = 1000000;
  6.  
  7. template<typename T>
  8. class chonk
  9. {
  10. public:
  11. chonk() : pc(nullptr) {}
  12. chonk(const chonk& rhs)
  13. : pc(new T[CHONK_SIZE])
  14. { memcpy(pc, rhs.pc, CHONK_SIZE*sizeof(T)); }
  15. private:
  16. T* pc;
  17. };
  18.  
  19. int main()
  20. {
  21. chonk<int> ci;
  22. chonk<float> cf;
  23. chonk<float> cg { cf };
  24. }
  25.  
Success #stdin #stdout 0.01s 5312KB
stdin
Standard input is empty
stdout
Standard output is empty