std::auto_ptr
Aus cppreference.com
![]() |
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
definiert in Header <memory>
|
||
template< class T > class auto_ptr; |
(1) | (veraltet) |
template<> class auto_ptr<void> |
(2) | (veraltet) |
auto_ptr
ist ein Smart-Pointer, der ein Objekt über `new` erhält und löscht das Objekt, wenn auto_ptr
selbst zerstört wird verwaltet. Es kann verwendet werden, um Ausnahme Sicherheit für dynamisch zugewiesenen Objekte liefern, für das Bestehen Besitz von dynamisch zugewiesenen Objekte in Funktionen und für die Rückkehr dynamisch zugewiesenen Objekte von Funktionen werden .Original:
auto_ptr
is a smart pointer that manages an object obtained via new and deletes that object when auto_ptr
itself is destroyed. It may be used to provide exception safety for dynamically-allocated objects, for passing ownership of dynamically-allocated objects into functions and for returning dynamically-allocated objects from functions.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Kopieren eines
2) auto_ptr
kopiert den Zeiger und Miteigentum überträgt das Ziel: sowohl copy Bau und Kopie Zuordnung auto_ptr
ändern ihre rechte Hand Argumente, und die "Kopie" ist nicht gleich das Original. Aufgrund dieser ungewöhnlichen Kopie Semantik, kann auto_ptr
nicht in Standard-Containern platziert werden. std::unique_ptr wird für diese und andere Anwendungen bevorzugt .Original:
Copying an
auto_ptr
copies the pointer and transfers ownership to the destination: both copy construction and copy assignment of auto_ptr
modify their right hand arguments, and the "copy" is not equal to the original. Because of these unusual copy semantics, auto_ptr
may not be placed in standard containers. std::unique_ptr is preferred for this and other uses.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Spezialisierung für Typ void vorgesehen ist, erklärt es die typedef
element_type
, aber keine Member-Funktionen .Original:
Specialization for type void is provided, it declares the typedef
element_type
, but no member functions.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[Bearbeiten] Mitglied Typen
Mitglied Typ
Original: Member type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Definition |
element_type | T |
[Bearbeiten] Member-Funktionen
schafft eine neue auto_ptr Original: creates a new auto_ptr The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (öffentliche Elementfunktion) | |
zerstört eine auto_ptr und das verwaltete Objekt Original: destroys an auto_ptr and the managed object The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (öffentliche Elementfunktion) | |
überträgt das Eigentum von anderen auto_ptr Original: transfers ownership from another auto_ptr The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (öffentliche Elementfunktion) | |
wandelt die verwalteten Zeiger auf einen Zeiger auf unterschiedlichen Typs Original: converts the managed pointer to a pointer to different type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (öffentliche Elementfunktion) | |
Original: Modifiers The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
zerstört das verwaltete Objekt Original: destroys the managed object The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (öffentliche Elementfunktion) | |
freisetzt Eigentum des verwalteten Objekts Original: releases ownership of the managed object The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (öffentliche Elementfunktion) | |
Original: Observers The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
erhält einen Zeiger auf das verwaltete Objekt Original: obtains a pointer to the managed object The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (öffentliche Elementfunktion) | |
greift das verwaltete Objekt Original: accesses the managed object The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (öffentliche Elementfunktion) |