The auto_ptr object must point to some object (must not be a null pointer) in order to be dereferenciable.
Parameters
noneReturn value
A reference to the element pointed by the auto_ptr 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 |
|
Output:
p1 points to: 10 p2 points to: 20 |
See also
| auto_ptr::get | Get pointer (public member function) |
| auto_ptr::reset | Deallocate object pointed and set new value (public member function) |
