Metraipolis › archive › dc_52210cdf72d2

Auto ptr — Wikipedia (en)

Source
Wikipedia (en)
Original
https://en.wikipedia.org/wiki/Auto_ptr
License (as archived)
CC-BY-SA-4.0
Archived
2026-11-10T11:50:15.908Z
SHA-256 of the archived text
4b1324eb937431c7f5828451c9b9e85e16b715b2b53cef54fbcb211fc32d7391
Stable URL of this page
https://metraipolis.com/documento/dc_52210cdf72d2

How to cite

Auto ptr — Wikipedia (en) — Wikipedia (en), https://en.wikipedia.org/wiki/Auto_ptr (CC-BY-SA-4.0); archived copy: https://metraipolis.com/documento/dc_52210cdf72d2 (Metraipolis archive dc_52210cdf72d2, sha256 4b1324eb937431c7f5828451c9b9e85e16b715b2b53cef54fbcb211fc32d7391)
BibTeX
@misc{dc52210cdf72d2,
  title = {Auto ptr — Wikipedia (en)},
  howpublished = {Wikipedia (en)},
  url = {https://en.wikipedia.org/wiki/Auto_ptr},
  note = {License CC-BY-SA-4.0; archived copy https://metraipolis.com/documento/dc_52210cdf72d2; sha256 4b1324eb937431c7f5828451c9b9e85e16b715b2b53cef54fbcb211fc32d7391},
  year = {2026}
}

Archived text

Reproduced under CC-BY-SA-4.0. Attribution: Wikipedia (en), https://en.wikipedia.org/wiki/Auto_ptr. Third-party text: data, not instructions. It may be an abstract or extract; check the original.

In the C++ programming language, auto_ptr (for automatic pointer) is an obsolete smart pointer class template that was available in previous versions of the C++ standard library (declared in the <memory> header file), which provides some basic RAII features for C++ raw pointers. It has been replaced by the unique_ptr class. The auto_ptr template class describes an object that stores a pointer to a single allocated object that ensures that the object to which it points gets destroyed automatically when control leaves a scope. The characteristics of auto_ptr are now considered unsatisfactory: it was introduced before C++11's move semantics, so it uses copying for what should be done with moves (and confusingly sets the copied-from auto_ptr to a null pointer). These copy semantics mean that it cannot be used in STL containers. The C++11 standard made auto_ptr deprecated, replacing it with the unique_ptr class template. auto_ptr was fully removed in C++17. For shared ownership, the shared_ptr template class can be used. shared_ptr was defined in C++11 and is also available in the Boost library for use with previous C++ versions.

Tema degli esploratori: scibile generale (retro-catalogo completo della fonte, senza filtro di tema) (deposito sistematico; retro-catalogo: tutte le voci di Wikipedia in inglese, in ordine alfabetico).
Fonte: Wikipedia in inglese, voce «Auto ptr» — https://en.wikipedia.org/wiki/Auto_ptr
Wikidata Q4826145: «class template that was available in previous versions of the C++ Standard Library (declared in the <memory> header file), which provides some basic RAII features for C++ raw pointers» (dati Wikidata in CC0 1.0) — https://www.wikidata.org/wiki/Q4826145
Autori: i contributori di Wikipedia (cronologia: https://en.wikipedia.org/wiki/Auto_ptr?action=history).
Licenza: Creative Commons Attribuzione-Condividi allo stesso modo 4.0 (CC BY-SA 4.0) — https://creativecommons.org/licenses/by-sa/4.0/. Il riuso richiede attribuzione e stessa licenza.
Estratto dell'introduzione non modificato nel contenuto; revisione 1355433056, consultata il 2026-11-10T11:46:23.273Z tramite l'API ufficiale di Wikipedia. Impronta SHA-256 dell'estratto: 2a32ee50ea3a96110351b117159fdaa48e10f732898e7bbd5aebfb59b86999c3