<s>
auto_ptr	O
is	O
a	O
smart	B-Language
pointer	I-Language
class	O
template	B-Application
that	O
was	O
available	O
in	O
previous	O
versions	O
of	O
the	O
C++	B-Language
standard	I-Language
library	I-Language
(	O
declared	O
in	O
the	O
<memory>	O
header	B-Language
file	I-Language
)	O
,	O
which	O
provides	O
some	O
basic	O
RAII	B-Application
features	O
for	O
C++	O
raw	O
pointers	O
.	O
</s>
<s>
The	O
auto_ptr	O
template	B-Language
class	I-Language
describes	O
an	O
object	O
that	O
stores	O
a	O
pointer	O
to	O
a	O
single	O
allocated	O
object	O
that	O
ensures	O
that	O
the	O
object	O
to	O
which	O
it	O
points	O
gets	O
destroyed	O
automatically	O
when	O
control	O
leaves	O
a	O
scope	O
.	O
</s>
<s>
The	O
characteristics	O
of	O
auto_ptr	O
are	O
now	O
considered	O
unsatisfactory	O
:	O
it	O
was	O
introduced	O
before	O
11	O
's	O
move	O
semantics	O
,	O
so	O
it	O
uses	O
copying	O
for	O
what	O
should	O
be	O
done	O
with	O
moves	O
(	O
and	O
confusingly	O
sets	O
the	O
copied-from	O
auto_ptr	O
to	O
a	O
NULL	O
pointer	O
)	O
.	O
</s>
<s>
The	O
C++11	B-Language
standard	O
made	O
auto_ptr	O
deprecated	O
,	O
replacing	O
it	O
with	O
the	O
unique_ptr	O
class	O
template	B-Application
.	O
</s>
<s>
auto_ptr	O
was	O
fully	O
removed	O
in	O
C++17	B-Language
.	O
</s>
<s>
For	O
shared	O
ownership	O
,	O
the	O
shared_ptr	O
template	B-Language
class	I-Language
can	O
be	O
used	O
.	O
</s>
<s>
shared_ptr	O
was	O
defined	O
in	O
C++11	B-Language
and	O
is	O
also	O
available	O
in	O
the	O
Boost	B-Language
library	I-Language
for	O
use	O
with	O
previous	O
C++	O
versions	O
.	O
</s>
<s>
Notice	O
that	O
the	O
object	O
pointed	O
by	O
an	O
auto_ptr	O
is	O
destroyed	O
using	O
operator	B-Language
delete	I-Language
;	O
this	O
means	O
that	O
you	O
should	O
only	O
use	O
auto_ptr	O
for	O
pointers	O
obtained	O
with	O
operator	O
new	O
.	O
</s>
<s>
This	O
excludes	O
pointers	O
returned	O
by	O
malloc/calloc/realloc	B-Language
,	O
and	O
pointers	O
to	O
arrays	O
(	O
because	O
arrays	O
are	O
allocated	O
by	O
operator	O
new[]	O
and	O
must	O
be	O
deallocated	O
by	O
operator	O
delete[]	O
)	O
.	O
</s>
