fork(2) download
  1. #include <iostream>
  2. #include <vector>
  3. #include <memory>
  4.  
  5. struct Test: std::vector<int> {
  6. Test(): std::vector<int>{1,2,3} {
  7. std::cout << __PRETTY_FUNCTION__ << '\n';
  8. }
  9.  
  10. ~Test() {
  11. std::cout << __PRETTY_FUNCTION__ << '\n';
  12. }
  13. };
  14.  
  15. Test func() {
  16. return Test();
  17. }
  18.  
  19. int main() {
  20. for (const auto &obj: func()) {
  21. std::cout << obj << '\n';
  22.  
  23. }
  24. }
  25.  
Success #stdin #stdout 0s 2984KB
stdin
Standard input is empty
stdout
Test::Test()
1
2
3
Test::~Test()