auto_ptr<T>& operator=(auto_ptr<>& rhs) throw();
The assignment operator deletes any pointer p
that it owns, by evaluating the delete
expression delete p
. It then
transfers ownership of the pointer stored in rhs
, by storing both the pointer value and the ownership indicator from rhs
in *this
. It effectively releases the pointer by calling rhs.
release
()
. The function returns *this
.
In this implementation, if a translator does not support member template functions, the template:
template<class U>
auto_ptr<T>& operator=(auto_ptr<U>& rhs) throw();
is replaced by:
auto_ptr<T>& operator=(auto_ptr<T>& rhs);