Standard C++ Library Class Reference

Interface
template <class X> class auto_ptr {
public:
// constructor/copy/destroy
explicit auto_ptr (X* = 0);
auto_ptr (const auto_ptr<X>&);
void operator= (const auto_ptr<X>&);
~auto_ptr ();
// members
X& operator* () const;
X* operator-> () const;
X* get () const;
X* release ();
void reset (X* = 0);
};
Constructors and Destructors
explicit
auto_ptr (X* p = 0);
Constructs an object of class auto_ptr<X>, initializing the held pointer to p. Requires that
p points to an object of class X or a class derived from X for which delete p is defined
and accessible, or that p is a null pointer.
auto_ptr (const auto_ptr<X>& a);
Copy constructor. Constructs an object of class auto_ptr<X>, and copies the argument a
to *this. *this becomes the new owner of the underlying pointer.
~auto_ptr ();
Deletes the underlying pointer.
Operators
void
operator= (const auto_ptr<X>& a);
Assignment operator. Copies the argument a to *this. *this becomes the new owner of the
underlying pointer. If *this already owned a pointer, then that pointer is deleted first.
X&
operator* () const;
Returns a reference to the object to which the underlying pointer points.