To force a destruction of the object pointed, use member function reset() instead.
The function returns a pointer to the object it pointed before the call, which is no longer its responsibility to destruct.
Parameters
noneReturn value
A pointer to the element pointed by the auto_ptr object before the call. After the call, the internal pointer's value is the null pointer (points to no object).X is auto_ptr's template parameter (i.e., the type pointed).
Example
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
|
Output:
manual_pointer points to 10 |
See also
| auto_ptr::reset | Deallocate object pointed and set new value (public member function) |
| auto_ptr::get | Get pointer (public member function) |
| auto_ptr::operator= | Release and copy auto_ptr (public member function) |
