Standard C++ Library Class Reference
Click on the banner to return to the Class Reference home page.
©Copyright 1996 Rogue Wave Software
auto_ptr
Memory Management
Summary
A simple, smart pointer class.
Contents
Synopsis●
Description●
Interface●
Constructors and Destructors●
Operators●
Member Functions●
Example●
Synopsis
#include <memory>
template <class X> class auto_ptr;
Description
The template class auto_ptr holds onto a pointer obtained via new and deletes that object when
the auto_ptr object itself is destroyed (such as when leaving block scope). auto_ptr can be used
to make calls to operator new exception-safe. The auto_ptr class provides semantics of strict
ownership: an object may be safely pointed to by only one auto_ptr, so copying an auto_ptr
copies the pointer and transfers ownership to the destination.