fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. template<typename X = int> class Test
  5. {
  6. public:
  7. size_t size;
  8. X *tb;
  9. Test(size_t size):size(size),tb(new X[size]) {}
  10. ~Test() { delete[] tb; }
  11. X &operator[](size_t idx) { return tb[idx]; }
  12. };
  13.  
  14. int main()
  15. {
  16. Test<> a(5);
  17. a[3]=666;
  18. cout<<a[3]<<endl;
  19. return 0;
  20. }
Success #stdin #stdout 0s 3472KB
stdin
Standard input is empty
stdout
666