You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
253 B

  1. #include <memory>
  2. std::auto_ptr<int> get_auto_ptr()
  3. {
  4. std::auto_ptr<int> ptr;
  5. ptr = std::auto_ptr<int>(new int(0));
  6. return ptr;
  7. }
  8. int use_auto_ptr(std::auto_ptr<int> ptr)
  9. {
  10. return *ptr;
  11. }
  12. int main()
  13. {
  14. return use_auto_ptr(get_auto_ptr());
  15. }