fork(2) download
  1. #include <iostream>
  2. #include <memory>
  3. using namespace std;
  4.  
  5. struct S
  6. {
  7. S() { cout << "ctor\n"; }
  8. ~S() { cout << "dtor\n"; }
  9. void Foo() { cout << "Foo\n"; }
  10. };
  11.  
  12. std::unique_ptr<S> gS;
  13.  
  14. int main() {
  15. cout << "main\n";
  16. std::move(gS)->Foo();
  17. cout << "end main\n";
  18. return 0;
  19. }
Success #stdin #stdout 0s 4512KB
stdin
Standard input is empty
stdout
main
Foo
end main