fork(2) download
  1. #include <iostream>
  2. #include <memory>
  3.  
  4. using namespace std;
  5.  
  6. weak_ptr<int> test() {
  7. shared_ptr<int> foo{new int};
  8.  
  9. return foo;
  10. }
  11.  
  12. int main() {
  13. auto foo = test();
  14.  
  15. cout << foo.expired() << endl;
  16. return 0;
  17. }
Success #stdin #stdout 0s 3416KB
stdin
Standard input is empty
stdout
1