1 #ifndef INPUTS_MEMORY_H 2 #define INPUTS_MEMORY_H 3 4 namespace std { 5 6 inline namespace _1 { 7 8 template <class Y> struct auto_ptr_ref { 9 Y *y_; 10 }; 11 12 template <class X> class auto_ptr { 13 public: 14 typedef X element_type; throw()15 explicit auto_ptr(X *p = 0) throw() {} throw()16 auto_ptr(auto_ptr &) throw() {} auto_ptr(auto_ptr<Y> &)17 template <class Y> auto_ptr(auto_ptr<Y> &) throw() {} throw()18 auto_ptr &operator=(auto_ptr &) throw() { return *this; } throw()19 template <class Y> auto_ptr &operator=(auto_ptr<Y> &) throw() { 20 return *this; 21 } throw()22 auto_ptr &operator=(auto_ptr_ref<X> r) throw() { return *this; } throw()23 ~auto_ptr() throw() {} throw()24 auto_ptr(auto_ptr_ref<X> r) throw() : x_(r.y_) {} throw()25 template <class Y> operator auto_ptr_ref<Y>() throw() { 26 auto_ptr_ref<Y> r; 27 r.y_ = x_; 28 return r; 29 } throw()30 template <class Y> operator auto_ptr<Y>() throw() { return auto_ptr<Y>(x_); } 31 32 private: 33 X *x_; 34 }; 35 36 template <> class auto_ptr<void> { 37 public: 38 typedef void element_type; 39 }; 40 41 } // namespace _1 42 43 } // end namespace std 44 45 #endif // INPUTS_MEMORY_H 46