explicit auto_ptr(T *p = 0) throw();
auto_ptr(const auto_ptr(auto_ptr<T>& rhs) throw();
The first constructor stores p
as the pointer to the allocated object. It stores true as the ownership indicator only if p
!= 0
. The second constructor transfers ownership of the pointer stored in rhs
, by storing both the pointer value and
the ownership indicator from rhs
in the constructed object. It effectively releases the pointer by calling
rhs.
release
()
.
In this implementation, if a translator does not support member template functions, the template:
template<class U>
auto_ptr(const auto_ptr(auto_ptr<U>& rhs) throw();
is replaced by:
auto_ptr(const auto_ptr(auto_ptr<T>& rhs);