To only release the ownership of a pointer without destructing the object pointed by it, use member function release or auto_ptr::operator=|operator= instead.
Parameters
- p
- Pointer to element. Its value is set as the new internal pointer's value for the auto_ptr object.
X is auto_ptr's template parameter (i.e., the type pointed).
none
Return value
noneExample
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
|
Output:
5 10 |
See also
| auto_ptr::release | Release pointer (member function) |
| auto_ptr::operator= | Release and copy auto_ptr (public member function) |
| auto_ptr::get | Get pointer (public member function) |
