std::auto_ptr - cppreference.com
Da cppreference.com.
|
|
Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate. La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui. |
<metanoindex/>
<tbody> </tbody>
| Elemento definito nell'header <memory> |
||
|
|
(1) | (deprecato) |
|
|
(2) | (deprecato) |
auto_ptr è un puntatore intelligente che gestisce un oggetto ottenuto attraverso nuove ed elimina l'oggetto quando auto_ptr stesso viene distrutto. Esso può essere utilizzato per fornire sicurezza eccezione per gli oggetti allocati dinamicamente, per il passaggio di proprietà degli oggetti allocati dinamicamente, in funzioni e per la restituzione di oggetti allocati dinamicamente, dalle funzioni.
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.
Copiare un auto_ptr copia il puntatore e la proprietà trasferimenti a destinazione: sia copia costruzione e l'assegnazione copia del auto_ptr modificare i loro argomenti della mano destra, e la "copia" non è uguale a quello originale. A causa di queste semantica di copia insolite, auto_ptr non possono essere posti in contenitori standard. std::unique_ptr è preferito per questo e per altri usi.
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.
2)
Specializzazione per void natura è riportata, dichiara l'element_type typedef, ma non le funzioni membro.
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.
Membri tipi
Membro tipo Original: Member type The text has been machine-translated via Google Translate. |
Definition |
element_type
|
T
|
Membri funzioni
crea un nuovo auto_ptr Original: creates a new auto_ptr The text has been machine-translated via Google Translate. (metodo pubblico) | |
distrugge un auto_ptr e l'oggetto gestito Original: destroys an auto_ptr and the managed object The text has been machine-translated via Google Translate. (metodo pubblico) | |
trasferisce la proprietà di un altro auto_ptr Original: transfers ownership from another auto_ptr The text has been machine-translated via Google Translate. (metodo pubblico) | |
converte il puntatore gestito a un puntatore a tipo diverso Original: converts the managed pointer to a pointer to different type The text has been machine-translated via Google Translate. (metodo pubblico) | |
Modificatori Original: Modifiers The text has been machine-translated via Google Translate. | |
distrugge l'oggetto gestito Original: destroys the managed object The text has been machine-translated via Google Translate. (metodo pubblico) | |
rilascia la proprietà dell'oggetto gestito Original: releases ownership of the managed object The text has been machine-translated via Google Translate. (metodo pubblico) | |
Osservatori Original: Observers The text has been machine-translated via Google Translate. | |
ottiene un puntatore all'oggetto gestito Original: obtains a pointer to the managed object The text has been machine-translated via Google Translate. (metodo pubblico) | |
accede l'oggetto gestito Original: accesses the managed object The text has been machine-translated via Google Translate. (metodo pubblico) | |