fork download
  1. #include <iostream>
  2. #include <memory>
  3.  
  4. typedef std::shared_ptr<int> ptr;
  5.  
  6. ptr test()
  7. {
  8. return ptr(new int[10] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9});
  9. }
  10.  
  11. int main() {
  12. ptr a = test();
  13. for (int i = 0; i < 10; ++i)
  14. std::cout << a.get()[i];
  15. return 0;
  16. }
Success #stdin #stdout 0s 3228KB
stdin
Standard input is empty
stdout
0123456789