| 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; |
| 15 |
explicit auto_ptr(X *p = 0) throw() {} |
| 16 |
auto_ptr(auto_ptr &) throw() {} |
| 17 |
template <class Y> auto_ptr(auto_ptr<Y> &) throw() {} |
| 18 |
auto_ptr &operator=(auto_ptr &) throw() { return *this; } |
| 19 |
template <class Y> auto_ptr &operator=(auto_ptr<Y> &) throw() { |
| 20 |
return *this; |
| 21 |
} |
| 22 |
auto_ptr &operator=(auto_ptr_ref<X> r) throw() { return *this; } |
| 23 |
~auto_ptr() throw() {} |
| 24 |
auto_ptr(auto_ptr_ref<X> r) throw() : x_(r.y_) {} |
| 25 |
template <class Y> operator auto_ptr_ref<Y>() throw() { |
| 26 |
auto_ptr_ref<Y> r; |
| 27 |
r.y_ = x_; |
| 28 |
return r; |
| 29 |
} |
| 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 |